FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Collection of static methods to read or write the AVR EEPROM. More...
#include <fastarduino/eeprom.h>
Public Member Functions | |
EEPROM (const EEPROM &)=delete | |
EEPROM & | operator= (const EEPROM &)=delete |
Static Public Member Functions | |
template<typename T > | |
static bool | read (const T *address, T &value) |
Read value of type T stored in EEPROM at address . More... | |
template<typename T > | |
static bool | read (uint16_t address, T &value) |
Read value of type T stored in EEPROM at address . More... | |
template<typename T > | |
static bool | read (const T *address, T *value, uint16_t count) |
Read an array of count values of type T stored in EEPROM at address . More... | |
template<typename T > | |
static bool | read (uint16_t address, T *value, uint16_t count) |
Read an array of count values of type T stored in EEPROM at address . More... | |
static bool | read (const uint8_t *address, uint8_t &value) |
Read one byte stored in EEPROM at address . More... | |
static bool | read (uint16_t address, uint8_t &value) |
Read one byte stored in EEPROM at address . More... | |
template<typename T > | |
static bool | write (const T *address, const T &value) |
Write the content of value of type T to the EEPROM at address . More... | |
template<typename T > | |
static bool | write (uint16_t address, const T &value) |
Write the content of value of type T to the EEPROM at address . More... | |
template<typename T > | |
static bool | write (const T *address, const T *value, uint16_t count) |
Write value , an array of count values of type T to the EEPROM at address . More... | |
template<typename T > | |
static bool | write (uint16_t address, const T *value, uint16_t count) |
Write value , an array of count values of type T to the EEPROM at address . More... | |
static bool | write (const uint8_t *address, uint8_t value) |
Write one byte to the EEPROM at address . More... | |
static bool | write (uint16_t address, uint8_t value) |
Write one byte to the EEPROM at address . More... | |
static void | erase () |
Erase the full EEPROM content. More... | |
static constexpr uint16_t | size () |
Return the size (in bytes) of the embedded EEPROM. More... | |
static void | wait_until_ready () |
Block until the current EEPROM operation, whetever it is (e.g. More... | |
Collection of static methods to read or write the AVR EEPROM.
All API here is blocking, i.e. will not return until read or write is complete.
All API here exists in 2 flavors, differing in how the EEPROM cell address is passed :
uint16_t
location, from 0
to max EEPROM sizeEEMEM
attributeThe second is generally more convenient as it allows you to:
.eep
file that you can separately upload to EEPROMThe following snippet shows briefly how you can use the EEMEM
flavor:
|
inlinestatic |
Read value of type T
stored in EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from EEPROM to internal content of the type, no T
code gets executed.T | the type of content to be read (determines the number of bytes to read) |
address | the location to be read in EEPROM; address is typically obtained as &variable where variable is a global variable that was declared with EEMEM attribute. |
value | a reference to the variable that will be assigned the content read from EEPROM |
true | if read was successful |
false | if read failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Read value of type T
stored in EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from EEPROM to internal content of the type, no T
code gets executed.T | the type of content to be read (determines the number of bytes to read) |
address | the location to be read in EEPROM; address is provided as an absolute location, from 0 to the maximum EEPROM size |
value | a reference to the variable that will be assigned the content read from EEPROM |
true | if read was successful |
false | if read failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Read an array of count
values of type T
stored in EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from EEPROM to internal content of the type, no T
code gets executed.T | the type of content to be read (determines the number of bytes to read) |
address | the location to be read in EEPROM; address is typically obtained as variable where variable is a global variable array that was declared with EEMEM attribute. |
value | a pointer to the variable array that will be assigned the content read from EEPROM |
count | the number of items of type T to be read |
true | if read was successful |
false | if read failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Read an array of count
values of type T
stored in EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from EEPROM to internal content of the type, no T
code gets executed.T | the type of content to be read (determines the number of bytes to read) |
address | the location to be read in EEPROM; address is provided as an absolute location, from 0 to the maximum EEPROM size |
value | a pointer to the variable array that will be assigned the content read from EEPROM |
count | the number of items of type T to be read |
true | if read was successful |
false | if read failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Read one byte stored in EEPROM at address
.
address | the location to be read in EEPROM; address is typically obtained as &variable where variable is a global variable that was declared with EEMEM attribute. |
value | a reference to the variable that will be assigned the content read from EEPROM |
true | if read was successful |
false | if read failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Read one byte stored in EEPROM at address
.
address | the location to be read in EEPROM; address is provided as an absolute location, from 0 to the maximum EEPROM size |
value | a reference to the variable that will be assigned the content read from EEPROM |
true | if read was successful |
false | if read failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Write the content of value
of type T
to the EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from local variable content to EEPROM, no T
code gets executed.T | the type of content to be written (determines the number of bytes to write) |
address | the location to be written in EEPROM; address is typically obtained as &variable where variable is a global variable that was declared with EEMEM attribute. |
value | a reference to the variable which content will be copied to EEPROM |
true | if write was successful |
false | if write failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Write the content of value
of type T
to the EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from local variable content to EEPROM, no T
code gets executed.T | the type of content to be written (determines the number of bytes to write) |
address | the location to be written in EEPROM; address is provided as an absolute location, from 0 to the maximum EEPROM size |
value | a reference to the variable which content will be copied to EEPROM |
true | if write was successful |
false | if write failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Write value
, an array of count
values of type T
to the EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from local variable content to EEPROM, no T
code gets executed.T | the type of content to be written (determines the number of bytes to write) |
address | the location to be written in EEPROM; address is typically obtained as variable where variable is a global variable array that was declared with EEMEM attribute. |
value | a pointer to the variable array which content will be copied to EEPROM |
count | the number of items of type T to be written |
true | if write was successful |
false | if write failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Write value
, an array of count
values of type T
to the EEPROM at address
.
T
type, this method never calls its assignment operator but simply copies, byte per byte, content from local variable content to EEPROM, no T
code gets executed.T | the type of content to be written (determines the number of bytes to write) |
address | the location to be written in EEPROM; address is provided as an absolute location, from 0 to the maximum EEPROM size |
value | a pointer to the variable array which content will be copied to EEPROM |
count | the number of items of type T to be written |
true | if write was successful |
false | if write failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Write one byte to the EEPROM at address
.
address | the location to be written in EEPROM; address is typically obtained as &variable where variable is a global variable that was declared with EEMEM attribute. |
value | the byte value that will be written to EEPROM |
true | if write was successful |
false | if write failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
Write one byte to the EEPROM at address
.
address | the location to be written in EEPROM; address is provided as an absolute location, from 0 to the maximum EEPROM size |
value | the byte value that will be written to EEPROM |
true | if write was successful |
false | if write failed, i.e. if address is outside EEPROM bounds |
|
inlinestatic |
|
inlinestaticconstexpr |
|
inlinestatic |