; LilyGo T-Deck
[env:t-deck]
extends = esp32s3_base
board = t-deck
board_check = true
board_build.partitions = default_16MB.csv
upload_protocol = esptool

build_flags = ${esp32s3_base.build_flags} 
  -DT_DECK 
  -DBOARD_HAS_PSRAM
  -DGPS_POWER_TOGGLE
  -Ivariants/t-deck

lib_deps = ${esp32s3_base.lib_deps}
	lovyan03/LovyanGFX@^1.2.0
  earlephilhower/ESP8266Audio@^1.9.9
  earlephilhower/ESP8266SAM@^1.0.1


[env:t-deck-tft]
extends = env:t-deck

build_flags =
  ${env:t-deck.build_flags}
  -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks
  -D INPUTDRIVER_I2C_KBD_TYPE=0x55
  -D INPUTDRIVER_ENCODER_TYPE=3
  -D INPUTDRIVER_ENCODER_LEFT=1
  -D INPUTDRIVER_ENCODER_RIGHT=2
  -D INPUTDRIVER_ENCODER_UP=3
  -D INPUTDRIVER_ENCODER_DOWN=15
  -D INPUTDRIVER_ENCODER_BTN=0
  -D INPUTDRIVER_BUTTON_TYPE=0
  -D HAS_SDCARD
  -D HAS_SCREEN=1
  -D HAS_TFT=1
  -D USE_I2S_BUZZER
  -D RAM_SIZE=5120
	-D LV_LVGL_H_INCLUDE_SIMPLE
	-D LV_CONF_INCLUDE_SIMPLE
	-D LV_COMP_CONF_INCLUDE_SIMPLE
  -D LV_USE_SYSMON=0
  -D LV_USE_PROFILER=0
  -D LV_USE_PERF_MONITOR=0
  -D LV_USE_MEM_MONITOR=0
  -D LV_USE_LOG=0
  -D USE_LOG_DEBUG
  -D LOG_DEBUG_INC=\"DebugConfiguration.h\"
  -D RADIOLIB_DEBUG_BASIC=0
  -D RADIOLIB_DEBUG_SPI=0
  -D RADIOLIB_DEBUG_PROTOCOL=0
  -D RADIOLIB_SPI_PARANOID=0
;  -D CALIBRATE_TOUCH=0
  -D LGFX_SCREEN_WIDTH=240
  -D LGFX_SCREEN_HEIGHT=320
  -D DISPLAY_SIZE=320x240 ; landscape mode
  -D LGFX_DRIVER=LGFX_TDECK
  -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_T_DECK.h\"
;  -D LVGL_DRIVER=LVGL_TDECK
;  -D GFX_DRIVER_INC=\"graphics/LVGL/LVGL_T_DECK.h\"
;  -D LV_USE_ST7789=1
  -D VIEW_320x240
;	-D USE_DOUBLE_BUFFER
  -D USE_PACKET_API
  -D MAP_FULL_REDRAW
  -D CUSTOM_TOUCH_DRIVER

lib_deps =
  ${env:t-deck.lib_deps}
  ${device-ui_base.lib_deps}
  https://github.com/bitbank2/bb_captouch/archive/refs/tags/1.3.1.zip
