; 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

[platformio]
default_envs = 
	mega2560
;	uno
;	nano
	ESP32
	Nucleo-F411RE
	Nucleo-F446RE
	Nucleo-F429ZI
src_dir = .
include_dir = .

[env]
build_flags = -Wall -Wextra
; monitor_filters = time

[env:samd21-dev-usb]
platform = atmelsam
board = sparkfun_samd21_dev_usb
framework = arduino
upload_protocol = sam-ba
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -std=c++17 ${env.build_flags}

[env:samd21-zero-usb]
platform = atmelsam
board = zeroUSB
framework = arduino
upload_protocol = sam-ba
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -std=c++17 ${env.build_flags}

[env:Arduino-M0]
platform = atmelsam
board = mzeroUSB
framework = arduino
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -std=c++17 ${env.build_flags}

[env:mega2560-debug]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = 
	${env.lib_deps}
	arduino-libraries/Ethernet
	SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = -DDIAG_IO=2 -DDIAG_LOOPTIMES ${env.build_flags}

[env:mega2560-no-HAL]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = 
	${env.lib_deps}
	arduino-libraries/Ethernet
	SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = -DIO_NO_HAL ${env.build_flags}

[env:mega2560-I2C-wire]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = 
	${env.lib_deps}
	arduino-libraries/Ethernet
	SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = -DI2C_USE_WIRE ${env.build_flags}

[env:mega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = 
	${env.lib_deps}
	arduino-libraries/Ethernet
	SPI

lib_ignore = WiFi101
			WiFi101_Generic
			WiFiEspAT
			WiFiMulti_Generic
			WiFiNINA_Generic

monitor_speed = 115200
monitor_echo = yes
build_flags = ${env.build_flags}

[env:mega2560-eth]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = 
    ${env.lib_deps}
    arduino-libraries/Ethernet
    SPI
lib_ignore = WiFi101
            WiFi101_Generic
            WiFiEspAT
            WiFiMulti_Generic
            WiFiNINA_Generic
monitor_speed = 115200
monitor_echo = yes
build_flags = ${env.build_flags}

[env:mega328]
platform = atmelavr
board = uno
framework = arduino
lib_deps = 
	${env.lib_deps}
	arduino-libraries/Ethernet
	SPI
monitor_speed = 115200
monitor_echo = yes
build_flags= ${env.build_flags}

[env:unowifiR2]
platform = atmelmegaavr
board = uno_wifi_rev2
framework = arduino
lib_deps = 
	${env.lib_deps}
	arduino-libraries/Ethernet
	SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = ${env.build_flags} "-DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO_WIFI_DEV_ED -DARDUINO_ARCH_AVR -DESP_CH_UART -DESP_CH_UART_BR=19200"

[env:nanoevery]
platform = atmelmegaavr
board = nano_every
framework = arduino
lib_deps = 
	${env.lib_deps}
	arduino-libraries/Ethernet
	SPI
monitor_speed = 115200
monitor_echo = yes
upload_speed = 19200
build_flags = ${env.build_flags}

[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -mcall-prologues ${env.build_flags}

[env:nano]
platform = atmelavr
board = nanoatmega328new
board_upload.maximum_size = 32256
framework = arduino
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -mcall-prologues ${env.build_flags}

[env:ESP32]
; Lock version to 6.7.0 as that is
; Arduino v2.0.16 (based on IDF v4.4.7)
; which is the latest version based
; on IDF v4. We can not use IDF v5.
platform = espressif32 @ 6.7.0
board = esp32dev
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes

[env:Nucleo-F411RE]
platform = ststm32 @ 19.0.0
board = nucleo_f411re
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes

[env:Nucleo-F446RE]
platform = ststm32 @ 19.0.0
board = nucleo_f446re
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes

; Experimental - no reason this should not work, but not
; tested as yet
;
[env:Nucleo-F401RE]
platform = ststm32 @ 19.0.0
board = nucleo_f401re
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes

; Commented out by default as the F13ZH has variant files
; but NOT the nucleo_f413zh.json file which needs to be
; installed before you can let PlatformIO see this
;
; [env:Nucleo-F413ZH]
; platform = ststm32 @ 19.0.0
; board = nucleo_f413zh
; framework = arduino
; lib_deps = ${env.lib_deps}
; build_flags = -std=c++17  -Os -g2 -Wunused-variable
; monitor_speed = 115200
; monitor_echo = yes

; Commented out by default as the F446ZE needs variant files
; installed before you can let PlatformIO see this
;
[env:Nucleo-F446ZE]
platform = ststm32 @ 19.0.0
board = nucleo_f446ze
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes

; Commented out by default as the F412ZG needs variant files
; installed before you can let PlatformIO see this
;
; [env:Nucleo-F412ZG]
; platform = ststm32 @ 19.0.0
; board = nucleo_f412zg
; framework = arduino
; lib_deps = ${env.lib_deps}
; build_flags = -std=c++17 -Os -g2 -Wunused-variable
; monitor_speed = 115200
; monitor_echo = yes
; upload_protocol = stlink

; Experimental - Ethernet beta test
;
[env:Nucleo-F429ZI]
platform = ststm32 @ 19.0.0
board = nucleo_f429zi
framework = arduino
lib_deps = ${env.lib_deps}
			stm32duino/STM32Ethernet @ ^1.4.0
			stm32duino/STM32duino LwIP @ ^2.1.3
lib_ignore = WiFi101
			WiFi101_Generic
			WiFiEspAT
			WiFiMulti_Generic
			WiFiNINA_Generic
build_flags = -std=c++17 -Os -g2 ${env.build_flags} -DCUSTOM_PERIPHERAL_PINS
monitor_speed = 115200
monitor_echo = yes
upload_protocol = stlink

; Experimental - Ethernet beta test
;
[env:Nucleo-F439ZI]
platform = ststm32 @ 19.0.0
board = nucleo_f439zi
framework = arduino
lib_deps = ${env.lib_deps}
			stm32duino/STM32Ethernet @ ^1.4.0
			stm32duino/STM32duino LwIP @ ^2.1.3
lib_ignore = WiFi101
			WiFi101_Generic
			WiFiEspAT
			WiFiMulti_Generic
			WiFiNINA_Generic
build_flags = -std=c++17 -Os -g2 ${env.build_flags} -DCUSTOM_PERIPHERAL_PINS
monitor_speed = 115200
monitor_echo = yes
upload_protocol = stlink

[env:Teensy3_2]
platform = teensy
board = teensy31
framework = arduino
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet

[env:Teensy3_5]
platform = teensy
board = teensy35
framework = arduino
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet

[env:Teensy3_6]
platform = teensy
board = teensy36
framework = arduino
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet

[env:Teensy4_0]
platform = teensy
board = teensy40
framework = arduino
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet

[env:Teensy4_1]
platform = teensy
board = teensy41
framework = arduino
build_flags = -std=c++17  -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore =
