SLS AVR Lib 0.1a
 
Loading...
Searching...
No Matches
eeprom.h File Reference

AVR EEPROM helper. More...

#include <avr/eeprom.h>

Go to the source code of this file.

Typedefs

typedef void * eeprom_adr_t
 

Functions

static void eeprom_read_str (char str[], const eeprom_adr_t adr, const size_t sz)
 Reads a string from EEPROM.
 
static void eeprom_read (void *const data, const eeprom_adr_t adr, const size_t sz)
 eeprom_read_block wrapper
 
static void eeprom_write_str (const char str[], eeprom_adr_t adr, const size_t sz)
 Writes a string to EEPROM.
 
static void eeprom_write (const void *const data, eeprom_adr_t adr, const size_t sz)
 eeprom_update_block wrapper
 

Detailed Description

AVR EEPROM helper.

Author
Simon Litt simon.nosp@m.@1it.nosp@m.t.net https://coding.1itt.net, https://github.com/SimonLitt
#include <sls-avr/eeprom.h>
AVR EEPROM helper.

Typedef Documentation

◆ eeprom_adr_t

typedef void* eeprom_adr_t

Function Documentation

◆ eeprom_read()

static void eeprom_read ( void *const data,
const eeprom_adr_t adr,
const size_t sz )
inlinestatic

eeprom_read_block wrapper

Parameters
[out]datadestination data address
[in]adrEEPROM address
[in]sznumber of bytes to read
Remarks
See https://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.html

◆ eeprom_read_str()

static void eeprom_read_str ( char str[],
const eeprom_adr_t adr,
const size_t sz )
inlinestatic

Reads a string from EEPROM.

Parameters
[out]strdestination string buffer
[in]adrEEPROM address
[in]sznumber of characters to read
Remarks
The size of the string buffer str should be at least (sz + 1)!

◆ eeprom_write()

static void eeprom_write ( const void *const data,
eeprom_adr_t adr,
const size_t sz )
inlinestatic

eeprom_update_block wrapper

Parameters
[in]datasource data address
[out]adrEEPROM address
[in]sznumber of bytes to read
Remarks
See https://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.html

◆ eeprom_write_str()

static void eeprom_write_str ( const char str[],
eeprom_adr_t adr,
const size_t sz )
inlinestatic

Writes a string to EEPROM.

Parameters
[in]strsource string
[out]adrEEPROM address
[in]sznumber of characters to write
Remarks
In order not to write an extra byte, the writed characters length sz can be equal to the length of the str string(terminal null will not be written), but then it needs to use the eeprom_read_str function to correctly read it.