mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-05 05:34:43 +02:00
Add ability to set ST7735 tab color from sketch
Use line is form: tft.init(1); or: tft.init(INITR_REDTAB); // Enumerated the configurations in library are: #define INITR_GREENTAB 0x0 #define INITR_REDTAB 0x1 #define INITR_BLACKTAB 0x2 #define INITR_GREENTAB2 0x3 // Use if you get random pixels on two edges of green tab display #define INITR_GREENTAB3 0x4 // Use if you get random pixels on edge(s) of 128x128 screen #define INITR_GREENTAB128 0x5 // Use if you only get part of 128x128 screen in rotation 0 & 1 #define INITB 0xB
This commit is contained in:
@@ -140,8 +140,6 @@
|
||||
ST7735_DISPON , TFT_INIT_DELAY, // 4: Main screen turn on, no args w/delay
|
||||
100 }; // 100 ms delay
|
||||
|
||||
tabcolor = TAB_COLOUR;
|
||||
|
||||
if (tabcolor == INITB)
|
||||
{
|
||||
commandList(Bcmd);
|
||||
|
13
TFT_eSPI.cpp
13
TFT_eSPI.cpp
@@ -209,9 +209,9 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
|
||||
** Function name: begin
|
||||
** Description: Included for backwards compatibility
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::begin(void)
|
||||
void TFT_eSPI::begin(uint8_t tc)
|
||||
{
|
||||
init();
|
||||
init(tc);
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ void TFT_eSPI::begin(void)
|
||||
** Function name: init
|
||||
** Description: Reset, then initialise the TFT display registers
|
||||
***************************************************************************************/
|
||||
void TFT_eSPI::init(void)
|
||||
void TFT_eSPI::init(uint8_t tc)
|
||||
{
|
||||
#if !defined (ESP32)
|
||||
#ifdef TFT_CS
|
||||
@@ -307,6 +307,7 @@ void TFT_eSPI::init(void)
|
||||
#include "TFT_Drivers/ILI9341_Init.h"
|
||||
|
||||
#elif defined (ST7735_DRIVER)
|
||||
tabcolor = tc;
|
||||
#include "TFT_Drivers/ST7735_Init.h"
|
||||
|
||||
#elif defined (ILI9163_DRIVER)
|
||||
@@ -318,6 +319,9 @@ void TFT_eSPI::init(void)
|
||||
#elif defined (RPI_ILI9486_DRIVER)
|
||||
#include "TFT_Drivers/RPI_ILI9486_Init.h"
|
||||
|
||||
#elif defined (ILI9486_DRIVER)
|
||||
#include "TFT_Drivers/ILI9486_Init.h"
|
||||
|
||||
#elif defined (ILI9481_DRIVER)
|
||||
#include "TFT_Drivers/ILI9481_Init.h"
|
||||
|
||||
@@ -359,6 +363,9 @@ void TFT_eSPI::setRotation(uint8_t m)
|
||||
#elif defined (RPI_ILI9486_DRIVER)
|
||||
#include "TFT_Drivers/RPI_ILI9486_Rotation.h"
|
||||
|
||||
#elif defined (ILI9486_DRIVER)
|
||||
#include "TFT_Drivers/ILI9486_Rotation.h"
|
||||
|
||||
#elif defined (ILI9481_DRIVER)
|
||||
#include "TFT_Drivers/ILI9481_Rotation.h"
|
||||
|
||||
|
@@ -21,6 +21,10 @@
|
||||
// available and the pins to be used
|
||||
#include <User_Setup_Select.h>
|
||||
|
||||
#ifndef TAB_COLOUR
|
||||
TAB_COLOUR 0
|
||||
#endif
|
||||
|
||||
// If the frequency is not defined, set a default
|
||||
#ifndef SPI_FREQUENCY
|
||||
#define SPI_FREQUENCY 20000000
|
||||
@@ -491,7 +495,7 @@ class TFT_eSPI : public Print {
|
||||
|
||||
TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
|
||||
|
||||
void init(void), begin(void); // Same - begin included for backwards compatibility
|
||||
void init(uint8_t tc = TAB_COLOUR), begin(uint8_t tc = TAB_COLOUR); // Same - begin included for backwards compatibility
|
||||
|
||||
// These are virtual so the TFT_eSprite class can override them with sprite specific functions
|
||||
virtual void drawPixel(uint32_t x, uint32_t y, uint32_t color),
|
||||
|
@@ -8,7 +8,7 @@
|
||||
// Data folder, press Ctrl+K to see this folder. Use the IDE "Tools" menu
|
||||
// option to upload the sketches data folder to the SPIFFS
|
||||
|
||||
// This sketch ahs been tested on the ESP32 and ESP8266
|
||||
// This sketch has been tested on the ESP32 and ESP8266
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
// This example is part of the TFT_eSPI library:
|
||||
// https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
// Created by Bodmer 23/14/18
|
||||
// Created by Bodmer 23/04/18
|
||||
|
||||
#include "xbm.h" // Sketch tab header for xbm images
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
verify the correct settings are being picked up by the compiler.
|
||||
|
||||
If support is needed the output can be cut and pasted into an Arduino Forum post and
|
||||
already inlcudes the formatting [code]...[/code] markups.
|
||||
already includes the formatting [code]...[/code] markups.
|
||||
|
||||
Written by Bodmer 9/4/18
|
||||
*/
|
||||
|
Reference in New Issue
Block a user