Skip to content

Commit 428dbce

Browse files
committed
add support for another 160x80 module
The module is used on M5StickC, BGR inverted, x offset 26, y offset 1.
1 parent c2d4eb9 commit 428dbce

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Adafruit_ST7735.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ void Adafruit_ST7735::initR(uint8_t options) {
234234
displayInit(Rcmd2green160x80);
235235
_colstart = 24;
236236
_rowstart = 0;
237+
} else if (options == INITR_GREENTAB160x80) {
238+
_height = ST7735_TFTWIDTH_80;
239+
_width = ST7735_TFTHEIGHT_160;
240+
displayInit(Rcmd2green160x80);
241+
_colstart = 26;
242+
_rowstart = 1;
237243
} else {
238244
// colstart, rowstart left at default '0' values
239245
displayInit(Rcmd2red);
@@ -246,6 +252,10 @@ void Adafruit_ST7735::initR(uint8_t options) {
246252
sendCommand(ST77XX_MADCTL, &data, 1);
247253
}
248254

255+
if(options == INITR_GREENTAB160x80) {
256+
sendCommand(ST77XX_INVON, 0);
257+
}
258+
249259
if (options == INITR_HALLOWING) {
250260
// Hallowing is simply a 1.44" green tab upside-down:
251261
tabcolor = INITR_144GREENTAB;
@@ -286,7 +296,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
286296
if (tabcolor == INITR_144GREENTAB) {
287297
_height = ST7735_TFTHEIGHT_128;
288298
_width = ST7735_TFTWIDTH_128;
289-
} else if (tabcolor == INITR_MINI160x80) {
299+
} else if ((tabcolor == INITR_MINI160x80) || (tabcolor == INITR_GREENTAB160x80)) {
290300
_height = ST7735_TFTHEIGHT_160;
291301
_width = ST7735_TFTWIDTH_80;
292302
} else {
@@ -306,7 +316,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
306316
if (tabcolor == INITR_144GREENTAB) {
307317
_width = ST7735_TFTHEIGHT_128;
308318
_height = ST7735_TFTWIDTH_128;
309-
} else if (tabcolor == INITR_MINI160x80) {
319+
} else if ((tabcolor == INITR_MINI160x80) || (tabcolor == INITR_GREENTAB160x80)) {
310320
_width = ST7735_TFTHEIGHT_160;
311321
_height = ST7735_TFTWIDTH_80;
312322
} else {
@@ -326,7 +336,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
326336
if (tabcolor == INITR_144GREENTAB) {
327337
_height = ST7735_TFTHEIGHT_128;
328338
_width = ST7735_TFTWIDTH_128;
329-
} else if (tabcolor == INITR_MINI160x80) {
339+
} else if ((tabcolor == INITR_MINI160x80) || (tabcolor == INITR_GREENTAB160x80)) {
330340
_height = ST7735_TFTHEIGHT_160;
331341
_width = ST7735_TFTWIDTH_80;
332342
} else {
@@ -346,7 +356,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
346356
if (tabcolor == INITR_144GREENTAB) {
347357
_width = ST7735_TFTHEIGHT_128;
348358
_height = ST7735_TFTWIDTH_128;
349-
} else if (tabcolor == INITR_MINI160x80) {
359+
} else if ((tabcolor == INITR_MINI160x80) || (tabcolor == INITR_GREENTAB160x80)) {
350360
_width = ST7735_TFTHEIGHT_160;
351361
_height = ST7735_TFTWIDTH_80;
352362
} else {

Adafruit_ST7735.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define INITR_144GREENTAB 0x01
1414
#define INITR_MINI160x80 0x04
1515
#define INITR_HALLOWING 0x05
16+
#define INITR_GREENTAB160x80 0x06
1617

1718
// Some register settings
1819
#define ST7735_MADCTL_BGR 0x08

0 commit comments

Comments
 (0)