acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
PNG_FS_Support.ino (740B)
1 // Here are the callback functions that the decPNG library 2 // will use to open files, fetch data and close the file. 3 4 File pngfile; 5 6 void * pngOpen(const char *filename, int32_t *size) { 7 Serial.printf("Attempting to open %s\n", filename); 8 pngfile = FileSys.open(filename, "r"); 9 *size = pngfile.size(); 10 return &pngfile; 11 } 12 13 void pngClose(void *handle) { 14 File pngfile = *((File*)handle); 15 if (pngfile) pngfile.close(); 16 } 17 18 int32_t pngRead(PNGFILE *page, uint8_t *buffer, int32_t length) { 19 if (!pngfile) return 0; 20 page = page; // Avoid warning 21 return pngfile.read(buffer, length); 22 } 23 24 int32_t pngSeek(PNGFILE *page, int32_t position) { 25 if (!pngfile) return 0; 26 page = page; // Avoid warning 27 return pngfile.seek(position); 28 }