From b107ac4d8fa918696f19510c84c42c0fa408b53b Mon Sep 17 00:00:00 2001 From: fvanroie Date: Wed, 25 Mar 2020 20:12:27 +0100 Subject: [PATCH] Restucture configurations --- platformio.ini | 169 +++++++++++++++++++++++++------------------------ 1 file changed, 85 insertions(+), 84 deletions(-) diff --git a/platformio.ini b/platformio.ini index 3a0963ec..335fd48e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,7 +10,7 @@ ;*************************************************** -; Common settings +; Common project settings ;*************************************************** [platformio] default_envs = @@ -23,49 +23,26 @@ default_envs = ;d132-unoshield ;nodemcu32s-raspi +; -- Location of the configuration files include_dir = include ;lv_lib_zifont ;lvgl ;png_decoder +; -- Add customizations to this file only extra_configs = platformio_override.ini -; -- By default there are no ${override.build_flags} set -; -- to use it, copy platformio_override.ini from the template -[override] -build_flags = - -[pins] -vspi32 = - -D TFT_MISO=19 - -D TFT_MOSI=23 - -D TFT_SCLK=18 -hspi32 = - -D TFT_MISO=12 - -D TFT_MOSI=13 - -D TFT_SCLK=14 - -[lcd] -TFT_WIDTH = 240 -TFT_HEIGHT = 320 -TFT_ROTATION = 0 ; 0=0, 1=90, 2=180 or 3=270 degree -; Rotation params: -; 0 - 0 deg -; 1 - 90 deg anti-clockwise (from 0 deg) -; 2 - 180 deg anti-clockwise -; 3 - 270 deg anti-clockwise -; 4 - mirror content, and rotate 180 deg anti-clockwise -; 5 - mirror content, and rotate 270 deg anti-clockwise -; 6 - mirror content, and rotate 0 deg anti-clockwise -; 7 - mirror content, and rotate 90 deg anti-clockwise +;*************************************************** +; Common environment settings +;*************************************************** [env] framework = arduino upload_speed = 921600 ; -- Shared library dependencies in all environments lib_deps = - ;lvgl@7.0.0 - Not in library yet + ;lvgl@7.0.0 ; Not in library yet TFT_eSPI@^2.1.7 ; Tft SPI drivers ;TFT_eSPI@^1.4.20 ; Tft SPI drivers PubSubClient@^2.7.0 ; MQTT client @@ -74,8 +51,7 @@ lib_deps = AceButton@^1.4.0 ;AsyncTCP ;https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip - ;https://github.com/me-no-dev/ESPAsyncTCP/archive/master.zip - + ;https://github.com/me-no-dev/ESPAsyncTCP/archive/master.zip ; -- littlevgl config options ---------------------- @@ -90,17 +66,76 @@ build_flags = -I include ; include lv_conf.h and hasp_conf.h ${override.build_flags} +; -- Platform specific build flags [flags] esp8266_flags= + ${env.build_flags} -D HTTP_UPLOAD_BUFLEN=512 ; lower http upload buffer -D MQTT_MAX_PACKET_SIZE=768 ; longer PubSubClient messages - esp32_flags= + ${env.build_flags} -D HTTP_UPLOAD_BUFLEN=1024 ; lower http upload buffer -D MQTT_MAX_PACKET_SIZE=2048 ; longer PubSubClient messages + +; -- By default there are no ${override.build_flags} set +; -- to use it, copy platformio_override.ini from the template +[override] +build_flags = + ;*************************************************** -; ESP32 build +; Hardware options +;*************************************************** +; -- The SPI Hardware Busses available to use +[pins] +vspi32 = + -D TFT_MISO=19 + -D TFT_MOSI=23 + -D TFT_SCLK=18 +hspi32 = + -D TFT_MISO=12 + -D TFT_MOSI=13 + -D TFT_SCLK=14 + +; -- Configuration parameters for standard displays +[lcd] +tft_rotation = 0 ; default rotation +tft_width = 240 ; default width +tft_height = 320 ; default height +lolin24 = + -D ILI9341_DRIVER=1 + -D TFT_WIDTH=240 + -D TFT_HEIGHT=320 + -D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree + -D SPI_FREQUENCY=40000000 + -D SPI_TOUCH_FREQUENCY=2500000 + -D SPI_READ_FREQUENCY=20000000 + -D USER_SETUP_LOADED=1 + -D SUPPORT_TRANSACTIONS +raspberrypi = + -D RPI_DISPLAY_TYPE=1 + -D ST7796_DRIVER=1 + -D TFT_WIDTH=320 + -D TFT_HEIGHT=480 + -D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree + -D SPI_FREQUENCY=80000000 + -D SPI_TOUCH_FREQUENCY=2500000 + -D USER_SETUP_LOADED=1 + -D SUPPORT_TRANSACTIONS + +; Rotation params: +; 0 - 0 deg +; 1 - 90 deg anti-clockwise (from 0 deg) +; 2 - 180 deg anti-clockwise +; 3 - 270 deg anti-clockwise +; 4 - mirror content, and rotate 180 deg anti-clockwise +; 5 - mirror content, and rotate 270 deg anti-clockwise +; 6 - mirror content, and rotate 0 deg anti-clockwise +; 7 - mirror content, and rotate 90 deg anti-clockwise + + +;*************************************************** +; Generic ESP32 build ;*************************************************** [env:esp32dev] platform = espressif32 @@ -112,23 +147,15 @@ debug_tool = esp-prog debug_init_break = tbreak setup build_flags = - ${env.build_flags} ${flags.esp32_flags} ; -- TFT_eSPI build options ------------------------ - -D TFT_ROTATION=${lcd.TFT_ROTATION} - -D TFT_WIDTH=${lcd.TFT_WIDTH} - -D TFT_HEIGHT=${lcd.TFT_HEIGHT} - -D USER_SETUP_LOADED=1 - -D ILI9341_DRIVER=1 + ${lcd.lolin24} ${pins.vspi32} -D TFT_CS=5 -D TFT_BCKL=21 -D TFT_DC=2 -D TFT_RST=4 -D TOUCH_CS=21 - -D SPI_FREQUENCY=40000000 - -D SPI_TOUCH_FREQUENCY=2500000 - -D SPI_READ_FREQUENCY=20000000 ; -- Debugging options ----------------------------- ; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG @@ -152,22 +179,15 @@ debug_tool = esp-prog debug_init_break = tbreak setup build_flags = - ${env.build_flags} ${flags.esp32_flags} ; -- TFT_eSPI build options ------------------------ - -D TFT_ROTATION=${lcd.TFT_ROTATION} - -D USER_SETUP_LOADED=1 - -D RPI_DISPLAY_TYPE=1 - -D ST7796_DRIVER=1 - ${pins.vspi32} + ${lcd.raspberrypi} + ${pins.vspi32} -D TFT_CS=5 -D TFT_DC=4 -D TFT_RST=-1 -D TOUCH_CS=22 - -D SPI_FREQUENCY=80000000 - -D SPI_TOUCH_FREQUENCY=2500000 - -D TFT_WIDTH=320 - -D TFT_HEIGHT=480 + ; -- Debugging options ----------------------------- ; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG @@ -187,7 +207,6 @@ monitor_port = COM8 ; Change to the correct port monitor_speed = 115200 build_flags = - ${env.build_flags} ${flags.esp32_flags} ; -- TFT_eSPI build options ------------------------ -D TFT_ROTATION=${lcd.TFT_ROTATION} @@ -237,7 +256,6 @@ monitor_port = COM6 ; Change to the correct port monitor_speed = 115200 board_build.partitions = default.csv build_flags = - ${env.build_flags} ${flags.esp32_flags} ; -- TFT_eSPI build options ------------------------ -D TFT_ROTATION=${lcd.TFT_ROTATION} @@ -269,31 +287,22 @@ monitor_port = COM14 ; Change to the correct port monitor_speed = 115200 board_build.partitions = default.csv build_flags = - ${env.build_flags} ${flags.esp32_flags} ; -- TFT_eSPI build options ------------------------ - -D TFT_ROTATION=${lcd.TFT_ROTATION} - -D TFT_WIDTH=${lcd.TFT_WIDTH} - -D TFT_HEIGHT=${lcd.TFT_HEIGHT} - -D USER_SETUP_LOADED - -D ILI9341_DRIVER + ${lcd.lolin24} ${pins.vspi32} - ;-D TFT_DC=5 - ;-D TFT_CS=26 + -D TFT_DC=5 + -D TFT_CS=26 -D TFT_BCKL=21 - ;-D TFT_RST=-1 ;RST + -D TFT_RST=-1 ;RST -D TOUCH_CS=17 ;(can also be 22 or 16) - -D SPI_FREQUENCY=40000000 - -D SPI_TOUCH_FREQUENCY=2500000 - -D SPI_READ_FREQUENCY=20000000 - -D SUPPORT_TRANSACTIONS ;*************************************************** ; D1 Mini ESP8266 with Lolin TFT 2.4" ;*************************************************** [env:d1mini-lolintft24] -platform = espressif8266@2.3.2 +platform = espressif8266 ;@2.3.2 board = d1_mini upload_port = COM13 ; Change to the correct port ;upload_protocol = espota ; Use ArduinoOTA after flashing over serial @@ -305,26 +314,19 @@ board_build.flash_mode = dout board_build.ldscript = eagle.flash.4m2m.ld ; 2Mb Spiffs board_build.f_cpu = 160000000L ; set frequency to 160MHz build_flags = - ${env.build_flags} ${flags.esp8266_flags} ; -- TFT_eSPI build options ------------------------ - -D TFT_ROTATION=${lcd.TFT_ROTATION} - -D TFT_WIDTH=${lcd.TFT_WIDTH} - -D TFT_HEIGHT=${lcd.TFT_HEIGHT} - -D USER_SETUP_LOADED - -D ILI9341_DRIVER - -D TFT_MISO=12 ;D6 - -D TFT_MOSI=13 ;D7 - -D TFT_SCLK=14 ;D5 + ${lcd.lolin24} + + ;-D TFT_MISO=12 ;D6 + ;-D TFT_MOSI=13 ;D7 + ;-D TFT_SCLK=14 ;D5 -D TFT_DC=15 ;D8 -D TFT_CS=16 ;D0 -D TFT_BCKL=2 ;D4 (can also be D1 or D2) -D TOUCH_CS=0 ;D3 (can also be D1 or D2) -D TFT_RST=-1 ;RST - -D SPI_FREQUENCY=40000000 - -D SPI_TOUCH_FREQUENCY=2500000 - -D SPI_READ_FREQUENCY=20000000 - -D SUPPORT_TRANSACTIONS + ;*************************************************** ; ESP-12 build @@ -340,7 +342,6 @@ board_build.flash_mode = dout board_build.ldscript = eagle.flash.4m2m.ld ; 2Mb Spiffs board_build.f_cpu = 160000000L ; set frequency to 160MHz build_flags = - ${env.build_flags} ${flags.esp8266_flags} ; -- TFT_eSPI build options ------------------------ -D TFT_ROTATION=${lcd.TFT_ROTATION} @@ -388,7 +389,7 @@ build_flags = -D TFT_SCLK=14 ;D5 -D TFT_CS=15 ;D8 -D TFT_DC=0 ;D3 - -D TFT_BCKL=2 ;D4 (can also be D1 or D2) + -D TFT_BCKL=2 ;D4 -D TOUCH_CS=-1 ;NC -D TFT_RST=2 ;D4 -D SPI_FREQUENCY=27000000