XBee Firmware Library  1.6.0
Functions
25AAxxxx/25LCxxxx EEPROM

Functions

ssize_t eeprom_spi_command (eeprom_25xxx_t eeprom, uint8_t *cmd, uint8_t len)
 Sends a generic command to the SPI memory. More...
 
ssize_t eeprom_spi_erase (eeprom_25xxx_t eeprom, uint32_t addr, size_t len)
 Erases an array of bytes in the EEPROM. Erase Page command is used. More...
 
ssize_t eeprom_spi_read (eeprom_25xxx_t eeprom, void *rxbuf, uint32_t addr, size_t len)
 Reads the specified number of bytes from the EEPROM. More...
 
ssize_t eeprom_spi_read_status (eeprom_25xxx_t eeprom)
 Reads the status register of the memory. More...
 
ssize_t eeprom_spi_write (eeprom_25xxx_t eeprom, uint8_t *data, uint32_t addr, size_t len)
 Writes an array of bytes in the EEPROM. More...
 
ssize_t eeprom_spi_write_enable (eeprom_25xxx_t eeprom)
 Sets the Write-Enable Latch in the memory. More...
 

Detailed Description

Platform-specific layer provides a consistent Virtual EEPROM API to upper layers of the driver.

EEPROM API Overview

This API contains the functions to initialize and control 25AAxxxx/25LCxxxx family of EEPROMs (25xx010/25xx020/25xx040/25xx080/25xx160/25xx320/25xx640/25xx128/25xx256/25xx512/25xx1024) of for the Programmable XBee devices. These EEPROMs are user-modifiable read-only memories (ROM) that are connected to the XBee modules trough the SPI interface. They can be erased and reprogrammed (written to) repeatedly.

Platform-specific layer provides a consistent MACROS API to upper layers of the driver.

25AA/25LC SPI EEPROMs macros

The 25AA/25LC EEPROMs have 11 commands, which may be used along the eeprom_spi_command() function. Such commands are defined by the following macros: -SPI EEPROM 25AA/25LC commands:

Also, the status-register's bits are defined by the following macros: -SPI EEPROM 25AA/25LC status register bits:

Function Documentation

ssize_t eeprom_spi_command ( eeprom_25xxx_t  eeprom,
uint8_t cmd,
uint8_t  len 
)

Sends a generic command to the SPI memory.

Parameters
[in]eepromeeprom index to configure (use the name of the component defined by the config.xml)
[in]cmdbuffer containing the bytes to be written. This may be one of the 25AA/25LC SPI EEPROMs macros defined.
[in]lennumber of bytes to write from the buffer.
Return values
<0if there is an error while writing in the EEPROM.
ssize_t eeprom_spi_erase ( eeprom_25xxx_t  eeprom,
uint32_t  addr,
size_t  len 
)

Erases an array of bytes in the EEPROM. Erase Page command is used.

Parameters
[in]eepromeeprom index to configure (use the name of the component defined by the config.xml)
[in]addraddress of the EEPROM to start the erasing process.
[in]lennumber of bytes to write from the buffer.
Return values
ssize_tnumber of bytes that were erased.
ERANGEout of range
<0if there is an error while erasing in the EEPROM.
ssize_t eeprom_spi_read ( eeprom_25xxx_t  eeprom,
void *  rxbuf,
uint32_t  addr,
size_t  len 
)

Reads the specified number of bytes from the EEPROM.

Parameters
[in]eepromeeprom index to configure (use the name of the component defined by the config.xml)
[out]rxbufbuffer where the read bytes will be stored.
[in]addraddress of the EEPROM to start reading from.
[in]lennumber of bytes to read from the EEPROM.
Return values
ssize_tthe number of bytes read.
ERANGEout of range.
<0if there is an error while reading the EEPROM.
ssize_t eeprom_spi_read_status ( eeprom_25xxx_t  eeprom)

Reads the status register of the memory.

Parameters
[in]eepromeeprom index to configure (use the name of the component defined by the config.xml)
[in]cmdbuffer containing the bytes to be written.
[in]lennumber of bytes to write from the buffer.
Return values
Returnsthe status register.
<0if there is an error while writing in the EEPROM.
ssize_t eeprom_spi_write ( eeprom_25xxx_t  eeprom,
uint8_t data,
uint32_t  addr,
size_t  len 
)

Writes an array of bytes in the EEPROM.

Parameters
[in]eepromeeprom index to configure (use the name of the component defined by the config.xml)
[in]databuffer containing the bytes to be written.
[in]addraddress of the EEPROM to start the writing process.
[in]lennumber of bytes to write from the buffer.
Return values
ssize_tnumber of bytes that where written.
ERANGEout of range
<0if there is an error while writing in the EEPROM.
ssize_t eeprom_spi_write_enable ( eeprom_25xxx_t  eeprom)

Sets the Write-Enable Latch in the memory.

Parameters
[in]eepromeeprom index to configure (use the name of the component defined by the config.xml)
Return values
<0if there is an error while writing in the EEPROM.