Skip to content

Added support for WaveShare-like modules (greentab offsets with blacktab colors-yellowtab?) #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Adafruit_ST7735.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ void Adafruit_ST7735::initR(uint8_t options) {
displayInit(Rcmd3);

// Black tab, change MADCTL color filter
if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80)) {
if ((options == INITR_BLACKTAB) || (options == INITR_GREENTAB_WS) ||
(options == INITR_MINI160x80)) {
uint8_t data = 0xC0;
sendCommand(ST77XX_MADCTL, &data, 1);
}
Expand Down Expand Up @@ -277,7 +278,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {

switch (rotation) {
case 0:
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_GREENTAB_WS) ||
(tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB;
} else {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST7735_MADCTL_BGR;
Expand All @@ -297,7 +299,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_ystart = _rowstart;
break;
case 1:
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_GREENTAB_WS) ||
(tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_MY | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
} else {
madctl = ST77XX_MADCTL_MY | ST77XX_MADCTL_MV | ST7735_MADCTL_BGR;
Expand All @@ -317,7 +320,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_xstart = _rowstart;
break;
case 2:
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_GREENTAB_WS) ||
(tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_RGB;
} else {
madctl = ST7735_MADCTL_BGR;
Expand All @@ -337,7 +341,8 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_ystart = _rowstart;
break;
case 3:
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_GREENTAB_WS) ||
(tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
} else {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST7735_MADCTL_BGR;
Expand Down
1 change: 1 addition & 0 deletions Adafruit_ST7735.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define INITR_144GREENTAB 0x01
#define INITR_MINI160x80 0x04
#define INITR_HALLOWING 0x05
#define INITR_GREENTAB_WS INITR_GREENTAB

// Some register settings
#define ST7735_MADCTL_BGR 0x08
Expand Down