Example code for driving M5StickC-Plus/Plus2 ST7789V2 display using ESP-IDF's SPI driver.
esp-idf v4.4/v5.x.
git clone https://github.com/nopnop2002/esp-idf-m5stickC-Plus
cd esp-idf-m5stickC-Plus/screen
idf.py set-target esp32
idf.py menuconfig
idf.py flash -b 115200 monitor
You need to specify Baud rate for flashing.
It's possible to text rotation and invert.
It's possible to indicate more than one font at the same time.
You can add your original font file.
The format of the font file is the FONTX format.
Your font file is put in font directory.
Your font file is uploaded to SPIFFS partition using meke flash.
Please refer this page about FONTX format.
FontxFile yourFont[2];
InitFontx(yourFont,"/spiffs/your_font_file_name","");
uint8_t ascii[10];
strcpy((char *)ascii, "MyFont");
lcdDrawString(dev, yourFont, x, y, ascii, color);
Change here.
#define RED rgb565(255, 0, 0) // 0xf800
#define GREEN rgb565( 0, 255, 0) // 0x07e0
#define BLUE rgb565( 0, 0, 255) // 0x001f
#define BLACK rgb565( 0, 0, 0) // 0x0000
#define WHITE rgb565(255, 255, 255) // 0xffff
#define GRAY rgb565(128, 128, 128) // 0x8410
#define YELLOW rgb565(255, 255, 0) // 0xFFE0
#define CYAN rgb565( 0, 156, 209) // 0x04FA
#define PURPLE rgb565(128, 0, 128) // 0x8010