gimpo
Well-known member
Hi everybody,
my Teensy 3.2 was working like a charm if using the "old" libs by adafruit with an 1.54" TFT display:
GFX version = 1.3.6
ST77xx version = 1.2.7
(See my simple test sketch below.)
Today, I've decided to update to latest version by using the Tool > Manage libraries command of the Arduino IDE.
Was a bad idea, all my sketches doesn't work anymore and the display stays black. No life signal...
If I revert back (to the 1.3.6 for the GFX lib only), then all works fine again. So the problem is not in the ST77xx libs.
To summarize:
Maybe something has changed in the display initialization? The pins are arranged differently?
I checked the source code of the libs, but I cannot find any significant difference...
What I'm missing?
Any idea?
----------------------------------------------------------------
Here below my test code.
It simply initialize the display and then:
1. draws a rectangle and some text at two corners to show the max width and height of the screen,
2. pause a little,
3. loops forever in drawing some colored squares along the diagonals of the screen.
my Teensy 3.2 was working like a charm if using the "old" libs by adafruit with an 1.54" TFT display:
GFX version = 1.3.6
ST77xx version = 1.2.7
(See my simple test sketch below.)
Today, I've decided to update to latest version by using the Tool > Manage libraries command of the Arduino IDE.
Was a bad idea, all my sketches doesn't work anymore and the display stays black. No life signal...
If I revert back (to the 1.3.6 for the GFX lib only), then all works fine again. So the problem is not in the ST77xx libs.
To summarize:
GFX | ST77xx | Works? |
1.3.6 | 1.2.8 | yes |
1.4.0 | 1.2.8 | no |
1.4.1 | 1.2.8 | no |
1.4.2 | 1.2.8 | no |
Maybe something has changed in the display initialization? The pins are arranged differently?
I checked the source code of the libs, but I cannot find any significant difference...
What I'm missing?
Any idea?
----------------------------------------------------------------
Here below my test code.
It simply initialize the display and then:
1. draws a rectangle and some text at two corners to show the max width and height of the screen,
2. pause a little,
3. loops forever in drawing some colored squares along the diagonals of the screen.
Code:
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library
#include <Adafruit_ST77xx.h> // just for colo defs
#include <SPI.h>
#define TFT_RST 2 // chip reset
#define TFT_DC 3 // tells the display if you're sending data (D) or commands (C) --> A0 or WR pin on TFT
#define TFT_MOSI 11 // Data out (SPI standard)
#define TFT_SCLK 13 // Clock out (SPI standard)
#define TFT_CS 15 // chip select (SPI standard)
int x, y;
bool toogle;
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
void setup(void) {
pinMode(23, OUTPUT);
pinMode(22, OUTPUT);
pinMode(21, OUTPUT);
digitalWrite(23, HIGH);
digitalWrite(22, HIGH);
digitalWrite(21, LOW);
tft.init(240, 240);
tft.setRotation(2);
tft.fillScreen(ST77XX_BLACK);
// up left
tft.fillRect(0, 0, 10, 10, ST77XX_BLUE);
tft.setCursor(12, 12);
tft.println("UP-LEFT");
delay(500);
// bottom right
tft.fillRect(tft.width() - 10, tft.height() - 10, 10, 10, ST77XX_RED);
tft.setCursor(tft.width() - 82, tft.height() - 20);
tft.println("BOTTOM-RIGHT");
delay(500);
// area frame
tft.drawRect(0, 0, tft.width(), tft.height(), ST77XX_GREEN);
delay(3000);
}
void loop()
{
tft.fillScreen(ST77XX_BLACK);
x = 0;
y = 0;
toogle = true;
for (int i = 0; i < 20; i++)
{
tft.fillRect(x, y, 50, 50, toogle ? ST77XX_BLUE : ST77XX_YELLOW);
tft.fillRect(190 - x, y, 50, 50, toogle ? ST77XX_RED : ST77XX_ORANGE);
x += 10;
y += 10;
toogle = toogle == true ? false : true;
}
delay(1000);
}
Last edited: