Skip to content

Commit 57e2cfa

Browse files
authored
Merge pull request #12 from per1234/softspi
Add software SPI constructor
2 parents 4680e35 + 0845d8c commit 57e2cfa

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/TFT.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
TFT EsploraTFT(7, 0, 1);
3636
#endif
3737

38+
TFT::TFT(uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST)
39+
: Adafruit_ST7735(CS, RS, SID, SCLK, RST)
40+
{
41+
// as we already know the orientation (landscape, therefore rotated),
42+
// set default width and height without need to call begin() first.
43+
_width = ST7735_TFTHEIGHT;
44+
_height = ST7735_TFTWIDTH;
45+
}
46+
3847
TFT::TFT(uint8_t CS, uint8_t RS, uint8_t RST)
3948
: Adafruit_ST7735(CS, RS, RST)
4049
{

src/TFT.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4444
/// @author Enrico Gueli <[email protected]>
4545
class TFT : public Adafruit_ST7735 {
4646
public:
47+
TFT(uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST);
4748
TFT(uint8_t CS, uint8_t RS, uint8_t RST);
4849

4950
void begin();

0 commit comments

Comments
 (0)