;***************************************************;
;     M5Stack Core2 with integrated touch display   ;
;               - Custom ESP32 pcb                  ;
;               - ILI9342C TFT                      ;
;               - FT6336U touch controller          ;
;***************************************************;

[env:m5stack-core2]
extends = esp32
board = esp32dev
board_upload.flash_size=16MB
board_upload.maximum_size = 16777216
board_build.partitions = user_setups/esp32/partitions_16MB.csv

build_flags =
    ${env.build_flags}
    ${esp32.build_flags}
    ${esp32.ps_ram}

;region -- TFT_eSPI build options ------------------------
    ${lcd.m5stack}
    -D TFT_RST=-1    ; Managed by AXP_IO4
    -D TFT_SCLK=18
    -D TFT_DC=15
    -D TFT_CS=5
    -D TFT_MOSI=23
    -D TFT_MISO=38
    -D TFT_BCKL=-1    ; Managed by AXP_DC3 & AXP_LDO2
    -D TOUCH_DRIVER=6336
    -D TOUCH_SDA=21
    -D TOUCH_SCL=22
    -D TOUCH_IRQ=39
    -D TOUCH_RST=-1   ; Managed by AXP_IO4
    -D TOUCH_FREQUENCY=400000
;endregion

;region -- Library options -------------------------------
lib_deps =
    ${env.lib_deps}
    ${esp32.lib_deps}
    git+https://github.com/aselectroworks/Arduino-FT6336U.git
    https://github.com/fvanroie/M5Core2.git#AXP192

lib_ignore =
    ${env.lib_ignore}
    GxTFT
    XPT2046_Touchscreen
    Adafruit TouchScreen
    Adafruit BusIO
    Adafruit GFX Library
    sstaub/Ticker
    lv_drv_fsmc_ili9341
    lv_drivers
;endregion
