;***************************************************;
;          Generic ESP32 build with                 ;
;               - ESP32dev board                    ;
;               - ili9488 TFT                       ;
;               - GT911 touch controller            ;
;***************************************************;

[env:stm32f4xx-parallel]
extends = stm32f4
board = diymore_f407vgt
board_build.mcu = stm32f407vet6
upload_protocol = dfu
monitor_port = COM7     ; To change the port, use platform_override.ini
build_flags =
    ${env.build_flags}
    ${stm32f4.build_flags}
    
;region -- TFT_eSPI build options ------------------------
    -D ILI9341_DRIVER=1
    -D TFT_WIDTH=240
    -D TFT_HEIGHT=320
    -D TFT_PARALLEL_8_BIT=1
    -D TFT_BCKL=PB1  ;None, configurable via web UI (e.g. 2 for D4)
    -D TFT_CS=PB12  ; Chip select control pin
    -D TFT_DC=PD13  ; =RS; Data Command control pin - must use a pin in the range 0-31
    -D TFT_RST=-1 ; Reset pin
    -D TFT_WR=PD5   ; Write strobe control pin - must use a pin in the range 0-31
    -D TFT_RD=PD4
    -D TFT_D0=PD14  ; Must use pins in the range 0-31 for the data bus
    -D TFT_D1=PD15  ; so a single register write sets/clears all bits
    -D TFT_D2=PD0
    -D TFT_D3=PD1
    -D TFT_D4=PE7
    -D TFT_D5=PE8
    -D TFT_D6=PE9
    -D TFT_D7=PE10
    ; -D TFT_SPI2
    ; -D TFT_SCLK=PB13
    ; -D TFT_MISO=PB14
    ; -D TFT_MOSI=PB15
    ; -D TOUCH_CS=PB12
    ; -D TOUCH_IRQ=PC5   ; use 34-39 as these are input only pins
    ; -D TOUCH_RST=-1   ; not used, connected to 3.3V
;endregion

;region -- Hasp build options ----------------------------
    -D HASP_OUTPUT_PIN=PA6 ; User LED D2 on MCUDev Black board
    -D HASP_INPUT_PIN=PE4 ; User Button K0 on MCUDev Black board
    -D HASP_USE_HTTP=0
    -D HASP_USE_MQTT=1
    -D HASP_USE_ARDUINOOTA=0
;endregion

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

;region -- Library options -------------------------------
lib_deps =
    ${env.lib_deps}
    ${stm32f4.lib_deps}
    adafruit/Adafruit GFX Library @ ^1.10.3
    adafruit/Adafruit BusIO @ ^1.6.0
    stm32duino/STM32Ethernet @ ^1.2.0

lib_ignore =
    lv_lib_zifont

build_src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<lv_lib_zifont/> +<stm32f4/>
;endregion