FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
flash Namespace Reference

Defines API to handle flash memory storage. More...

Functions

template<typename T >
T & read_flash (uint16_t address, T &item)
 Read flash memory content at given address into item. More...
 
template<typename T >
T & read_flash (const T *address, T &item)
 Read flash memory content at given address into item. More...
 

Detailed Description

Defines API to handle flash memory storage.

Function Documentation

◆ read_flash() [1/2]

template<typename T >
T& flash::read_flash ( uint16_t  address,
T &  item 
)

Read flash memory content at given address into item.

Note that type T should not have constructors as they will not be properly called by this method.

Template Parameters
Ttype of item
Parameters
addressthe address to read from flash storage
itemthe item to read from flah storage
Returns
a reference to read item

Definition at line 47 of file flash.h.

◆ read_flash() [2/2]

template<typename T >
T& flash::read_flash ( const T *  address,
T &  item 
)

Read flash memory content at given address into item.

Note that type T should not have constructors as they will not be properly called by this method. The item shgould properly be defined in flash storage, as in:

struct Dummy
{
uint16_t a;
uint8_t b;
bool c;
};
const Dummy sample1 PROGMEM = {54321, 123, true};

The address of the item in flash storage can then be directly obtained:

Dummy value;
flash::read_flash(&sample1, value);
Template Parameters
Ttype of item
Parameters
addressthe address to read from flash storage
itemthe item to read from flah storage
Returns
a reference to read item

Definition at line 80 of file flash.h.

flash::read_flash
T & read_flash(uint16_t address, T &item)
Read flash memory content at given address into item.
Definition: flash.h:47