AVR library
Macros | Functions
ee_24.c File Reference

24Cxxx EEPROM routines More...

#include <inttypes.h>
#include <avr/io.h>
#include "i2c.h"
#include "string.h"

Macros

#define EE24_I2C_ADR   0xa0
 

Functions

void ee24_init (uint8_t br)
 Presently only calls i2c_init. More...
 
uint8_t ee24_wr (uint16_t adr, uint8_t *buf, uint8_t len)
 Write to EE. More...
 
uint8_t ee24_rd (uint16_t adr, uint8_t *buf, uint8_t len)
 Read from EE. More...
 

Detailed Description

24Cxxx EEPROM routines

Author
Matej Kogovsek (matej.nosp@m.@ham.nosp@m.radio.nosp@m..si)
Note
This file is part of mat-avr-lib
Tested with 24C256.
Warning
The code assumes 16 bit (2 byte) EE data addressing. Devices with more than 65kByte (or less than 256) will require code change.

Macro Definition Documentation

#define EE24_I2C_ADR   0xa0

EE I2C address

Function Documentation

void ee24_init ( uint8_t  br)

Presently only calls i2c_init.

Parameters
[in]brI2C baudrate passed to i2c_init
uint8_t ee24_rd ( uint16_t  adr,
uint8_t *  buf,
uint8_t  len 
)

Read from EE.

Parameters
[in]adrStarting byte address
[in]bufPointer to caller allocated buffer
[in]lenNumber of bytes to read (len <= sizeof(buf))
Returns
Same as i2c_readbuf
uint8_t ee24_wr ( uint16_t  adr,
uint8_t *  buf,
uint8_t  len 
)

Write to EE.

Parameters
[in]adrStarting byte address
[in]bufPointer to data
[in]lenNumber of bytes to write (len <= sizeof(buf))
Returns
Same as i2c_writebuf