diff --git a/Adafruit_ST7789.cpp b/Adafruit_ST7789.cpp index 9fd2f00..ddf9010 100644 --- a/Adafruit_ST7789.cpp +++ b/Adafruit_ST7789.cpp @@ -103,16 +103,20 @@ void Adafruit_ST7789::init(uint16_t width, uint16_t height, uint8_t mode) { commonInit(NULL); - if (width < 240) { - // 1.14" display - _rowstart = _rowstart2 = (int)((320 - height + 1) / 2); - _colstart = (int)((240 - width + 1) / 2); - _colstart2 = (int)((240 - width) / 2); + if (width == 174 && height == 320) { + // 1.47" display + _rowstart = _rowstart2 = 0; + _colstart = _colstart2 = 34; } else if (width == 240 && height == 280) { // 1.69" display _rowstart = 20; _rowstart2 = 0; _colstart = _colstart2 = 0; + } else if (width < 240) { + // 1.14" display + _rowstart = _rowstart2 = (int)((320 - height + 1) / 2); + _colstart = (int)((240 - width + 1) / 2); + _colstart2 = (int)((240 - width) / 2); } else { // 1.3", 1.54", and 2.0" displays _rowstart = (320 - height); diff --git a/examples/graphicstest/graphicstest.ino b/examples/graphicstest/graphicstest.ino index ef8e8e6..439d6ac 100644 --- a/examples/graphicstest/graphicstest.ino +++ b/examples/graphicstest/graphicstest.ino @@ -109,6 +109,9 @@ void setup(void) { // OR use this initializer (uncomment) if using a 1.14" 240x135 TFT: //tft.init(135, 240); // Init ST7789 240x135 + // OR use this initializer (uncomment) if using a 1.47" 174x320 TFT: + //tft.init(174, 320); // Init ST7789 174x320 + // SPI speed defaults to SPI_DEFAULT_FREQ defined in the library, you can override it here // Note that speed allowable depends on chip and quality of wiring, if you go too fast, you // may end up with a black screen some times, or all the time. diff --git a/examples/rotationtest/rotationtest.ino b/examples/rotationtest/rotationtest.ino index d69df5a..37bdca8 100644 --- a/examples/rotationtest/rotationtest.ino +++ b/examples/rotationtest/rotationtest.ino @@ -143,6 +143,9 @@ void setup(void) { // OR use this initializer (uncomment) if using a 1.14" 240x135 TFT: //tft.init(135, 240); // Init ST7789 240x135 + // OR use this initializer (uncomment) if using a 1.47" 174x320 TFT: + tft.init(174, 320); // Init ST7789 174x320 + // SPI speed defaults to SPI_DEFAULT_FREQ defined in the library, you can override it here // Note that speed allowable depends on chip and quality of wiring, if you go too fast, you // may end up with a black screen some times, or all the time.