From 964184d4c458b39ec3dbfe76fef31505694125d8 Mon Sep 17 00:00:00 2001 From: yetanothercarbot <55005345+yetanothercarbot@users.noreply.github.com> Date: Sat, 5 Aug 2023 20:47:44 +1000 Subject: [PATCH] Support ESP-BOX --- src/drv/tft/tft_driver_lovyangfx.cpp | 25 ++++++++++++++++ user_setups/esp32s3/esp-box.ini | 45 ++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 user_setups/esp32s3/esp-box.ini diff --git a/src/drv/tft/tft_driver_lovyangfx.cpp b/src/drv/tft/tft_driver_lovyangfx.cpp index d783a2d72..6794a4ec6 100644 --- a/src/drv/tft/tft_driver_lovyangfx.cpp +++ b/src/drv/tft/tft_driver_lovyangfx.cpp @@ -425,6 +425,31 @@ lgfx::ITouch* _init_touch(Preferences* preferences) } #endif +#if TOUCH_DRIVER == 0x21100 + { + auto touch = new lgfx::Touch_TT21xxx(); + auto cfg = touch->config(); + + cfg.x_min = 0; + cfg.x_max = TFT_WIDTH - 1; + cfg.y_min = 0; + cfg.y_max = TFT_HEIGHT - 1; + cfg.pin_int = TOUCH_IRQ; + cfg.bus_shared = true; + cfg.offset_rotation = TOUCH_OFFSET_ROTATION; + + // I2C接続の場合 + 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->config(cfg); + return touch; + } +#endif + #endif // HASP_USE_LGFX_TOUCH return nullptr; diff --git a/user_setups/esp32s3/esp-box.ini b/user_setups/esp32s3/esp-box.ini new file mode 100644 index 000000000..aff0848e5 --- /dev/null +++ b/user_setups/esp32s3/esp-box.ini @@ -0,0 +1,45 @@ +;***************************************************; +; ESP-BOX ; +; - ILI9342 TFT ; +; - TT21100 touch controller ; +;***************************************************; + +[env:esp-box] +extends = arduino_esp32s3_v2, flash_16mb +board = esp32s3box +board_build.arduino.memory_type = qio_opi + +build_flags = + -D HASP_MODEL="ESP-BOX" + ${arduino_esp32s3_v2.build_flags} + ${esp32s3.ps_ram} + +;region -- TFT_eSPI build options ------------------------ + -D LGFX_USE_V1=1 + -D HASP_USE_LGFX_TOUCH=1 + -D TOUCH_DRIVER=0x21100 + -D ILI9341_DRIVER=1 + -D INVERT_COLORS=0 + -D TFT_ROTATION=2 + -D TFT_WIDTH=320 + -D TFT_HEIGHT=240 + -D TOUCH_SDA=8 + -D TOUCH_SCL=18 + -D TOUCH_OFFSET_ROTATION=4 ; 1=swap xy, 2=invert x, 4=inverty + -D TOUCH_IRQ=3 + -D I2C_TOUCH_FREQUENCY=400000 + -D I2C_TOUCH_PORT=1 + -D I2C_TOUCH_ADDRESS=0x24 + -D TFT_DC=4 + -D TFT_CS=5 + -D TFT_MOSI=6 + -D TFT_SCLK=7 + -D TFT_RST=48 + -D TFT_BCKL=45 + -D SPI_FREQUENCY=40000000 +;endregion + +lib_deps = + ${arduino_esp32s3_v2.lib_deps} + ${lovyangfx.lib_deps} + ${tft_espi.lib_deps}