kopia lustrzana https://github.com/meshtastic/firmware
Merge the three redundant backlight enables into the single TFT_BL flag
rodzic
7fb9b094d5
commit
3ae8aadaf0
|
@ -21,10 +21,6 @@ extern SX1509 gpioExtender;
|
|||
#if defined(ST7735S)
|
||||
#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
|
||||
#define TFT_INVERT true
|
||||
#endif
|
||||
|
@ -91,18 +87,20 @@ class LGFX : public lgfx::LGFX_Device
|
|||
_panel_instance.config(cfg);
|
||||
}
|
||||
|
||||
#ifdef TFT_BL
|
||||
// Set the backlight control
|
||||
{
|
||||
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.invert = true; // true to invert the brightness of the backlight
|
||||
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.freq = 44100; // PWM frequency of backlight
|
||||
// cfg.pwm_channel = 1; // PWM channel number to use
|
||||
|
||||
_light_instance.config(cfg);
|
||||
_panel_instance.setLight(&_light_instance); // Set the backlight on the panel.
|
||||
}
|
||||
#endif
|
||||
|
||||
setPanel(&_panel_instance);
|
||||
}
|
||||
|
@ -575,14 +573,12 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||
display(true);
|
||||
if (settingsMap[displayBacklight] > 0)
|
||||
digitalWrite(settingsMap[displayBacklight], TFT_BACKLIGHT_ON);
|
||||
#elif defined(ST7735_BL)
|
||||
pinMode(ST7735_BL, OUTPUT);
|
||||
digitalWrite(ST7735_BL, TFT_BACKLIGHT_ON);
|
||||
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
||||
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
||||
tft->wakeup();
|
||||
tft->powerSaveOff();
|
||||
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
||||
#endif
|
||||
|
||||
#ifdef VTFT_CTRL_V03
|
||||
|
@ -606,14 +602,12 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||
tft->clear();
|
||||
if (settingsMap[displayBacklight] > 0)
|
||||
digitalWrite(settingsMap[displayBacklight], !TFT_BACKLIGHT_ON);
|
||||
#elif defined(ST7735_BL)
|
||||
pinMode(ST7735_BL, OUTPUT);
|
||||
digitalWrite(ST7735_BL, !TFT_BACKLIGHT_ON);
|
||||
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON);
|
||||
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
||||
tft->sleep();
|
||||
tft->powerSaveOn();
|
||||
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||
digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON);
|
||||
#endif
|
||||
|
||||
#ifdef VTFT_CTRL_V03
|
||||
|
@ -710,10 +704,6 @@ bool TFTDisplay::connect()
|
|||
LOG_INFO("Power to TFT Backlight\n");
|
||||
#endif
|
||||
|
||||
#ifdef ST7735_BL
|
||||
pinMode(ST7735_BL, OUTPUT);
|
||||
digitalWrite(ST7735_BL, TFT_BACKLIGHT_ON);
|
||||
#endif
|
||||
#ifdef UNPHONE
|
||||
unphone.backlight(true); // using unPhone library
|
||||
LOG_INFO("Power to TFT Backlight\n");
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define ST7735_RESET 15
|
||||
#define ST7735_MISO -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 SPI_FREQUENCY 40000000
|
||||
#define SPI_READ_FREQUENCY 16000000
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define ST7735_RESET 39
|
||||
#define ST7735_MISO -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 SPI_FREQUENCY 40000000
|
||||
#define SPI_READ_FREQUENCY 16000000
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define ST7735_RESET 39
|
||||
#define ST7735_MISO -1
|
||||
#define ST7735_BUSY -1
|
||||
#define ST7735_BL 45
|
||||
#define TFT_BL 45
|
||||
#define ST7735_SPI_HOST SPI3_HOST
|
||||
#define SPI_FREQUENCY 40000000
|
||||
#define SPI_READ_FREQUENCY 16000000
|
||||
|
|
|
@ -144,7 +144,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||
|
||||
#define ST7735_RESET (11) // Output
|
||||
#define ST7735_CS (12)
|
||||
#define ST7735_BACKLIGHT_EN (13)
|
||||
#define TFT_BL (13)
|
||||
#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
|
||||
|
@ -158,4 +158,4 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -166,7 +166,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||
// ST7565 SPI
|
||||
#define ST7735_RESET (11) // Output
|
||||
#define ST7735_CS (12)
|
||||
#define ST7735_BACKLIGHT_EN (13)
|
||||
#define TFT_BL (13)
|
||||
#define ST7735_RS (9)
|
||||
#define ST7735_SDA (39) // actually spi MOSI
|
||||
#define ST7735_SCK (37) // actually spi clk
|
||||
|
@ -185,4 +185,4 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -17,7 +17,7 @@
|
|||
#define ST7735_RESET 39
|
||||
#define ST7735_MISO -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 SPI_FREQUENCY 40000000
|
||||
#define SPI_READ_FREQUENCY 16000000
|
||||
|
@ -88,4 +88,4 @@
|
|||
{ \
|
||||
26, 37, 17, 16, 15, 7 \
|
||||
}
|
||||
// #end keyboard
|
||||
// #end keyboard
|
|
@ -16,7 +16,7 @@
|
|||
#define ST7789_CS 38
|
||||
#define ST7789_RS 40
|
||||
#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_MISO -1
|
||||
|
@ -41,7 +41,7 @@
|
|||
// #define ST7735_RESET 39
|
||||
// #define ST7735_MISO -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 SPI_FREQUENCY 40000000
|
||||
// #define SPI_READ_FREQUENCY 16000000
|
||||
|
@ -112,4 +112,4 @@
|
|||
{ \
|
||||
26, 37, 17, 16, 15, 7 \
|
||||
}
|
||||
// #end keyboard
|
||||
// #end keyboard
|
|
@ -19,7 +19,7 @@
|
|||
// #define ST7735_RESET 39
|
||||
// #define ST7735_MISO -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 SPI_FREQUENCY 40000000
|
||||
// #define SPI_READ_FREQUENCY 16000000
|
||||
|
|
Ładowanie…
Reference in New Issue