Skip to content

Commit

Permalink
Fix examples for newer GFX SPITFT calls
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintYourDragon committed Nov 14, 2018
1 parent e363b9d commit fda6dd7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion examples/seesaw_shield18_test/seesaw_shield18_test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) {
// Set TFT address window to clipped image bounds
tft.startWrite();
tft.setAddrWindow(x, y, w, h);
tft.endWrite();

for (row=0; row<h; row++) { // For each scanline...

Expand All @@ -259,6 +258,7 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) {
else // Bitmap is stored top-to-bottom
pos = bmpImageoffset + row * rowSize;
if(bmpFile.position() != pos) { // Need seek?
tft.endWrite();
bmpFile.seek(pos);
buffidx = sizeof(sdbuffer); // Force buffer reload
}
Expand All @@ -268,6 +268,7 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) {
if (buffidx >= sizeof(sdbuffer)) { // Indeed
bmpFile.read(sdbuffer, sizeof(sdbuffer));
buffidx = 0; // Set index to beginning
tft.startWrite();
}

// Convert pixel from BMP to TFT format, push to display
Expand Down
6 changes: 5 additions & 1 deletion examples/shieldtest/shieldtest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ void bmpDraw(char *filename, uint8_t x, uint8_t y) {
if((y+h-1) >= tft.height()) h = tft.height() - y;

// Set TFT address window to clipped image bounds
tft.setAddrWindow(x, y, x+w-1, y+h-1);
tft.startWrite();
tft.setAddrWindow(x, y, w, h);

for (row=0; row<h; row++) { // For each scanline...

Expand All @@ -206,6 +207,7 @@ void bmpDraw(char *filename, uint8_t x, uint8_t y) {
else // Bitmap is stored top-to-bottom
pos = bmpImageoffset + row * rowSize;
if(bmpFile.position() != pos) { // Need seek?
tft.endWrite();
bmpFile.seek(pos);
buffidx = sizeof(sdbuffer); // Force buffer reload
}
Expand All @@ -215,6 +217,7 @@ void bmpDraw(char *filename, uint8_t x, uint8_t y) {
if (buffidx >= sizeof(sdbuffer)) { // Indeed
bmpFile.read(sdbuffer, sizeof(sdbuffer));
buffidx = 0; // Set index to beginning
tft.startWrite();
}

// Convert pixel from BMP to TFT format, push to display
Expand All @@ -224,6 +227,7 @@ void bmpDraw(char *filename, uint8_t x, uint8_t y) {
tft.pushColor(tft.color565(r,g,b));
} // end pixel
} // end scanline
tft.endWrite();
Serial.print("Loaded in ");
Serial.print(millis() - startTime);
Serial.println(" ms");
Expand Down
6 changes: 5 additions & 1 deletion examples/spitftbitmap/spitftbitmap.ino
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) {
if((y+h-1) >= tft.height()) h = tft.height() - y;

// Set TFT address window to clipped image bounds
tft.setAddrWindow(x, y, x+w-1, y+h-1);
tft.startWrite();
tft.setAddrWindow(x, y, w, h);

for (row=0; row<h; row++) { // For each scanline...

Expand All @@ -190,6 +191,7 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) {
else // Bitmap is stored top-to-bottom
pos = bmpImageoffset + row * rowSize;
if(bmpFile.position() != pos) { // Need seek?
tft.endWrite();
bmpFile.seek(pos);
buffidx = sizeof(sdbuffer); // Force buffer reload
}
Expand All @@ -199,6 +201,7 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) {
if (buffidx >= sizeof(sdbuffer)) { // Indeed
bmpFile.read(sdbuffer, sizeof(sdbuffer));
buffidx = 0; // Set index to beginning
tft.startWrite();
}

// Convert pixel from BMP to TFT format, push to display
Expand All @@ -208,6 +211,7 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) {
tft.pushColor(tft.color565(r,g,b));
} // end pixel
} // end scanline
tft.endWrite();
Serial.print(F("Loaded in "));
Serial.print(millis() - startTime);
Serial.println(" ms");
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit ST7735 and ST7789 Library
version=1.2.4
version=1.2.5
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=This is a library for the Adafruit ST7735 and ST7789 SPI displays.
Expand Down

0 comments on commit fda6dd7

Please sign in to comment.