avr-libc  2.1.0
Standard C library for AVR-GCC

AVR Libc Home Page

AVRs

AVR Libc Development Pages

Main Page

User Manual

Library Reference

FAQ

Example Projects

All Data Structures Files Functions Variables Typedefs Enumerations Macros Modules Pages
Macros | Functions
<avr/eeprom.h>: EEPROM handling

Macros

#define EEMEM   __attribute__((section(".eeprom")))
 
#define eeprom_is_ready()
 
#define eeprom_busy_wait()   do {} while (!eeprom_is_ready())
 

Functions

uint8_t eeprom_read_byte (const uint8_t *__p) __ATTR_PURE__
 
uint16_t eeprom_read_word (const uint16_t *__p) __ATTR_PURE__
 
uint32_t eeprom_read_dword (const uint32_t *__p) __ATTR_PURE__
 
float eeprom_read_float (const float *__p) __ATTR_PURE__
 
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_float (float *__p, float __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_float (float *__p, float __value)
 
void eeprom_update_block (const void *__src, void *__dst, size_t __n)
 

IAR C compatibility defines

#define _EEPUT(addr, val)   eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
 
#define __EEPUT(addr, val)   eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
 
#define _EEGET(var, addr)   (var) = eeprom_read_byte ((const uint8_t *)(addr))
 
#define __EEGET(var, addr)   (var) = eeprom_read_byte ((const uint8_t *)(addr))
 

Detailed Description

#include <avr/eeprom.h>

This header file declares the interface to some simple library routines suitable for handling the data EEPROM contained in the AVR microcontrollers. The implementation uses a simple polled mode interface. Applications that require interrupt-controlled EEPROM access to ensure that no time will be wasted in spinloops will have to deploy their own implementation.

Notes:

Macro Definition Documentation

◆ __EEGET

#define __EEGET (   var,
  addr 
)    (var) = eeprom_read_byte ((const uint8_t *)(addr))

Read a byte from EEPROM. Compatibility define for IAR C.

◆ __EEPUT

#define __EEPUT (   addr,
  val 
)    eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))

Write a byte to EEPROM. Compatibility define for IAR C.

◆ _EEGET

#define _EEGET (   var,
  addr 
)    (var) = eeprom_read_byte ((const uint8_t *)(addr))

Read a byte from EEPROM. Compatibility define for IAR C.

◆ _EEPUT

#define _EEPUT (   addr,
  val 
)    eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))

Write a byte to EEPROM. Compatibility define for IAR C.

◆ EEMEM

#define EEMEM   __attribute__((section(".eeprom")))

Attribute expression causing a variable to be allocated within the .eeprom section.

◆ eeprom_busy_wait

#define eeprom_busy_wait ( )    do {} while (!eeprom_is_ready())

Loops until the eeprom is no longer busy.

Returns
Nothing.

◆ eeprom_is_ready

#define eeprom_is_ready ( )
Returns
1 if EEPROM is ready for a new read/write operation, 0 if not.

Function Documentation

◆ eeprom_read_block()

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.

◆ eeprom_read_byte()

uint8_t eeprom_read_byte ( const uint8_t __p)

Read one byte from EEPROM address __p.

◆ eeprom_read_dword()

uint32_t eeprom_read_dword ( const uint32_t __p)

Read one 32-bit double word (little endian) from EEPROM address __p.

◆ eeprom_read_float()

float eeprom_read_float ( const float *  __p)

Read one float value (little endian) from EEPROM address __p.

◆ eeprom_read_word()

uint16_t eeprom_read_word ( const uint16_t __p)

Read one 16-bit word (little endian) from EEPROM address __p.

◆ eeprom_update_block()

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

Update a block of __n bytes to EEPROM address __dst from __src.

Note
The argument order is mismatch with common functions like strcpy().

◆ eeprom_update_byte()

void eeprom_update_byte ( uint8_t __p,
uint8_t  __value 
)

Update a byte __value to EEPROM address __p.

◆ eeprom_update_dword()

void eeprom_update_dword ( uint32_t __p,
uint32_t  __value 
)

Update a 32-bit double word __value to EEPROM address __p.

◆ eeprom_update_float()

void eeprom_update_float ( float *  __p,
float  __value 
)

Update a float __value to EEPROM address __p.

◆ eeprom_update_word()

void eeprom_update_word ( uint16_t __p,
uint16_t  __value 
)

Update a word __value to EEPROM address __p.

◆ eeprom_write_block()

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().

◆ eeprom_write_byte()

void eeprom_write_byte ( uint8_t __p,
uint8_t  __value 
)

Write a byte __value to EEPROM address __p.

◆ eeprom_write_dword()

void eeprom_write_dword ( uint32_t __p,
uint32_t  __value 
)

Write a 32-bit double word __value to EEPROM address __p.

◆ eeprom_write_float()

void eeprom_write_float ( float *  __p,
float  __value 
)

Write a float __value to EEPROM address __p.

◆ eeprom_write_word()

void eeprom_write_word ( uint16_t __p,
uint16_t  __value 
)

Write a word __value to EEPROM address __p.