Skip to content

Instantly share code, notes, and snippets.

@konsumer
Last active October 22, 2025 02:07
Show Gist options
  • Save konsumer/7123c3defb868fb72d9c1960200361ee to your computer and use it in GitHub Desktop.
Save konsumer/7123c3defb868fb72d9c1960200361ee to your computer and use it in GitHub Desktop.
This is for a not-exactly CYD: https://www.tztstore.com/goods/show-7983.html
// for https://www.tztstore.com/goods/show-7983.html
// this should also go in TFT_eSPI/User_Setup.h
#define TFT_BL 27
#define TFT_MISO 12
#define TFT_MOSI 13
#define TFT_SCLK 14
#define TFT_CS 15
#define TFT_DC 2
#define TFT_RST -1
// Touch Panel (TP)
#define TP_CLK 14
#define TP_CS 33
#define TP_DIN 13
#define TP_OUT 12
#define TP_IRQ 36
// same, for https://randomnerdtutorials.com/lvgl-cheap-yellow-display-esp32-2432s028r/
#define XPT2046_CLK TP_CLK
#define XPT2046_CS TP_CS
#define XPT2046_IRQ TP_IRQ
#define XPT2046_MISO TP_DIN
#define XPT2046_MOSI TP_OUT
// TF Card (SD Card)
#define SD_CS 5
#define SD_MOSI 23
#define SD_MISO 19
#define SD_SCK 18
// Audio I2S pins
#define I2S_DOUT 26
// LED-RGB
#define LED_R 4
#define LED_G 17
#define LED_B 16
// Light-dependant resistor for "brightness" needs to be isolated from screen backlight & RGB LED
#define LDR_PIN 34
// Boot Button
#define BTN_BOOT 0
// for https://www.tztstore.com/goods/show-7983.html
// put this in Arduino/libraries/TFT_eSPI/
#define USER_SETUP_INFO "CYD"
#define ILI9341_2_DRIVER
#define TFT_INVERSION_ON
#define TFT_WIDTH 240
#define TFT_HEIGHT 320
#define TFT_BL 27 // LED back-light control pin, might also be 21
#define TFT_MISO 12
#define TFT_MOSI 13
#define TFT_SCLK 14
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
// #define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT // e SPIFFS filing system and smooth-font needs 20k bytes in FLASH
#define SPI_FREQUENCY 80000000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment