eeprom.c File Reference

EEPROM driver for 24AA024 (2Kbit) EEPROM device on the DK. More...

#include <stddef.h>
#include "i2cspm.h"
#include "i2cspmconfig.h"
#include "em_gpio.h"
#include "em_i2c.h"
#include "em_device.h"
Include dependency graph for eeprom.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define EEPROM_DVK_LEN   0x100
 Number of bytes in EEPROM.
#define EEPROM_DVK_PAGESIZE   16
 Pagesize in EEPROM.

Functions

static int EEPROM_AckPoll (I2C_TypeDef *i2c, uint8_t addr)
 Do acknowledge polling on EEPROM device.
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.

Detailed Description

EEPROM driver for 24AA024 (2Kbit) EEPROM device on the DK.

Version:
4.0.0

License

(C) Copyright 2014 Silicon Labs, http://www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file eeprom.c.


Define Documentation

#define EEPROM_DVK_LEN   0x100

Number of bytes in EEPROM.

Definition at line 25 of file eeprom.c.

Referenced by EEPROM_Read(), and EEPROM_Write().

#define EEPROM_DVK_PAGESIZE   16

Pagesize in EEPROM.

Definition at line 28 of file eeprom.c.

Referenced by EEPROM_Write().


Function Documentation

static int EEPROM_AckPoll ( I2C_TypeDef *  i2c,
uint8_t  addr 
) [static]

Do acknowledge polling on EEPROM device.

When writing to an EEPROM, the EEPROM device will be busy for some time after issuing a (page) write. During this time, the EEPROM is not accessible, and will therefore not ACK any requests. This feature can be used to determine when the write is actually completed, and is denoted acknowledgement polling.

Note:
This function will not return until the EEPROM device acknowledges (or some sort of I2C failure occurs). If trying to acknowledge poll a non-existing device, NACK will always result and this function will never return. Thus, it should not be used unless the EEPROM device is actually present.
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.
Returns:
Returns 0 when EEPROM acknowledges. Negative value is returned is some sort of error occurred during acknowledgement polling.

Definition at line 63 of file eeprom.c.

References I2CSPM_Transfer().

Referenced by EEPROM_Write().

Here is the call graph for this function:

Here is the caller graph for this function: