25#include <avr/pgmspace.h>
49 template<
typename T = u
int8_t>
52 uint8_t* ptr = (uint8_t*) buffer;
53 for (
size_t i = 0; i < (size *
sizeof(T)); ++i) *ptr++ = pgm_read_byte(address++);
67 template<
typename T> T&
read_flash(uint16_t address, T& item)
69 uint8_t* ptr = (uint8_t*) &item;
70 for (
size_t i = 0; i <
sizeof(T); ++i) *ptr++ = pgm_read_byte(address++);
100 template<
typename T> T&
read_flash(
const T* address, T& item)
118 explicit FlashReader(
const T* flash_buffer) : address_{uint16_t(flash_buffer)} {}
129 address_ +=
sizeof(T);
152 static const char __c[] PROGMEM = (ptr); \
153 (const flash::FlashStorage*) &__c[0]; \
Functor reading items from an address in AVR Flash memory (PROGMEM).
FlashReader(const T *flash_buffer)
Construct a FlashReader functor reading Flash from flash_buffer address.
T operator()()
Get the enxt item read from memory.
Defines API to handle flash memory storage.
T * read_flash(uint16_t address, T *buffer, uint8_t size)
Read flash memory content at given address into buffer.