Added method to copy progmem data to SPIFFS

This commit is contained in:
Daniel Eichhorn
2017-05-18 07:50:14 +02:00
parent 679036d0d0
commit aa8481feeb
2 changed files with 11 additions and 0 deletions

View File

@@ -216,3 +216,13 @@ uint32_t GfxUi::read32(File &f) {
((uint8_t *)&result)[3] = f.read(); // MSB
return result;
}
void GfxUi::copyProgmemToFile(const uint8_t *data, unsigned int image_len, String filename) {
File f = SPIFFS.open(filename, "w+");
for (int i = 0; i < image_len; i++) {
uint8_t c = pgm_read_byte(data++);
f.write(c);
}
f.close();
}