eeprom.h File Reference

Driver for the 24xx16 and 24xx256 I2C EEPROMS (interface). More...

#include <cfg/compiler.h>
#include <appconfig.h>

Go to the source code of this file.


Defines

#define e2addr(type, field)   ((e2addr_t)&(((type *)0)->field))
 Macro for E2Layout offset calculation.
Values for CONFIG_EEPROM_TYPE
#define EEPROM_24XX16   1
#define EEPROM_24XX256   2

Typedefs

typedef uint16_t e2addr_t
 Type for EEPROM addresses.

Functions

bool eeprom_read (e2addr_t addr, void *buf, size_t count)
 Copy count bytes at address addr from eeprom to RAM to buffer buf.
bool eeprom_write_char (e2addr_t addr, char c)
 Write a single character c at address addr.
int eeprom_read_char (e2addr_t addr)
 Read a single character at address addr.
void eeprom_erase (e2addr_t addr, size_t count)
 Erase specified part of eeprom, writing 0xFF.
void eeprom_init (void)
 Initialize TWI module.

Detailed Description

Driver for the 24xx16 and 24xx256 I2C EEPROMS (interface).

Version:
Id
eeprom.h 1095 2008-02-07 14:50:20Z batt

Author:
Stefano Fedrigo <aleph@develer.com>

Bernardo Innocenti <bernie@develer.com>

Definition in file eeprom.h.


Define Documentation

#define e2addr ( type,
field   )     ((e2addr_t)&(((type *)0)->field))

Macro for E2Layout offset calculation.

Note:
We can't just use offsetof() here because we could use non-constant expressions to access array elements.

'type' is the structure type holding eeprom layout and must be defined in user files.

Definition at line 77 of file eeprom.h.


Function Documentation

void eeprom_erase ( e2addr_t  addr,
size_t  count 
)

Erase specified part of eeprom, writing 0xFF.

Parameters:
addr starting address
count length of block to erase

Definition at line 276 of file eeprom.c.

bool eeprom_read ( e2addr_t  addr,
void *  buf,
size_t  count 
)

Copy count bytes at address addr from eeprom to RAM to buffer buf.

Returns:
true on success.

Definition at line 205 of file eeprom.c.

int eeprom_read_char ( e2addr_t  addr  ) 

Read a single character at address addr.

Returns:
the requested character or -1 in case of failure.

Definition at line 259 of file eeprom.c.