simplerST7735, Longan nano, STM32duino, ...
The ST7735 LCD controller is very common and is actually close to a ILI9341
It is connected to either SPI or parralel bus
The problem is : How to make the code portable while having decent performances
Option 1:
Use #ifdef ATMEL, ESP32
It is fast, but the code becomes really ugly pretty fast.
And each time you add a new target, you modifiy the existing code for everyone.
Option 2:
Use a very low level SPI abstraction. it is portable, but the performances are not so great
Additionnaly, depending on the use case, since it is YOUR project, you can speed up things since you know what you are doing with the SPI.
Option 3: (our)
We have a small abstraction layer providing the following services :
init(): Initialize the chip. Can be tuned to setup SPI,// bus, LCD width/height/and chip specific initialization
write/write16: Send a single byte/uint16_t
writeWords() : Send a buffer of 16 bits word
floodWord() : Send the same word N times
(The performances are very linked to the 2 last ones).
The common code does not know how you access the chip, and is completely platform independant.
The only platform thing it does is toggling the CS and DC pins, and this is fairly common / easy to emulate.
The platform code can be very optimized because it only runs on 1 platform, it can contain platform specific code (DMA, assembly,....), use threads/interrrupts
Furthermore, if you want to add a new platform you can do it OUTSIDE the ST7735 source tree,
The end result is very portable code that yields decent performances.
Comments
Post a Comment