Page 1 of 1

Adafruit ILI9341 SPI for stm32duino

Posted: Sat Jan 30, 2021 8:42 am
by ag123
This is an (yet another) implementation of Adafruit ILI9341 SPI lcd library for STM32duino official STM core and libmaple (roger's and steve's mainly F4) core.

I've attempted a 'multi-core' (STM official, steve's libmaple (F4) (also in roger's core F4), and roger's (F1) libmaple) implementation
https://github.com/ag88/Adafruit_ILI9341_SPI_stm32duino

full story in this thread
viewtopic.php?f=50&t=895

Re: Adafruit ILI9341 SPI for stm32duino

Posted: Sat Jan 30, 2021 1:32 pm
by mrburnette
If one display is good, two has to be better: (H/W SPI driven)
viewtopic.php?p=5789#p5789

Re: Adafruit ILI9341 SPI for stm32duino

Posted: Sat Jan 30, 2021 2:05 pm
by ag123
that one is nice for 2 displays :lol:

Re: Adafruit ILI9341 SPI for stm32duino

Posted: Sun Jan 31, 2021 10:57 am
by ag123
just found out that what i've done in my implementation using hardware bit banding is called 'fast pin io'
if one is using the original Adafruit ILI9341 libs
you may like to explore the defines
USE_FAST_PINIO
HAS_PORT_SET_CLR
https://github.com/adafruit/Adafruit-GF ... t_SPITFT.h
https://github.com/adafruit/Adafruit-GF ... SPITFT.cpp
https://github.com/adafruit/Adafruit_ILI9341
at your own risk though. using hardware bit banding accounts for quite significant speedups toggling the CS and DC (data/command) pins.
but they fall flat the moment you use a mcu that don't have that. it just 'don't work'
cortex M3 (stm32f1xx), M4 (stm32f4xx) and higher etc have bit banding and i simply use them in my lib leaving no if defs.
if you happen to use an mcu that doesn't do bit banding with my implementation
you can try defining in Adafruit_ILI9341_STM.h

Code: Select all

/* note bit banding is used here */
	inline void dc_command() { *dc_addr = 0; } // 0
	inline void dc_data()    { *dc_addr = 1; } // 1
	inline void cs_clear()   { *cs_addr = 0; }
	inline void cs_set()     { *cs_addr = 1; }
as

Code: Select all

	inline void dc_command() { digitalWrite(_dc,0); } // 0
	inline void dc_data()    { digitalWrite(_dc,1); } // 1
	inline void cs_clear()   { digitalWrite(_cs,0); }
	inline void cs_set()     { digitalWrite(_cs,1); }
of course that is (a lot) slower, but it may at least make it work, hope it helps.