; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env]
platform = espressif32
framework = arduino
lib_deps = 
	https://github.com/MajenkoLibraries/SoftSPI
		bblanchon/ArduinoJson

platform_packages = 
board_build.filesystem = littlefs
monitor_filters = esp32_exception_decoder
monitor_speed = 115200
board_build.f_cpu = 240000000L
build_flags =
	-D BUILD_ENV_NAME=$PIOENV
	-D BUILD_TIME=$UNIX_TIME
	-D USER_SETUP_LOADED
	-D DISABLE_ALL_LIBRARY_WARNINGS

; ----------------------------------------------------------------------------------------
; !!! this configuration expects the Mini_AP
; 
; ----------------------------------------------------------------------------------------

[env:S2_Tag_Flasher]
platform = https://github.com/platformio/platform-espressif32.git
board=lolin_s2_mini
board_build.partitions = default.csv
build_unflags =
  -D ARDUINO_USB_MODE=1
  -D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
build_flags = 
	${env.build_flags}
	-D HAS_USB
	-D OPENEPAPERLINK_NANO_AP_PCB
	-D ARDUINO_USB_MODE=0
	-D CONFIG_SPIRAM_USE_MALLOC=1
	-D CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
	-D BOARD_HAS_PSRAM
	-D FLASHER_EXT_SS=34
	-D FLASHER_EXT_CLK=33
	-D FLASHER_EXT_MOSI=37
	-D FLASHER_EXT_MISO=35
	-D FLASHER_EXT_RESET=39
	-D FLASHER_EXT_POWER={16,17,18,21}
	-D FLASHER_EXT_TXD=40
	-D FLASHER_EXT_RXD=36
	-D FLASHER_EXT_TEST=38
  	-D FLASHER_LED=15
build_src_filter = 
   +<*>-<ousbflasher.cpp>-<oswd.cpp>
board_build.psram_type=qspi_opi
board_upload.maximum_size = 4194304
board_upload.maximum_ram_size = 327680
board_upload.flash_size = 4MB