;***************************************************;
;       YeaCreate Nscreen32                         ;
;               - 4" ST7796 TFT 8-biy parallell     ;
;               - gt911 touch controller            ;
;***************************************************;
; untested config

[env:yeacreate-nscreen32]
extends = esp32_16mb_v2
board = esp32dev

build_flags =
    ${env.build_flags}
    ${esp32.build_flags}
    ${esp32.ps_ram}
    ${esp32.hspi}        ; Use HSPI hardware SPI bus
    -D HASP_MODEL="YeaCreate Nscreen32"

;region -- TFT_eSPI build options ------------------------
    -D USER_SETUP_LOADED=1
    ;-D LGFX_USE_V1=1
    -D ST7796_DRIVER=1
    -D ESP32_PARALLEL=1
    -D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree
    -D TFT_WIDTH=320
    -D TFT_HEIGHT=480
    ; ESP32 pins used for the parallel interface TFT
    -D TFT_CS=33    ; Chip select control pin
    -D TFT_DC=15    ; Data Command control pin - must use a pin in the range 0-31 also named RS
    -D TFT_WR=4     ; Write strobe control pin - must use a pin in the range 0-31
    -D TFT_RD=2
    -D TFT_D0=12    ; Must use pins in the range 0-31 for the data bus
    -D TFT_D1=13    ; so a single register write sets/clears all bits
    -D TFT_D2=26
    -D TFT_D3=25
    -D TFT_D4=19
    -D TFT_D5=18
    -D TFT_D6=27
    -D TFT_D7=14
    -D TFT_RST=32   ; Reset pin
    ;-D TFT_BCKL=32  ;None, configurable via web UI (e.g. 2 for D4)
    -D SUPPORT_TRANSACTIONS
    -D TOUCH_DRIVER=0x0911  ; GT911 Capacitive touch panel driver 
    -D TOUCH_SDA=21
    -D TOUCH_SCL=22
    -D TOUCH_IRQ=5
    -D TOUCH_RST=23
    -D I2C_TOUCH_FREQUENCY=400000
    -D SPI_FREQUENCY=40000000
    -D SPI_READ_FREQUENCY=20000000
;endregion

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

;region -- Library options -------------------------------
lib_deps =
    ${env.lib_deps}
    ${esp32.lib_deps}
    ${arduino_esp32_v2.lib_deps}
    ${tft_espi.lib_deps}
    ; ${lovyangfx.lib_deps}
    ${goodix.lib_deps}

lib_ignore =
    ${env.lib_ignore}
    ${esp32.lib_ignore}
    ${arduino_esp32_v2.lib_ignore}
;endregion