;***************************************************;
;        ESP32 DevKitC (38pin) build with           ;
;               - ili9488 TFT SPI 4-WIRE            ;
;               - xpt2046 touch controller          ;
;***************************************************;

[freetouchdecks3]
extends = arduino_esp32s3_v2
board = esp32-s3-devkitc-1
board_build.arduino.memory_type = opi_opi

build_flags =
    -D HASP_MODEL="FreeTouchDeck S3"
    ${arduino_esp32s3_v2.build_flags}
    ${esp32s3.no_ps_ram}

;region -- TFT_eSPI build options ------------------------
    -D USER_SETUP_LOADED=1
    ;-D LGFX_USE_V1=1
    -D ILI9488_DRIVER=1
    -D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree
    -D TFT_WIDTH=320
    -D TFT_HEIGHT=480
    -D TFT_MISO=13
    -D TFT_MOSI=11
    -D TFT_SCLK=12
    -D TFT_CS=10      ;// Chip select control pin
    -D TFT_DC=6       ;// Data Command control pin
    -D TFT_RST=5      ;// Reset pin (could connect to RST pin)
    -D TFT_BCKL=7     ;None, configurable via web UI (e.g. 2 for D4)
    -D SUPPORT_TRANSACTIONS
    -D                           =15
    -D TOUCH_DRIVER=0x2046 ; XPT2606 Resistive touch panel driver
    -D TOUCH_SDA=-1
    -D TOUCH_SCL=-1
    -D TOUCH_IRQ=16
    -D I2C_TOUCH_PORT=0
    -D I2C_TOUCH_ADDRESS=0
    -D I2C_TOUCH_FREQUENCY=0
    -D SPI_FREQUENCY=27000000
    -D SPI_TOUCH_FREQUENCY=2500000
    -D SPI_READ_FREQUENCY=20000000
    -D SD_CS=4
;endregion

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

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


[env:freetouchdeck-s3_8MB]
extends = freetouchdecks3, flash_8mb
