mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 14:42:05 +00:00
Merge the three redundant backlight enables into the single TFT_BL flag
This commit is contained in:
parent
7fb9b094d5
commit
3ae8aadaf0
@ -21,10 +21,6 @@ extern SX1509 gpioExtender;
|
|||||||
#if defined(ST7735S)
|
#if defined(ST7735S)
|
||||||
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
||||||
|
|
||||||
#if defined(ST7735_BACKLIGHT_EN) && !defined(TFT_BL)
|
|
||||||
#define TFT_BL ST7735_BACKLIGHT_EN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TFT_INVERT
|
#ifndef TFT_INVERT
|
||||||
#define TFT_INVERT true
|
#define TFT_INVERT true
|
||||||
#endif
|
#endif
|
||||||
@ -91,11 +87,12 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_panel_instance.config(cfg);
|
_panel_instance.config(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TFT_BL
|
||||||
// Set the backlight control
|
// Set the backlight control
|
||||||
{
|
{
|
||||||
auto cfg = _light_instance.config(); // Gets a structure for backlight settings.
|
auto cfg = _light_instance.config(); // Gets a structure for backlight settings.
|
||||||
|
|
||||||
cfg.pin_bl = ST7735_BL; // Pin number to which the backlight is connected
|
cfg.pin_bl = TFT_BL; // Pin number to which the backlight is connected
|
||||||
cfg.invert = true; // true to invert the brightness of the backlight
|
cfg.invert = true; // true to invert the brightness of the backlight
|
||||||
// cfg.freq = 44100; // PWM frequency of backlight
|
// cfg.freq = 44100; // PWM frequency of backlight
|
||||||
// cfg.pwm_channel = 1; // PWM channel number to use
|
// cfg.pwm_channel = 1; // PWM channel number to use
|
||||||
@ -103,6 +100,7 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_light_instance.config(cfg);
|
_light_instance.config(cfg);
|
||||||
_panel_instance.setLight(&_light_instance); // Set the backlight on the panel.
|
_panel_instance.setLight(&_light_instance); // Set the backlight on the panel.
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
setPanel(&_panel_instance);
|
setPanel(&_panel_instance);
|
||||||
}
|
}
|
||||||
@ -575,14 +573,12 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||||||
display(true);
|
display(true);
|
||||||
if (settingsMap[displayBacklight] > 0)
|
if (settingsMap[displayBacklight] > 0)
|
||||||
digitalWrite(settingsMap[displayBacklight], TFT_BACKLIGHT_ON);
|
digitalWrite(settingsMap[displayBacklight], TFT_BACKLIGHT_ON);
|
||||||
#elif defined(ST7735_BL)
|
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||||
pinMode(ST7735_BL, OUTPUT);
|
pinMode(TFT_BL, OUTPUT);
|
||||||
digitalWrite(ST7735_BL, TFT_BACKLIGHT_ON);
|
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
||||||
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
||||||
tft->wakeup();
|
tft->wakeup();
|
||||||
tft->powerSaveOff();
|
tft->powerSaveOff();
|
||||||
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
|
||||||
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VTFT_CTRL_V03
|
#ifdef VTFT_CTRL_V03
|
||||||
@ -606,14 +602,12 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||||||
tft->clear();
|
tft->clear();
|
||||||
if (settingsMap[displayBacklight] > 0)
|
if (settingsMap[displayBacklight] > 0)
|
||||||
digitalWrite(settingsMap[displayBacklight], !TFT_BACKLIGHT_ON);
|
digitalWrite(settingsMap[displayBacklight], !TFT_BACKLIGHT_ON);
|
||||||
#elif defined(ST7735_BL)
|
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||||
pinMode(ST7735_BL, OUTPUT);
|
pinMode(TFT_BL, OUTPUT);
|
||||||
digitalWrite(ST7735_BL, !TFT_BACKLIGHT_ON);
|
digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON);
|
||||||
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
||||||
tft->sleep();
|
tft->sleep();
|
||||||
tft->powerSaveOn();
|
tft->powerSaveOn();
|
||||||
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
|
||||||
digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VTFT_CTRL_V03
|
#ifdef VTFT_CTRL_V03
|
||||||
@ -710,10 +704,6 @@ bool TFTDisplay::connect()
|
|||||||
LOG_INFO("Power to TFT Backlight\n");
|
LOG_INFO("Power to TFT Backlight\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ST7735_BL
|
|
||||||
pinMode(ST7735_BL, OUTPUT);
|
|
||||||
digitalWrite(ST7735_BL, TFT_BACKLIGHT_ON);
|
|
||||||
#endif
|
|
||||||
#ifdef UNPHONE
|
#ifdef UNPHONE
|
||||||
unphone.backlight(true); // using unPhone library
|
unphone.backlight(true); // using unPhone library
|
||||||
LOG_INFO("Power to TFT Backlight\n");
|
LOG_INFO("Power to TFT Backlight\n");
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
#define ST7735_RESET 15
|
#define ST7735_RESET 15
|
||||||
#define ST7735_MISO -1
|
#define ST7735_MISO -1
|
||||||
#define ST7735_BUSY -1
|
#define ST7735_BUSY -1
|
||||||
#define ST7735_BL 32
|
#define TFT_BL 32
|
||||||
#define ST7735_SPI_HOST HSPI_HOST // SPI2_HOST for S3, auto may work too
|
#define ST7735_SPI_HOST HSPI_HOST // SPI2_HOST for S3, auto may work too
|
||||||
#define SPI_FREQUENCY 40000000
|
#define SPI_FREQUENCY 40000000
|
||||||
#define SPI_READ_FREQUENCY 16000000
|
#define SPI_READ_FREQUENCY 16000000
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#define ST7735_RESET 39
|
#define ST7735_RESET 39
|
||||||
#define ST7735_MISO -1
|
#define ST7735_MISO -1
|
||||||
#define ST7735_BUSY -1
|
#define ST7735_BUSY -1
|
||||||
#define ST7735_BL 21 /* V1.1 PCB marking */
|
#define TFT_BL 21 /* V1.1 PCB marking */
|
||||||
#define ST7735_SPI_HOST SPI3_HOST
|
#define ST7735_SPI_HOST SPI3_HOST
|
||||||
#define SPI_FREQUENCY 40000000
|
#define SPI_FREQUENCY 40000000
|
||||||
#define SPI_READ_FREQUENCY 16000000
|
#define SPI_READ_FREQUENCY 16000000
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#define ST7735_RESET 39
|
#define ST7735_RESET 39
|
||||||
#define ST7735_MISO -1
|
#define ST7735_MISO -1
|
||||||
#define ST7735_BUSY -1
|
#define ST7735_BUSY -1
|
||||||
#define ST7735_BL 45
|
#define TFT_BL 45
|
||||||
#define ST7735_SPI_HOST SPI3_HOST
|
#define ST7735_SPI_HOST SPI3_HOST
|
||||||
#define SPI_FREQUENCY 40000000
|
#define SPI_FREQUENCY 40000000
|
||||||
#define SPI_READ_FREQUENCY 16000000
|
#define SPI_READ_FREQUENCY 16000000
|
||||||
|
@ -144,7 +144,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
|
|
||||||
#define ST7735_RESET (11) // Output
|
#define ST7735_RESET (11) // Output
|
||||||
#define ST7735_CS (12)
|
#define ST7735_CS (12)
|
||||||
#define ST7735_BACKLIGHT_EN (13)
|
#define TFT_BL (13)
|
||||||
#define ST7735_RS (9)
|
#define ST7735_RS (9)
|
||||||
|
|
||||||
// #define LORA_DISABLE_SENDING // The board can brownout during lora TX if you don't have a battery connected. Disable sending
|
// #define LORA_DISABLE_SENDING // The board can brownout during lora TX if you don't have a battery connected. Disable sending
|
||||||
|
@ -166,7 +166,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
// ST7565 SPI
|
// ST7565 SPI
|
||||||
#define ST7735_RESET (11) // Output
|
#define ST7735_RESET (11) // Output
|
||||||
#define ST7735_CS (12)
|
#define ST7735_CS (12)
|
||||||
#define ST7735_BACKLIGHT_EN (13)
|
#define TFT_BL (13)
|
||||||
#define ST7735_RS (9)
|
#define ST7735_RS (9)
|
||||||
#define ST7735_SDA (39) // actually spi MOSI
|
#define ST7735_SDA (39) // actually spi MOSI
|
||||||
#define ST7735_SCK (37) // actually spi clk
|
#define ST7735_SCK (37) // actually spi clk
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#define ST7735_RESET 39
|
#define ST7735_RESET 39
|
||||||
#define ST7735_MISO -1
|
#define ST7735_MISO -1
|
||||||
#define ST7735_BUSY -1
|
#define ST7735_BUSY -1
|
||||||
#define ST7735_BL 21 /* V1.1 PCB marking */
|
#define TFT_BL 21 /* V1.1 PCB marking */
|
||||||
#define ST7735_SPI_HOST SPI3_HOST
|
#define ST7735_SPI_HOST SPI3_HOST
|
||||||
#define SPI_FREQUENCY 40000000
|
#define SPI_FREQUENCY 40000000
|
||||||
#define SPI_READ_FREQUENCY 16000000
|
#define SPI_READ_FREQUENCY 16000000
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#define ST7789_CS 38
|
#define ST7789_CS 38
|
||||||
#define ST7789_RS 40
|
#define ST7789_RS 40
|
||||||
#define ST7789_BL 21
|
#define ST7789_BL 21
|
||||||
// P#define ST7735_BL 21 /* V1.1 PCB marking */
|
// P#define TFT_BL 21 /* V1.1 PCB marking */
|
||||||
|
|
||||||
#define ST7789_RESET -1
|
#define ST7789_RESET -1
|
||||||
#define ST7789_MISO -1
|
#define ST7789_MISO -1
|
||||||
@ -41,7 +41,7 @@
|
|||||||
// #define ST7735_RESET 39
|
// #define ST7735_RESET 39
|
||||||
// #define ST7735_MISO -1
|
// #define ST7735_MISO -1
|
||||||
// #define ST7735_BUSY -1
|
// #define ST7735_BUSY -1
|
||||||
#define ST7735_BL 21 /* V1.1 PCB marking */
|
#define TFT_BL 21 /* V1.1 PCB marking */
|
||||||
// #define ST7735_SPI_HOST SPI3_HOST
|
// #define ST7735_SPI_HOST SPI3_HOST
|
||||||
// #define SPI_FREQUENCY 40000000
|
// #define SPI_FREQUENCY 40000000
|
||||||
// #define SPI_READ_FREQUENCY 16000000
|
// #define SPI_READ_FREQUENCY 16000000
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// #define ST7735_RESET 39
|
// #define ST7735_RESET 39
|
||||||
// #define ST7735_MISO -1
|
// #define ST7735_MISO -1
|
||||||
// #define ST7735_BUSY -1
|
// #define ST7735_BUSY -1
|
||||||
#define ST7735_BL 21 /* V1.1 PCB marking */
|
#define TFT_BL 21 /* V1.1 PCB marking */
|
||||||
// #define ST7735_SPI_HOST SPI3_HOST
|
// #define ST7735_SPI_HOST SPI3_HOST
|
||||||
// #define SPI_FREQUENCY 40000000
|
// #define SPI_FREQUENCY 40000000
|
||||||
// #define SPI_READ_FREQUENCY 16000000
|
// #define SPI_READ_FREQUENCY 16000000
|
||||||
|
Loading…
Reference in New Issue
Block a user