Merge pull request #177 from adafruit/plugin_160x80_tft

the plug-in FPC version of this display is sliiiiiiiiiiiightly different
This commit is contained in:
Melissa LeBlanc-Williams 2023-02-06 09:43:35 -08:00 committed by GitHub
commit e41416e1cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 4 deletions

View file

@ -181,6 +181,16 @@ static const uint8_t PROGMEM
0x00, 0x00, // XSTART = 0
0x00, 0x9F }, // XEND = 159
Rcmd2green160x80plugin[] = { // 7735R init, part 2 (mini 160x80 with plugin FPC)
3, // 3 commands in list:
ST77XX_INVON, 0, // 1: Display is inverted
ST77XX_CASET, 4, // 2: Column addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
0x00, 0x4F, // XEND = 79
ST77XX_RASET, 4, // 3: Row addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
0x00, 0x9F }, // XEND = 159
Rcmd3[] = { // 7735R init, part 3 (red or green tab)
4, // 4 commands in list:
ST7735_GMCTRP1, 16 , // 1: Gamma Adjustments (pos. polarity), 16 args + delay:
@ -234,6 +244,14 @@ void Adafruit_ST7735::initR(uint8_t options) {
displayInit(Rcmd2green160x80);
_colstart = 24;
_rowstart = 0;
} else if (options == INITR_MINI160x80_PLUGIN) {
_height = ST7735_TFTWIDTH_80;
_width = ST7735_TFTHEIGHT_160;
displayInit(Rcmd2green160x80plugin);
_colstart = 26;
_rowstart = 1;
invertOnCommand = ST77XX_INVOFF;
invertOffCommand = ST77XX_INVON;
} else {
// colstart, rowstart left at default '0' values
displayInit(Rcmd2red);
@ -286,7 +304,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if (tabcolor == INITR_144GREENTAB) {
_height = ST7735_TFTHEIGHT_128;
_width = ST7735_TFTWIDTH_128;
} else if (tabcolor == INITR_MINI160x80) {
} else if (tabcolor == INITR_MINI160x80 ||
tabcolor == INITR_MINI160x80_PLUGIN) {
_height = ST7735_TFTHEIGHT_160;
_width = ST7735_TFTWIDTH_80;
} else {
@ -306,7 +325,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if (tabcolor == INITR_144GREENTAB) {
_width = ST7735_TFTHEIGHT_128;
_height = ST7735_TFTWIDTH_128;
} else if (tabcolor == INITR_MINI160x80) {
} else if (tabcolor == INITR_MINI160x80 ||
tabcolor == INITR_MINI160x80_PLUGIN) {
_width = ST7735_TFTHEIGHT_160;
_height = ST7735_TFTWIDTH_80;
} else {
@ -326,7 +346,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if (tabcolor == INITR_144GREENTAB) {
_height = ST7735_TFTHEIGHT_128;
_width = ST7735_TFTWIDTH_128;
} else if (tabcolor == INITR_MINI160x80) {
} else if (tabcolor == INITR_MINI160x80 ||
tabcolor == INITR_MINI160x80_PLUGIN) {
_height = ST7735_TFTHEIGHT_160;
_width = ST7735_TFTWIDTH_80;
} else {
@ -346,7 +367,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if (tabcolor == INITR_144GREENTAB) {
_width = ST7735_TFTHEIGHT_128;
_height = ST7735_TFTWIDTH_128;
} else if (tabcolor == INITR_MINI160x80) {
} else if (tabcolor == INITR_MINI160x80 ||
tabcolor == INITR_MINI160x80_PLUGIN) {
_width = ST7735_TFTHEIGHT_160;
_height = ST7735_TFTWIDTH_80;
} else {

View file

@ -13,6 +13,7 @@
#define INITR_144GREENTAB 0x01
#define INITR_MINI160x80 0x04
#define INITR_HALLOWING 0x05
#define INITR_MINI160x80_PLUGIN 0x06
// Some register settings
#define ST7735_MADCTL_BGR 0x08

View file

@ -96,6 +96,9 @@ void setup(void) {
// OR use this initializer (uncomment) if using a 0.96" 160x80 TFT:
//tft.initR(INITR_MINI160x80); // Init ST7735S mini display
// OR use this initializer (uncomment) if using a 0.96" 160x80 TFT with
// plug-in FPC (if you see the display is inverted!)
//tft.initR(INITR_MINI160x80_PLUGIN); // Init ST7735S mini display
// OR use this initializer (uncomment) if using a 1.3" or 1.54" 240x240 TFT:
//tft.init(240, 240); // Init ST7789 240x240