Skip to content

Add access to init functions from TFT.cpp #19

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 2 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
10 changes: 10 additions & 0 deletions src/TFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,13 @@ void TFT::begin() {
initG();
setRotation(1);
}

void TFT::begin(uint8_t init_opt) {
if(init_opt == INIT_B) initB();
else if (init_opt == INIT_G) initG();
else if (init_opt == INITR_REDTAB) initR(INITR_REDTAB);
else if (init_opt == INITR_BLACKTAB) initR(INITR_BLACKTAB);
else if (init_opt == INITR_GREENTAB) initR(INITR_GREENTAB);

setRotation(1);
}
1 change: 1 addition & 0 deletions src/TFT.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class TFT : public Adafruit_ST7735 {
TFT(uint8_t CS, uint8_t RS, uint8_t RST);

void begin();
void begin(uint8_t init_opt);
};

/// Esplora boards have hard-wired connections with
Expand Down
2 changes: 2 additions & 0 deletions src/utility/Adafruit_ST7735.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#define INITR_GREENTAB 0x0
#define INITR_REDTAB 0x1
#define INITR_BLACKTAB 0x2
#define INIT_B 0x3
#define INIT_G 0x4

#define ST7735_TFTWIDTH 128
#define ST7735_TFTHEIGHT 160
Expand Down