I have written a graphics library with drivers for the ST7789 and ST7735 controllers. (In principle, the library can be easily adapted to any controller).
The library uses an frame buffer between the graphic primitives and the controller. Changes made in the frame buffer are transmitted to the controller using SPI transfers under DMA. To reduce transfers, the frame buffer is divided into blocks; only the modified blocks are transferred to the screen.
The graphic primitives are minimalistic but can be extended as needed.
Thank you for building this library, its a big help to the community. I was able to get your first version working on my board without much trouble, and Iāve been eager to try out your newest version, but have been unable to get even the demo working. VS code gets hung up when building the SPI files and never makes a .bin file. Any ideas what could be causing the problem?
Normally, all the necessary files are loaded. You just need to open the Demo directory in VS Code and configure the UserConfig.h file, which is located in the directory above Demo.
I just tested the process again to verify, and it works fine. Please keep me updated on your progress, and donāt hesitate to reach out if the issue persists.
thanks for responding Philippe, I tried everything exactly as you said to, and I was able to get a .bin file using the 7789 driver config without a problem, which is great, however, Iām using the 7735 controller, and then it wont work when I uncomment that line in the user config file. Thanks for helping, Iām not great with C++, but Iām trying to learn
Im using Visual Studio Code, and I have modified the screen dimentions to 160 width and 128 height. Iāve kept the 16bit color mode (if thatās what you mean by mode), and then altering the pinout for the data lines (Iām using the bksheperd hardware so d8-d11 for my outputs).
When I comment out ā#define TFT_CONTROLEUR_TFT 7735 (line 15)ā and un-comment out "#define TFT_CONTROLEUR_TFT 7789 (line 14) with all of the same settings above the program works fine and I get a bin file.
When I comment out line 14 and un-comment out line 15 and use the 7735 config, this is the error Iām getting in the terminal when I execute the make clean then make command: āIn file included from ā¦/DaisySeedGFX2/TFT_SPI.cpp:10:
ā¦/DaisySeedGFX2/ST7735_Defines.h:100:6: error: āTFT_SPIā has not been declared
100 | void TFT_SPI::Initialise(){
| ^~~~~~~
ā¦/DaisySeedGFX2/ST7735_Defines.h: In function āvoid Initialise()ā:
ā¦/DaisySeedGFX2/ST7735_Defines.h:103:5: error: āSendCommandā was not declared in this scope; did you mean āSDMMC_SendCommandā?
103 | SendCommand(ST7735_SWRESET); // 1: Software reset, 0 args, w/delay
| ^~~~~~~~~~~
| SDMMC_SendCommand
ā¦/DaisySeedGFX2/ST7735_Defines.h:109:7: error: āSendDataā was not declared in this scope
109 | SendData(0x01);
| ^~~~~~~~
make: *** [ā¦/LibDaisy/core/Makefile:286: build/TFT_SPI.o] Error 1ā
Yep that was the problem. I got stuff is appearing on my screen now. Thanks so much for the help. Now Iām working on optimization.
I am noticing that while the circle moves around the screen, somtimes the blue background renders black after the circle passes over it then stays that way until it updates again. Is that an issue that could be solved by changing the FIFO buffer?
I have never encountered this issue, and I donāt believe it is related to the FIFO (if the FIFO is full, the program simply waits). Here are a few possible causes to investigate:
SPI connection issue ā Try reducing the SPI speed by setting TFT_SPI_BaudPrescaler to PS_8 in UserConfig.h.
Layer sizing issue ā Check the code, especially the lines that define the layer size, which should be adjusted:
Iām trying to get it to work.
Connected CS(D7), Reset(D2), AO/DC(D1), MOSI(D10), SCK(D8) and the connections all seem good.
Setup the user config. And then ran the demo at: GitHub - DADDesign-Projects/Demo_DaisySeedGFX2: Demonstrates how to use the "DaisySeedGFX2" graphics library..
Sadly at the moment i get no response from the screen. But also no warnings or errors.
As far as i am able to debug now the SPI gets initialized without an error.
Also tried all SPI modes without any difference.
And checked that the screen is working (on an ESP32).
I donāt have enough information from your message to make a proper diagnosis. The only thing I can point out is that my driver does not handle the CS pināyou need to pull this pin to ground.
Beyond that, could you provide more details? What is the controller type of your screenāST7735 or ST7789? Which library are you using on the ESP32, and with what configuration?
Which demo are you using: Demo or DemoUseFlashMemory? For the latter, you first need to load the contents of the Image and Font folders into the flash memory. In both cases, are you correctly configuring the UserConfig.h file located at the root of the Demo_DaisySeedGFX2 directory?
Itās a ST7735 using the Demo (so not with flash mem.). With the ESP i use TFT_eSPI lib setup as a āBlack Tabā. Iāve tried with CS to ground and several permutations of the settings below.
The config I use is this:
#pragma once // Prevents multiple inclusions of this header file
#define TFT_WIDTH 128 // Screen width in pixels
#define TFT_HEIGHT 160 // Screen height in pixels
#define TFT_CONTROLEUR_TFT 7735 // Uncomment to use the ILI7735 controller
#define TEST1 7789 // Test definition, redundant but illustrative
#define TFT_COLOR 16 // Use 16-bit color mode (default)
#define TFT_SPI_PORT SPI_1 // SPI port used for the display
#define TFT_SPI_MODE Mode0 // SPI mode (Mode 3: CPOL = 1, CPHA = 1)
#define TFT_SPI_BaudPrescaler PS_2 // SPI baud rate prescaler
#define TFT_MOSI D10 // SPI MOSI (Master Out, Slave In) pin
#define TFT_NSS D7 // SPI NSS (Slave Select) pin
#define TFT_SCLK D8 // SPI clock (SCLK) pin
#define TFT_DC D21 // Data/Command control pin
#define TFT_RST D20 // Reset pin for the display
#define NB_BLOC_WIDTH 16 // Number of blocks horizontally
#define NB_BLOC_HEIGHT 20 // Number of blocks vertically
#define NB_BLOCS NB_BLOC_WIDTH *NB_BLOC_HEIGHT // Total number of blocks
#define BLOC_WIDTH TFT_WIDTH / NB_BLOC_WIDTH // Width of each block in pixels
#define BLOC_HEIGHT TFT_HEIGHT / NB_BLOC_HEIGHT // Height of each block in pixels
#define SIZE_FIFO 5 // Number of blocks in the FIFO buffer
I did try a different, more basic ST7735 driver from RadicalTeapot and did manage to get some response from the screen, but it was garbled.
Success!
Wind up it was the CS that needed to be connected to GND indeed.
Thanks for helping so quickly.
And please excuse the poor gif quality, actually looks pretty good IRL.
It almost feels like im seeing motion blur??
Only thing to notice was the white line on the right side moving up and down with the ball.
Thanks for your feedback! Iām glad to hear that itās working for you.
The demo is designed for a 320x240 screen, so youāll need to adjust the code in main to see the full pseudo ping-pong game, especially the paddle that follows the ball.