display support reworked, prepared for TFT/LCD

This commit is contained in:
Klaus K Wilting committed 2020-03-29 12:10:42 +02:00
1 parent b9481f459d
commit 4029d545a2
30 files changed
+335 -206

No files matched your search

+5 -5
View File
@@ -13,7 +13,7 @@
//#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
#define HAS_DISPLAY 1
//#define DISPLAY_FLIP 1 // use if display is rotated
//#define MY_DISPLAY_FLIP 1 // use if display is rotated
#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
#define BAT_VOLTAGE_DIVIDER ((82.0+220.0)/82.0) // 82k + 220k 1%
//#define BAT_MEASURE_EN EXT_POWER_SW // Turn power on for measurement
@@ -27,14 +27,14 @@
//#define HAS_BUTTON (0) // on board button -> don't use, is same as RTC_INT!
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA SDA
#define MY_OLED_SCL SCL
#define MY_OLED_RST NOT_A_PIN
#define MY_DISPLAY_SDA SDA
#define MY_DISPLAY_SCL SCL
#define MY_DISPLAY_RST NOT_A_PIN
// Settings for on board DS3231 RTC chip
// note: to use RTC_INT, capacitor 100nF next to red LED must be removed to sharpen interrupt signal slope
// and setting EXT_POWER_ON is needed (this is done in main.cpp)
#define HAS_RTC MY_OLED_SDA, MY_OLED_SCL // SDA, SCL
#define HAS_RTC MY_DISPLAY_SDA, MY_DISPLAY_SCL // SDA, SCL
#define RTC_INT GPIO_NUM_0 //
// Settings for IF482 interface
+5 -5
View File
@@ -63,7 +63,7 @@
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
#define HAS_DISPLAY 1
//#define DISPLAY_FLIP 1 // use if display is rotated
//#define MY_DISPLAY_FLIP 1 // use if display is rotated
#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board
@@ -77,12 +77,12 @@
#define GPS_INT GPIO_NUM_13 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO13
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA (4)
#define MY_OLED_SCL (15)
#define MY_OLED_RST (16)
#define MY_DISPLAY_SDA (4)
#define MY_DISPLAY_SCL (15)
#define MY_DISPLAY_RST (16)
// Settings for on board DS3231 RTC chip
#define HAS_RTC MY_OLED_SDA, MY_OLED_SCL // SDA, SCL
#define HAS_RTC MY_DISPLAY_SDA, MY_DISPLAY_SCL // SDA, SCL
#define RTC_INT GPIO_NUM_34 // timepulse with accuracy +/- 2*e-6 [microseconds] = 0,1728sec / day
// Settings for IF482 interface
+3 -3
View File
@@ -21,9 +21,9 @@
#define HAS_BUTTON KEY_BUILTIN // button "PROG" on board
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA SDA_OLED
#define MY_OLED_SCL SCL_OLED
#define MY_OLED_RST RST_OLED
#define MY_DISPLAY_SDA SDA_OLED
#define MY_DISPLAY_SCL SCL_OLED
#define MY_DISPLAY_RST RST_OLED
// Pins for LORA chip SPI interface come from board file, we need some
// additional definitions for LMIC
+3 -3
View File
@@ -34,9 +34,9 @@
//#define EXT_POWER_OFF 1
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA SDA_OLED
#define MY_OLED_SCL SCL_OLED
#define MY_OLED_RST RST_OLED
#define MY_DISPLAY_SDA SDA_OLED
#define MY_DISPLAY_SCL SCL_OLED
#define MY_DISPLAY_RST RST_OLED
// Pins for LORA chip SPI interface come from board file, we need some
// additional definitions for LMIC
+3
View File
@@ -12,6 +12,9 @@
#define HAS_LED LED_BUILTIN // on board LED on GPIO5
#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW
#define MY_SDA SDA
#define MY_SCL SCL
// disable brownout detection (avoid unexpected reset on some boards)
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
+4 -4
View File
@@ -14,7 +14,7 @@
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
#define HAS_DISPLAY 1 // OLED-Display on board
//#define DISPLAY_FLIP 1 // uncomment this for rotated display
//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display
#define HAS_LED 22 // ESP32 GPIO12 (pin22) On Board LED
#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW
#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_13) // ESP32 GPIO13 (pin13) On Board Shield WS2812B RGB LED
@@ -35,9 +35,9 @@
#define LORA_IO2 (4)
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA (12)
#define MY_OLED_SCL (14)
#define MY_OLED_RST NOT_A_PIN
#define MY_DISPLAY_SDA (12)
#define MY_DISPLAY_SCL (14)
#define MY_DISPLAY_RST NOT_A_PIN
// I2C config for Microchip 24AA02E64 DEVEUI unique address
#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64
+4 -4
View File
@@ -14,7 +14,7 @@
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
#define HAS_DISPLAY 1 // OLED-Display on board
//#define DISPLAY_FLIP 1 // uncomment this for rotated display
//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display
#define HAS_LED NOT_A_PIN // Led os on same pin as Lora SS pin, to avoid problems, we don't use it
#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW
// Anyway shield is on over the LoLin32 board, so we won't be able to see this LED
@@ -36,9 +36,9 @@
#define LORA_IO2 (4)
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA SDA
#define MY_OLED_SCL SCL
#define MY_OLED_RST NOT_A_PIN
#define MY_DISPLAY_SDA SDA
#define MY_DISPLAY_SCL SCL
#define MY_DISPLAY_RST NOT_A_PIN
// I2C config for Microchip 24AA02E64 DEVEUI unique address
#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64
+9 -9
View File
@@ -32,8 +32,8 @@
#define BOARD_HAS_PSRAM // use if board has external PSRAM
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
//#define HAS_DISPLAY 1
//#define DISPLAY_FLIP 1 // use if display is rotated
//#define HAS_DISPLAY 2 // TFT-LCD, support work in progess, not ready yet
//#define MY_DISPLAY_FLIP 1 // use if display is rotated
//#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board
@@ -46,12 +46,12 @@
#define GPS_INT GPIO_NUM_35 // 30ns accurary timepulse, to be external wired on pcb: shorten R12!
// Pins for interface of LC Display
#define MY_OLED_CS GPIO_NUM_14
#define MY_OLED_DC GPIO_NUM_27
#define MY_OLED_CLK GPIO_NUM_18
#define MY_OLED_RST GPIO_NUM_33
#define MY_OLED_BL GPIO_NUM_32
#define MY_OLED_MOSI GPIO_NUM_23
#define MY_OLED_MISO GPIO_NUM_19
#define MY_DISPLAY_CS GPIO_NUM_14
#define MY_DISPLAY_DC GPIO_NUM_27
#define MY_DISPLAY_CLK GPIO_NUM_18
#define MY_DISPLAY_RST GPIO_NUM_33
#define MY_DISPLAY_BL GPIO_NUM_32
#define MY_DISPLAY_MOSI GPIO_NUM_23
#define MY_DISPLAY_MISO GPIO_NUM_19
#endif
+13 -11
View File
@@ -32,9 +32,8 @@
#define BOARD_HAS_PSRAM // use if board has external PSRAM
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
//#define HAS_DISPLAY 1
#define HAS_TFT 1
//#define DISPLAY_FLIP 1 // use if display is rotated
//#define HAS_DISPLAY 2 // TFT-LCD, support work in progess, not ready yet
//#define MY_DISPLAY_FLIP 1 // use if display is rotated
//#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board
@@ -47,13 +46,16 @@
#define GPS_SERIAL 9600, SERIAL_8N1, RXD2, TXD2 // UBlox NEO 6M RX, TX
// #define GPS_INT GPIO_NUM_35 // 30ns accurary timepulse, to be external wired on pcb: shorten R12!
// Pins for interface of LC Display
#define MY_OLED_CS GPIO_NUM_14
#define MY_OLED_DC GPIO_NUM_27
#define MY_OLED_CLK GPIO_NUM_18
#define MY_OLED_RST GPIO_NUM_33
#define MY_OLED_BL GPIO_NUM_32
#define MY_OLED_MOSI GPIO_NUM_23
#define MY_OLED_MISO GPIO_NUM_19
// Display Settings
#define MY_DISPLAY_WIDTH 320
#define MY_DISPLAY_HEIGHT 240
#define MY_DISPLAY_TYPE LCD_ILI9341
#define MY_DISPLAY_CS GPIO_NUM_14 // Display CS pin
#define MY_DISPLAY_CLK GPIO_NUM_18 // SPI CLOCK pin
#define MY_DISPLAY_DC GPIO_NUM_27 // Display command/data pin
#define MY_DISPLAY_MOSI GPIO_NUM_23 // SPI MOSI
#define MY_DISPLAY_MISO GPIO_NUM_19 // SPI MISO
#define MY_DISPLAY_BL GPIO_NUM_32 // backlight control
#define MY_DISPLAY_RST GPIO_NUM_33 // RESET control
#endif
+4 -4
View File
@@ -44,9 +44,9 @@
// Pins for I2C interface of OLED Display
#define HAS_DISPLAY 1
//#define DISPLAY_FLIP 1 // uncomment this for rotated display
#define MY_OLED_SDA (23)
#define MY_OLED_SCL (22)
#define MY_OLED_RST NOT_A_PIN
//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display
#define MY_DISPLAY_SDA (23)
#define MY_DISPLAY_SCL (22)
#define MY_DISPLAY_RST NOT_A_PIN
#endif
+4 -4
View File
@@ -34,10 +34,10 @@
// display (if connected)
#define HAS_DISPLAY 1
#define MY_OLED_SDA SDA
#define MY_OLED_SCL SCL
#define MY_OLED_RST NOT_A_PIN
//#define DISPLAY_FLIP 1 // use if display is rotated
#define MY_DISPLAY_SDA SDA
#define MY_DISPLAY_SCL SCL
#define MY_DISPLAY_RST NOT_A_PIN
//#define MY_DISPLAY_FLIP 1 // use if display is rotated
// user defined sensors (if connected)
//#define HAS_SENSORS 1 // comment out if device has user defined sensors
+4 -4
View File
@@ -21,10 +21,10 @@ Reset -> reset device
*/
#define HAS_DISPLAY 1
#define MY_OLED_SDA SDA
#define MY_OLED_SCL SCL
#define MY_OLED_RST NOT_A_PIN
//#define DISPLAY_FLIP 1 // use if display is rotated
#define MY_DISPLAY_SDA SDA
#define MY_DISPLAY_SCL SCL
#define MY_DISPLAY_RST NOT_A_PIN
//#define MY_DISPLAY_FLIP 1 // use if display is rotated
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
+4 -4
View File
@@ -21,12 +21,12 @@
#define HAS_BUTTON GPIO_NUM_36 // on board button (next to reset)
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA (21)
#define MY_OLED_SCL (22)
#define MY_OLED_RST NOT_A_PIN
#define MY_DISPLAY_SDA (21)
#define MY_DISPLAY_SCL (22)
#define MY_DISPLAY_RST NOT_A_PIN
// Settings for on board DS3231 RTC chip
#define HAS_RTC MY_OLED_SDA, MY_OLED_SCL // SDA, SCL
#define HAS_RTC MY_DISPLAY_SDA, MY_DISPLAY_SCL // SDA, SCL
#define RTC_INT GPIO_NUM_34 // timepulse with accuracy +/- 2*e-6 [microseconds] = 0,1728sec / day
// Settings for IF482 interface
+5 -5
View File
@@ -13,7 +13,7 @@
#define CFG_sx1276_radio 1
#define HAS_DISPLAY 1 // OLED-Display on board
//#define DISPLAY_FLIP 1 // uncomment this for rotated display
//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display
#define HAS_LED LED_BUILTIN
#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW
#define HAS_BUTTON KEY_BUILTIN
@@ -27,12 +27,12 @@
#define SDCARD_SCLK (14)
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA (4)
#define MY_OLED_SCL (15)
#define MY_OLED_RST (16)
#define MY_DISPLAY_SDA (4)
#define MY_DISPLAY_SCL (15)
#define MY_DISPLAY_RST (16)
// This board reports back the wrong I2C address, so we overwrite it here
#define MY_OLED_ADDR 0x3C
#define MY_DISPLAY_ADDR 0x3C
// Pins for LORA chip SPI interface come from board file, we need some
// additional definitions for LMIC
+4 -4
View File
@@ -13,7 +13,7 @@
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
#define HAS_DISPLAY 1
//#define DISPLAY_FLIP 1 // uncomment this for rotated display
//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display
#define HAS_LED NOT_A_PIN // on-board LED is wired to SCL (used by display) therefore totally useless
// disable brownout detection (needed on TTGOv2 for battery powered operation)
@@ -28,9 +28,9 @@
#define SDCARD_SCLK (14)
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA (21)
#define MY_OLED_SCL (22)
#define MY_OLED_RST NOT_A_PIN
#define MY_DISPLAY_SDA (21)
#define MY_DISPLAY_SCL (22)
#define MY_DISPLAY_RST NOT_A_PIN
// Pins for LORA chip SPI interface come from board file, we need some
// additional definitions for LMIC
+4 -4
View File
@@ -28,14 +28,14 @@
#define SDCARD_SCLK (14)
#define HAS_DISPLAY 1
#define DISPLAY_FLIP 1 // rotated display
#define MY_DISPLAY_FLIP 1 // rotated display
//#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board
// Pins for I2C interface of OLED Display
#define MY_OLED_SDA (21)
#define MY_OLED_SCL (22)
#define MY_OLED_RST NOT_A_PIN
#define MY_DISPLAY_SDA (21)
#define MY_DISPLAY_SCL (22)
#define MY_DISPLAY_RST NOT_A_PIN
// Pins for LORA chip SPI interface, reset line and interrupt lines
#define LORA_SCK (5)
+4 -4
View File
@@ -10,10 +10,10 @@
#define HAS_LED NOT_A_PIN // no LED
#define HAS_DISPLAY 1
#define MY_OLED_SDA (5)
#define MY_OLED_SCL (4)
#define MY_OLED_RST NOT_A_PIN
#define DISPLAY_FLIP 1 // use if display is rotated
#define MY_DISPLAY_SDA (5)
#define MY_DISPLAY_SCL (4)
#define MY_DISPLAY_RST NOT_A_PIN
#define MY_DISPLAY_FLIP 1 // use if display is rotated
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature