avr_eeprom(3avr)

πŸ“¦
version 2.2.1 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– avr_eeprom β€” the avr/eeprom.h glow-up πŸ’–

okay bestie, this is the manual page avr_eeprom(3avr) and it's literally all about handling the EEPROM on your AVR microcontroller. yes, the little non-volatile memory guy. let's get into it 🫢

NAME

avr_eeprom β€” <avr/eeprom.h>: EEPROM handling ✨


SYNOPSIS

Macros

#define EEMEM   __attribute__((__section__('.eeprom')))
#define eeprom_is_ready()
#define eeprom_busy_wait()

Functions

uint8_t eeprom_read_byte (const uint8_t *__p)
uint16_t eeprom_read_word (const uint16_t *__p)
uint32_t eeprom_read_dword (const uint32_t *__p)
uint64_t eeprom_read_qword (const uint64_t *__p)
float eeprom_read_float (const float *__p)
double eeprom_read_double (const double *__p)
long double eeprom_read_long_double (const long double *__p)
void eeprom_read_block (void *__dst, const void *__src, size_t __n)
void eeprom_write_byte (uint8_t *__p, uint8_t __value)
void eeprom_write_word (uint16_t *__p, uint16_t __value)
void eeprom_write_dword (uint32_t *__p, uint32_t __value)
void eeprom_write_qword (uint64_t *__p, uint64_t __value)
void eeprom_write_float (float *__p, float __value)
void eeprom_write_double (double *__p, double __value)
void eeprom_write_long_double (long double *__p, long double __value)
void eeprom_write_block (const void *__src, void *__dst, size_t __n)
void eeprom_update_byte (uint8_t *__p, uint8_t __value)
void eeprom_update_word (uint16_t *__p, uint16_t __value)
void eeprom_update_dword (uint32_t *__p, uint32_t __value)
void eeprom_update_qword (uint64_t *__p, uint64_t __value)
void eeprom_update_float (float *__p, float __value)
void eeprom_update_double (double *__p, double __value)
void eeprom_update_long_double (long double *__p, long double __value)
void eeprom_update_block (const void *__src, void *__dst, size_t __n)

IAR C compatibility defines

#define _EEPUT(addr,  val)
#define __EEPUT(addr,  val)
#define _EEGET(var,  addr)
#define __EEGET(var,  addr)

Detailed Description 🌸

#include <avr/eeprom.h>

so basically this header file declares the interface to some simple library routines that are suitable for handling the data EEPROM contained in the AVR microcontrollers πŸ’… the implementation uses a simple polled mode interface. if your app needs interrupt-controlled EEPROM access so that no time gets wasted in spinloops, you're gonna have to deploy your own implementation, bestie β€” this one is not gonna do that for you.

Notes:

  • πŸ’€ besides the write functions there's also a set of update ones. these functions read each byte first and skip the burning if the old value is the same as the new one. the scaning direction goes from high address to low, so you get a quick return in the common cases.
  • βŒ› all of the read/write functions first make sure the EEPROM is ready to be accessed. and like, this may cause long delays if a write operation is still pending, so time-critical applications should first poll the EEPROM β€” e.g. using eeprom_is_ready() β€” before attempting any actual I/O. BUT. this functions does not wait until SELFPRGEN in SPMCSR becomes zero. do that manually if your softwate contains the Flash burning.
  • πŸ™ˆ since these functions modify IO registers, they are known to be non-reentrant. if any of these functions get used from both standard and interrupt context, the applications must ensure proper protection (e.g. by disabling interrupts before accessing them). no cap.
  • ✍️ all write functions force erase_and_write programming mode.
  • πŸ¦‹ for Xmega the EEPROM start address is 0, like other architectures. the reading functions add the 0x2000 value to use EEPROM mapping into data space.

Macro Definition Documentation πŸ“–

#define __EEGET( var, addr)

Value:

(var) = eeprom_read_byte ((const uint8_t *)(addr))

read a byte from EEPROM. compatibility define for IAR C ✨

#define __EEPUT( addr, val)

Value:

eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))

write a byte to EEPROM. compatibility define for IAR C ✨

#define _EEGET( var, addr)

Value:

(var) = eeprom_read_byte ((const uint8_t *)(addr))

read a byte from EEPROM. compatibility define for IAR C ✨

