eeprom.c File Reference

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

#include <stddef.h>
#include "i2cdrv.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.

Author:
Energy Micro AS
Version:
3.20.0

License

(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. 4. The source and compiled code may only be used on Energy Micro "EFM32" microcontrollers and "EFR4" radios.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no obligation to support this Software. Energy Micro AS is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Energy Micro AS will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file eeprom.c.


Define Documentation

#define EEPROM_DVK_LEN   0x100

Number of bytes in EEPROM.

Definition at line 45 of file eeprom.c.

Referenced by EEPROM_Read(), and EEPROM_Write().

#define EEPROM_DVK_PAGESIZE   16

Pagesize in EEPROM.

Definition at line 48 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 83 of file eeprom.c.

References I2CDRV_Transfer().

Referenced by EEPROM_Write().

Here is the call graph for this function:

Here is the caller graph for this function: