EepromKit Drivers

Macros

#define EEPROM_DVK_ADDR 0xA0

Functions

int EEPROM_Read ( I2C_TypeDef *i2c, uint8_t addr, unsigned int offset, uint8_t *data, unsigned int len)
Read data from EEPROM.
int EEPROM_Write ( I2C_TypeDef *i2c, uint8_t addr, unsigned int offset, uint8_t *data, unsigned int len)
Write data to EEPROM.

Macro Definition Documentation

#define EEPROM_DVK_ADDR   0xA0

I2C device address for EEPROM on DK

Definition at line 40 of file eeprom.h .

Function Documentation

int EEPROM_Read ( I2C_TypeDef * i2c,
uint8_t addr,
unsigned int offset,
uint8_t * data,
unsigned int len
)

Read data from EEPROM.

Parameters
[in] i2c Pointer to I2C peripheral register block.
[in] addr I2C address for EEPROM, in 8 bit format, where LSB is reserved for R/W bit.
[in] offset Offset in EEPROM to start reading from.
[out] data Location to place read data, must be at least len long.
[in] len Number of bytes to read.
Returns
Returns number of bytes read. Less than specified number of bytes is returned if reading beyond end of EEPROM. Negative value is returned is some sort of error occurred during read.

Definition at line 118 of file eeprom.c .

References I2C_TransferSeq_TypeDef::addr , I2C_TransferSeq_TypeDef::buf , I2C_TransferSeq_TypeDef::data , EEPROM_DVK_LEN , I2C_TransferSeq_TypeDef::flags , I2C_FLAG_WRITE_READ , I2CSPM_Transfer() , i2cTransferDone , and I2C_TransferSeq_TypeDef::len .

int EEPROM_Write ( I2C_TypeDef * i2c,
uint8_t addr,
unsigned int offset,
uint8_t * data,
unsigned int len
)

Write data to EEPROM.

Parameters
[in] i2c Pointer to I2C peripheral register block.
[in] addr I2C address for EEPROM, in 8 bit format, where LSB is reserved for R/W bit.
[in] offset Offset in EEPROM to start writing to.
[out] data Location holding data to write, must be at least len long.
[in] len Number of bytes to write.
Returns
Returns number of bytes written. Less than specified number of bytes is returned if writing beyond end of EEPROM. Negative value is returned is some sort of error occurred during write.

Definition at line 179 of file eeprom.c .

References I2C_TransferSeq_TypeDef::addr , I2C_TransferSeq_TypeDef::buf , I2C_TransferSeq_TypeDef::data , EEPROM_AckPoll() , EEPROM_DVK_LEN , EEPROM_DVK_PAGESIZE , I2C_TransferSeq_TypeDef::flags , I2C_FLAG_WRITE_WRITE , I2CSPM_Transfer() , i2cTransferDone , and I2C_TransferSeq_TypeDef::len .