STM32F10x library
Functions | Variables
ee_24.c File Reference

24Cxxx EEPROM routines More...

#include <inttypes.h>
#include "i2c.h"
#include "string.h"

Functions

void _delay_ms (uint32_t)
 extern
 
uint8_t ee24_wr (const uint8_t n, uint32_t adr, uint8_t *buf, uint16_t len)
 Write to EE. More...
 
uint8_t ee24_rd (const uint8_t n, uint32_t adr, uint8_t *buf, uint16_t len)
 Read from EE. More...
 

Variables

uint8_t EE24_I2C_ADR = 0xa0
 

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-stm32f1-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.

Function Documentation

uint8_t ee24_rd ( const uint8_t  n,
uint32_t  adr,
uint8_t *  buf,
uint16_t  len 
)

Read from EE.

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

Write to EE.

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

Variable Documentation

uint8_t EE24_I2C_ADR = 0xa0

EE I2C address