Skip to content

Commit

Permalink
Merge pull request #838 from bennydiamond/feature/esp32-2432s022c_sup…
Browse files Browse the repository at this point in the history
…port

Initial support for Guition ESP32-2432S022C
  • Loading branch information
fvanroie authored Dec 22, 2024
2 parents 7e5762d + 1e85b3c commit 001bc63
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 0 deletions.
67 changes: 67 additions & 0 deletions src/drv/tft/tft_driver_lovyangfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,73 @@ void LovyanGfx::init(int w, int h)
cfg.pin_mosi = TOUCH_MOSI;
cfg.pin_miso = TOUCH_MISO;
cfg.pin_cs = TOUCH_CS;
_touch_instance->config(cfg);
_panel_instance->setTouch(_touch_instance);
}
#elif defined(ESP32_2432S022C)
//pinMode(PWR_EN, OUTPUT);
//digitalWrite(PWR_EN, HIGH);

auto _panel_instance = new lgfx::Panel_ST7789();
auto _bus_instance = new lgfx::Bus_Parallel8();
auto _touch_instance = new lgfx::Touch_CST816S();
{
auto cfg = _bus_instance->config();
cfg.freq_write = 16000000;
cfg.pin_wr = TFT_WR;
cfg.pin_rd = TFT_RD;
cfg.pin_rs = TFT_DC; // D/C
cfg.pin_d0 = TFT_D0;
cfg.pin_d1 = TFT_D1;
cfg.pin_d2 = TFT_D2;
cfg.pin_d3 = TFT_D3;
cfg.pin_d4 = TFT_D4;
cfg.pin_d5 = TFT_D5;
cfg.pin_d6 = TFT_D6;
cfg.pin_d7 = TFT_D7;
_bus_instance->config(cfg);
_panel_instance->setBus(_bus_instance);
}

{
auto cfg = _panel_instance->config();
cfg.pin_cs = TFT_CS;
cfg.pin_rst = TFT_RST;
cfg.pin_busy = TFT_BUSY;
cfg.memory_width = TFT_WIDTH;
cfg.memory_height = TFT_HEIGHT;
cfg.panel_width = TFT_WIDTH;
cfg.panel_height = TFT_HEIGHT;
cfg.offset_x = 0;
cfg.offset_y = 0;
cfg.offset_rotation = TFT_ROTATION;
cfg.dummy_read_pixel = 8;
cfg.dummy_read_bits = 1;
cfg.readable = true;
cfg.invert = false;
cfg.rgb_order = false;
cfg.dlen_16bit = false;
cfg.bus_shared = false;
_panel_instance->config(cfg);
}

{
auto cfg = _touch_instance->config();

cfg.x_min = 0;
cfg.x_max = TFT_WIDTH;
cfg.y_min = 0;
cfg.y_max = TFT_HEIGHT;
cfg.pin_int = TOUCH_IRQ;
cfg.bus_shared = true;
cfg.offset_rotation = 0;

cfg.i2c_port = I2C_TOUCH_PORT;
cfg.i2c_addr = I2C_TOUCH_ADDRESS;
cfg.pin_sda = TOUCH_SDA;
cfg.pin_scl = TOUCH_SCL;
cfg.freq = I2C_TOUCH_FREQUENCY;

_touch_instance->config(cfg);
_panel_instance->setTouch(_touch_instance);
}
Expand Down
64 changes: 64 additions & 0 deletions user_setups/esp32/esp32-2432s022c.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[env:esp32-2432s022c]
extends = arduino_esp32_v2, flash_4mb
board = esp32dev
upload_speed = 921600

build_flags =
${arduino_esp32_v2.build_flags}
${esp32.no_ps_ram}

;region -- TFT_eSPI build options ------------------------
-D ESP32_2432S022C=1
-D LGFX_USE_V1=1
; -D USER_SETUP_LOADED=1
-D ST7789_DRIVER=1
; -D CGRAM_OFFSET=1
; -DSUPPORT_TRANSACTIONS
-D TFT_INVERSION_OFF
-D TFT_PARALLEL_8_BIT
-D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree
-D TFT_WIDTH=240
-D TFT_HEIGHT=320
-D TFT_CS=17 ; Chip select control pin=library pulls permanently low
-D TFT_DC=16 ; Data Command control pin
-D TFT_RST=-1 ; Reset pin, toggles on startup
-D TFT_WR=4 ; Write strobe control pin
-D TFT_RD=2 ; Read strobe control pin
-D TFT_D0=15
-D TFT_D1=13
-D TFT_D2=12
-D TFT_D3=14
-D TFT_D4=27
-D TFT_D5=25
-D TFT_D6=33
-D TFT_D7=32
-D TFT_BCKL=0 ; LED back-light

;CST816S driver
-D TOUCH_DRIVER=0x816
-D HASP_USE_LGFX_TOUCH=1
-D I2C_TOUCH_PORT=I2C_NUM_0
-D TOUCH_SDA=21
-D TOUCH_SCL=22
-D TOUCH_IRQ=-1
-D TOUCH_RST=-1
-D I2C_TOUCH_FREQUENCY=400000
-D I2C_TOUCH_ADDRESS=0x15


-D SD_MISO=19
-D SD_MOSI=23
-D SD_SCLK=18
-D SD_CS=5

; sound output is on IO26, through an SC8002B IC

; -- Debugging options -----------------------------
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
;endregion

lib_deps =
${arduino_esp32_v2.lib_deps}
${lovyangfx.lib_deps}
;${tft_espi.lib_deps}

0 comments on commit 001bc63

Please sign in to comment.