#define _EEPUT( addr, val)

Value:

eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))

write a byte to EEPROM. compatibility define for IAR C ✨

#define EEMEM __attribute__((__section__('.eeprom')))

an attribute expression that causes a variable to be allocated within the .eeprom section πŸ‘‘

#define eeprom_busy_wait()

Value:

do {} while (!eeprom_is_ready())

loops until the eeprom is no longer busy πŸŒ€

Returns

nothing. that's it. that's the return. πŸ’€

#define eeprom_is_ready()

Returns

1 if EEPROM is ready for a new read/write operation, 0 if not βœ…


Function Documentation πŸŽ€

void eeprom_read_block (void * __dst, const void * __src, size_t __n)

read a block of __n bytes from EEPROM address __src to SRAM __dst πŸ“¦

uint8_t eeprom_read_byte (const uint8_t * __p)

read one byte from EEPROM address __p πŸ“

double eeprom_read_double (const double * __p)

read one double value (little endian) from EEPROM address __p 🌈

uint32_t eeprom_read_dword (const uint32_t * __p)

read one 32-bit double word (little endian) from EEPROM address __p 🌈

float eeprom_read_float (const float * __p)

read one float value (little endian) from EEPROM address __p 🌈

long double eeprom_read_long_double (const long double * __p)

read one long double value (little endian) from EEPROM address __p 🌈

uint64_t eeprom_read_qword (const uint64_t * __p)

read one 64-bit quad word (little endian) from EEPROM address __p 🌈

uint16_t eeprom_read_word (const uint16_t * __p)

read one 16-bit word (little endian) from EEPROM address __p 🌈

void eeprom_update_block (const void * __src, void * __dst, size_t __n)

update a block of __n bytes at EEPROM address __dst from __src 🧚

Note β€” the argument order is mismatch with common functions like strcpy(). yes it's giving chaotic energy but it is what it is πŸ™ˆ

void eeprom_update_byte (uint8_t * __p, uint8_t __value)

update a byte __value at EEPROM address __p πŸ’–

void eeprom_update_double (double * __p, double __value)

update a double __value at EEPROM address __p πŸ’–

void eeprom_update_dword (uint32_t * __p, uint32_t __value)

update a 32-bit double word __value at EEPROM address __p πŸ’–

void eeprom_update_float (float * __p, float __value)

update a float __value at EEPROM address __p πŸ’–

void eeprom_update_long_double (long double * __p, long double __value)

update a long double __value at EEPROM address __p πŸ’–

void eeprom_update_qword (uint64_t * __p, uint64_t __value)

update a 64-bit quad word __value at EEPROM address __p πŸ’–

void eeprom_update_word (uint16_t * __p, uint16_t __value)

update a word __value at EEPROM address __p πŸ’–

void eeprom_write_block (const void * __src, void * __dst, size_t __n)

write a block of __n bytes to EEPROM address __dst from __src πŸ“

Note β€” the argument order is mismatch with common functions like strcpy(). again. iconic behavior of this header tbh πŸ™ˆ

void eeprom_write_byte (uint8_t * __p, uint8_t __value)

write a byte __value to EEPROM address __p πŸ”₯

void eeprom_write_double (double * __p, double __value)

write a double __value to EEPROM address __p πŸ”₯

void eeprom_write_dword (uint32_t * __p, uint32_t __value)

write a 32-bit double word __value to EEPROM address __p πŸ”₯

void eeprom_write_float (float * __p, float __value)

write a float __value to EEPROM address __p πŸ”₯

void eeprom_write_long_double (long double * __p, long double __value)

write a long double __value to EEPROM address __p πŸ”₯

void eeprom_write_qword (uint64_t * __p, uint64_t __value)

write a 64-bit quad word __value to EEPROM address __p πŸ”₯

void eeprom_write_word (uint16_t * __p, uint16_t __value)

write a word __value to EEPROM address __p πŸ”₯


Author ✍️

Generated automatically by Doxygen for AVR-LibC from the source code. (so nobody hand-wrote this, it's a robot bestie doing its little robot thing πŸ€–πŸ’…)


and that's the whole page, bestie!! this was AVR-LibC Version 2.2.1 and the manual page is avr_eeprom(3avr) β€” go flash something cute, protect your interrupt sections, and remember: EEMEM is your moment. mwah πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from