Defines | |
#define | EE_BAUD(CLOCK, BAUD) ( ((CLOCK / BAUD) / 4) - 1 ) |
#define | XEEBeginWrite(control, address) XEESetAddr(control, address) |
Typedefs | |
typedef unsigned short int | XEE_ADDR |
typedef enum _XEE_RESULT | XEE_RESULT |
Enumerations | |
enum | _XEE_RESULT { XEE_SUCCESS = 0, XEE_READY = 0, XEE_BUS_COLLISION, XEE_NAK, XEE_VERIFY_ERR, XEE_BUSY } |
Functions | |
BYTE | XEEBeginRead (unsigned char control, XEE_ADDR address) |
BYTE | XEEEndRead (void) |
BYTE | XEEEndWrite (void) |
void | XEEInit (unsigned char baud) |
BYTE | XEEIsBusy (unsigned char control) |
unsigned char | XEERead (void) |
BYTE | XEEReadArray (unsigned char control, XEE_ADDR address, unsigned char *buffer, unsigned char length) |
BYTE | XEESetAddr (unsigned char control, XEE_ADDR address) |
BYTE | XEEWrite (unsigned char val) |
#define EE_BAUD | ( | CLOCK, | |||
BAUD | ) | ( ((CLOCK / BAUD) / 4) - 1 ) |
#define XEEBeginWrite | ( | control, | |||
address | ) | XEESetAddr(control, address) |
Sets up internal address counter of EEPROM.
This function does not release the I2C bus. User must close XEEEndWrite() after this function is called to relase the I2C bus.
control | data EEPROM control code | |
address | address to where to write |
typedef unsigned short int XEE_ADDR |
typedef enum _XEE_RESULT XEE_RESULT |
enum _XEE_RESULT |
Sets internal address counter to given address. Puts EEPROM in sequential read mode.
This function does not release I2C bus. User must call XEEEndRead() when read is not longer needed; I2C bus will released after XEEEndRead() is called.
control | EEPROM control and address code. | |
address | Address at which read is to be performed. |
BYTE XEEEndRead | ( | void | ) |
Ends sequential read cycle.
This function ends seuential cycle that was in progress. It releases I2C bus.
BYTE XEEEndWrite | ( | void | ) |
Instructs EEPROM to begin write cycle.
Call this function after either page full of bytes written or no more bytes are left to load. This function initiates the write cycle. User must execute following code after calling this function to ensure that write cycle is finished before calling any other routine: while( XEEIsBusy(EEPROM_CONTROL) ); //Wait until write delay is finished - takes up to 5ms
void XEEInit | ( | unsigned char | baud | ) |
Overview: Initialize I2C module to communicate to serial EEPROM.
baud | - SSPADD value for bit rate. |
BYTE XEEIsBusy | ( | unsigned char | control | ) |
Requests ack from EEPROM.
control | EEPROM control and address code. |
unsigned char XEERead | ( | void | ) |
Reads next byte from EEPROM; internal address is incremented by one.
This function does not release I2C bus. User must call XEEEndRead() when read is not longer needed; I2C bus will released after XEEEndRead() is called.
BYTE XEEReadArray | ( | unsigned char | control, | |
XEE_ADDR | address, | |||
unsigned char * | buffer, | |||
unsigned char | length | |||
) |
Reads desired number of bytes in sequential mode. This function performs all necessary steps and releases the bus when finished.
control | EEPROM control and address code. | |
address | Address from where array is to be read | |
buffer | Caller supplied buffer to hold the data | |
length | Number of bytes to read. |
Modifies internal address counter of EEPROM.
This function does not release the I2C bus. User must close XEEClose() after this function is called.
control | data EEPROM control code | |
address | address to be set |
BYTE XEEWrite | ( | unsigned char | val | ) |
Writes given value 'val' at current address. Current address is set by XEEBeginWrite() and is incremented by every XEEWrite().
This function does not initiate the write cycle; it simply loads given value into internal page buffer. This function does not release the I2C bus. User must close XEEEndWrite() after this function is called to relase the I2C bus.
val | Value to be written |