I've been working on a project (https://github.com/lewisd32/ArduinoSlideShow) using Adafruit's 1.8" TFT LCD breakout with the SD card slot. The idea is to turn an old film slide viewer into an LCD slide show. The project's working pretty well, I have a button under the slide slot, and I cut the film out of a slide and mounted the LCD to it. When you push the "slide" down into the slide viewer, the button is depressed, and the screen comes on. When you release it, I turn the backlight off, and update the photo on the screen, so that it's ready to show when the "slide" is pushed down again.
My problem is this: It takes about a second to draw the image on the screen. If I check the button while I'm drawing the image, then releasing the slide and quickly (less than a second) press it again, the backlight comes on immediately, and you can see the image being drawn. If I don't check the button, then pushing it down again quickly doesn't respond for 1/2 a second or so, which is arguable worse.
I think the code I'm using is already close to optimal, and is simply being limited by the Arduino's limits on how fast it can operate the SPI bus.
Code: Select all
for (uint8_t x = 0; x < w; ++x) {
for (uint8_t y = 0; y < h; ++y) {
file.read(buf, 3);
r = buf[0];
g = buf[1];
b = buf[2];
tft.pushColor(tft.Color565(r,g,b));
}
}
I can't help but wonder, since both the LCD and the SD card are on the SPI bus, and it seems to be the Arduino itself that's limited in the speed it can operate the SPI bus, is there some way to pass chunks of data directly from the SD card to the LCD? I already write the images to the SD card (from my PC) in a raw format that makes blitting them easier and faster, so changing the file format isn't an issue. I wonder if there's some way to tell the screen that it's about to receive 128 pixels, and then tell the SD card to read the next 128*3 bytes of the file, and have them go straight from the SD card to the LCD, rather than having to go via registers in the Arduino.
Has anyone experimented with anything like this?