Skip to content

Commit 3bf5bc8

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 3bf5bc8

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Adafruit_ST7735.cpp

Lines changed: 18 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,8 @@ 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) ||
300+
(tabcolor == INITR_GREENTAB160x80)) {
290301
_height = ST7735_TFTHEIGHT_160;
291302
_width = ST7735_TFTWIDTH_80;
292303
} else {
@@ -306,7 +317,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
306317
if (tabcolor == INITR_144GREENTAB) {
307318
_width = ST7735_TFTHEIGHT_128;
308319
_height = ST7735_TFTWIDTH_128;
309-
} else if (tabcolor == INITR_MINI160x80) {
320+
} else if ((tabcolor == INITR_MINI160x80) ||
321+
(tabcolor == INITR_GREENTAB160x80)) {
310322
_width = ST7735_TFTHEIGHT_160;
311323
_height = ST7735_TFTWIDTH_80;
312324
} else {
@@ -326,7 +338,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
326338
if (tabcolor == INITR_144GREENTAB) {
327339
_height = ST7735_TFTHEIGHT_128;
328340
_width = ST7735_TFTWIDTH_128;
329-
} else if (tabcolor == INITR_MINI160x80) {
341+
} else if ((tabcolor == INITR_MINI160x80) ||
342+
(tabcolor == INITR_GREENTAB160x80)) {
330343
_height = ST7735_TFTHEIGHT_160;
331344
_width = ST7735_TFTWIDTH_80;
332345
} else {
@@ -346,7 +359,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
346359
if (tabcolor == INITR_144GREENTAB) {
347360
_width = ST7735_TFTHEIGHT_128;
348361
_height = ST7735_TFTWIDTH_128;
349-
} else if (tabcolor == INITR_MINI160x80) {
362+
} else if ((tabcolor == INITR_MINI160x80) ||
363+
(tabcolor == INITR_GREENTAB160x80)) {
350364
_width = ST7735_TFTHEIGHT_160;
351365
_height = ST7735_TFTWIDTH_80;
352366
} 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)