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

[env:m5stack-core2]
extends = arduino_esp32_v2, flash_16mb
board = esp32dev

build_flags =
    -D HASP_MODEL="M5Stack Core2"
    ${arduino_esp32_v2.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=0x6336
    -D TOUCH_SDA=21
    -D TOUCH_SCL=22
    -D TOUCH_IRQ=39
    -D TOUCH_RST=-1   ; Managed by AXP_IO4
    -D I2C_TOUCH_FREQUENCY=400000
    -D I2C_TOUCH_ADDRESS=0x38
;endregion

lib_deps =
    ${arduino_esp32_v2.lib_deps}
    ${tft_espi.lib_deps}
    ${ft6336.lib_deps}
    https://github.com/fvanroie/M5Core2.git#AXP192
