From 4df50bb6769fc2113eebd9c2ba4f6ad048e7998b Mon Sep 17 00:00:00 2001 From: imi415 Date: Sun, 20 Jun 2021 21:04:18 +0800 Subject: [PATCH] Added 320x240 2.0" LCD variant. --- st7789_lcd.c | 19 +++++++++++++++++++ st7789_lcd.h | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/st7789_lcd.c b/st7789_lcd.c index b10a1d6..1998aea 100644 --- a/st7789_lcd.c +++ b/st7789_lcd.c @@ -1,5 +1,24 @@ #include "st7789_lcd.h" +uint8_t st7789_init_seq_zjy_320_240[] = { + 0x05, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33, // Porch Setting + 0x01, 0xB7, 0x35, // Gate Control + 0x01, 0xBB, 0x32, // VCOM Setting // Factory 0x19 -> 0.725V + 0x01, 0xC0, 0x2C, // LCM Control + 0x01, 0xC2, 0x01, // VDV and VRH Command Enable + 0x01, 0xC3, 0x15, // VRH Set // Factory 12H + 0x01, 0xC4, 0x20, // VDV Set + 0x01, 0xC6, 0x0F, // Frame Rate Control in Normal Mode + 0x02, 0xD0, 0xA4, 0xA1, // Power Control 1 + 0x0E, 0xE0, 0xD0, 0x08, 0x0E, 0x09, 0x09, 0x05, + 0x31, 0x33, 0x48, 0x17, 0x14, 0x15, 0x31, + 0x34, // Positive Voltage Gamma Control + 0x0E, 0xE1, 0xD0, 0x08, 0x0E, 0x09, 0x15, 0x31, + 0x33, 0x48, 0x17, 0x2F, 0x14, 0x15, 0x31, + 0x34, // Negative Voltage Gamma Control + 0x00, 0x21, // Inversion On +}; + uint8_t st7789_init_seq_zjy_240_240[] = { 0x05, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33, // Porch Setting 0x01, 0xB7, 0x35, // Gate Control diff --git a/st7789_lcd.h b/st7789_lcd.h index 662306d..819fbb0 100644 --- a/st7789_lcd.h +++ b/st7789_lcd.h @@ -53,6 +53,12 @@ typedef struct { #define PANEL_X_OFFSET 53 #define PANEL_Y_OFFSET 40 +#elif ST7789_PANEL_ZJY_320 + +#define ST7789_PANEL_SELECTION st7789_init_seq_zjy_320_240 +#define PANEL_X_OFFSET 0 +#define PANEL_Y_OFFSET 0 + #else #warning "Panel not defined, using default."