#include <TFT_eSPI.h>
#include "Image.h"
TFT_eSPI tft = TFT_eSPI();
void decodeImage(int x, int y, int h, int w, const uint16_t *rleEncoded) {
int idx = 0;
int count = 0;
for(int i=0; i<h; i++) {
uint16_t tempColor[w];
for(int j=0; j<w; j++) {
uint16_t color = rleEncoded[idx];
count++;
if(count == rleEncoded[idx+1]) {
idx+=2;
count = 0;
}
tempColor[j] = (color << 8) | (color >> 8);
}
tft.pushImage(x, y+i, w,1, tempColor);
}
}
void setup() {
tft.init();
tft.fillScreen(0xffff);
}
void loop() {
decodeImage(4,30, 232, 232, Image1);
delay(1000);
decodeImage(4,30, 232, 232, Image2);
delay(1000);
}
Loading
ili9341-cap-touch
ili9341-cap-touch