Skip to content

Commit cb7b62f

Browse files
committed
added the support to the new display GREENTAB_L
1 parent 034cb91 commit cb7b62f

File tree

3 files changed

+74
-7
lines changed

3 files changed

+74
-7
lines changed

libraries/TFT/src/TFT.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "TFT.h"
22

3-
#if ARDUINO_AVR_ESPLORA // are we building for Esplora?
3+
#if ARDUINO_AVR_ESPLORA
44
TFT EsploraTFT(7, 0, 1);
55
#endif
66

@@ -14,6 +14,7 @@ TFT::TFT(uint8_t CS, uint8_t RS, uint8_t RST)
1414
}
1515

1616
void TFT::begin() {
17-
initR(INITR_REDTAB);
17+
//initR(INITR_REDTAB);
18+
initG();
1819
setRotation(1);
1920
}

libraries/TFT/src/utility/Adafruit_ST7735.cpp

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ inline uint16_t swapcolor(uint16_t x) {
3030

3131
// Constructor when using software SPI. All output pins are configurable.
3232
Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t sid,
33-
uint8_t sclk, uint8_t rst) : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
33+
uint8_t sclk, uint8_t rst) : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
3434
{
3535
_cs = cs;
3636
_rs = rs;
@@ -44,7 +44,7 @@ Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t sid,
4444
// Constructor when using hardware SPI. Faster, but must use SPI pins
4545
// specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
4646
Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t rst) :
47-
Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
47+
Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
4848
{
4949
_cs = cs;
5050
_rs = rs;
@@ -229,7 +229,66 @@ PROGMEM static prog_uchar
229229
ST7735_NORON , DELAY, // 3: Normal display on, no args, w/delay
230230
10, // 10 ms delay
231231
ST7735_DISPON , DELAY, // 4: Main screen turn on, no args w/delay
232-
100 }; // 100 ms delay
232+
100 }, // 100 ms delay
233+
Gcmd[] = { // Initialization commands for 7735B screens
234+
19, // 18 commands in list:
235+
ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay
236+
50, // 50 ms delay
237+
ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay
238+
100, // 255 = 500 ms delay
239+
0x26 , 1, // 3: Set default gamma
240+
0x04, // 16-bit color
241+
0xb1, 2, // 4: Frame Rate
242+
0x0b,
243+
0x14,
244+
0xc0, 2, // 5: VRH1[4:0] & VC[2:0]
245+
0x08,
246+
0x00,
247+
0xc1, 1, // 6: BT[2:0]
248+
0x05,
249+
0xc5, 2, // 7: VMH[6:0] & VML[6:0]
250+
0x41,
251+
0x30,
252+
0xc7, 1, // 8: LCD Driving control
253+
0xc1,
254+
0xEC, 1, // 9: Set pumping color freq
255+
0x1b,
256+
0x3a , 1 + DELAY, // 10: Set color format
257+
0x55, // 16-bit color
258+
100,
259+
0x2a, 4, // 11: Set Column Address
260+
0x00,
261+
0x00,
262+
0x00,
263+
0x7f,
264+
0x2b, 4, // 12: Set Page Address
265+
0x00,
266+
0x00,
267+
0x00,
268+
0x9f,
269+
0x36, 1, // 12+1: Set Scanning Direction
270+
0xc8,
271+
0xb7, 1, // 14: Set Source Output Direciton
272+
0x00,
273+
0xf2, 1, // 15: Enable Gamma bit
274+
0x00,
275+
0xe0, 15 + DELAY, // 16: magic
276+
0x28, 0x24, 0x22, 0x31,
277+
0x2b, 0x0e, 0x53, 0xa5,
278+
0x42, 0x16, 0x18, 0x12,
279+
0x1a, 0x14, 0x03,
280+
50,
281+
0xe1, 15 + DELAY, // 17: more magic
282+
0x17, 0x1b, 0x1d, 0x0e,
283+
0x14, 0x11, 0x2c, 0xa5,
284+
0x3d, 0x09, 0x27, 0x2d,
285+
0x25, 0x2b, 0x3c,
286+
50,
287+
ST7735_NORON , DELAY, // 17: Normal display on, no args, w/delay
288+
10, // 10 ms delay
289+
ST7735_DISPON , DELAY, // 18: Main screen turn on, no args, w/delay
290+
255 }; // 255 = 500 ms delay
291+
233292

234293

235294
// Companion code to the above tables. Reads and issues
@@ -261,7 +320,7 @@ void Adafruit_ST7735::commandList(uint8_t *addr) {
261320
// Initialization code common to both 'B' and 'R' type displays
262321
void Adafruit_ST7735::commonInit(uint8_t *cmdList) {
263322

264-
colstart = rowstart = 0; // May be overridden in init func
323+
colstart = rowstart = 0; // May be overridden in init func
265324

266325
pinMode(_rs, OUTPUT);
267326
pinMode(_cs, OUTPUT);
@@ -312,6 +371,12 @@ void Adafruit_ST7735::initB(void) {
312371
}
313372

314373

374+
// Initialization for ST7735B screens
375+
void Adafruit_ST7735::initG(void) {
376+
commonInit(Gcmd);
377+
}
378+
379+
315380
// Initialization for ST7735R screens (green or red tabs)
316381
void Adafruit_ST7735::initR(uint8_t options) {
317382
commonInit(Rcmd1);

libraries/TFT/src/utility/Adafruit_ST7735.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/***************************************************
1+
/***************************************************
22
This is a library for the Adafruit 1.8" SPI display.
33
This library works with the Adafruit 1.8" TFT Breakout w/SD card
44
----> http://www.adafruit.com/products/358
@@ -102,6 +102,7 @@ class Adafruit_ST7735 : public Adafruit_GFX {
102102
Adafruit_ST7735(uint8_t CS, uint8_t RS, uint8_t RST);
103103

104104
void initB(void), // for ST7735B displays
105+
initG(void), // for ILI9163C displays
105106
initR(uint8_t options = INITR_GREENTAB), // for ST7735R
106107
setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1),
107108
pushColor(uint16_t color),

0 commit comments

Comments
 (0)