EFM32 Jade Gecko 1 Software Documentation  efm32jg1-doc-5.1.2

Detailed Description

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. More...
 
int EEPROM_Write (I2C_TypeDef *i2c, uint8_t addr, unsigned int offset, uint8_t *data, unsigned int len)
 Write data to EEPROM. More...
 

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]i2cPointer to I2C peripheral register block.
[in]addrI2C address for EEPROM, in 8 bit format, where LSB is reserved for R/W bit.
[in]offsetOffset in EEPROM to start reading from.
[out]dataLocation to place read data, must be at least len long.
[in]lenNumber 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 126 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]i2cPointer to I2C peripheral register block.
[in]addrI2C address for EEPROM, in 8 bit format, where LSB is reserved for R/W bit.
[in]offsetOffset in EEPROM to start writing to.
[out]dataLocation holding data to write, must be at least len long.
[in]lenNumber 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 191 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.