Enhanced EEPROM 25LCxxx driver
Fork of 25LCxxx_SPI by
Ser25LCxxx Class Reference
A class to read and write all 25* serial SPI eeprom devices from Microchip (from 25xx010 to 25xx1024). More...
#include <Ser25lcxxx.h>
Public Member Functions | |
Ser25LCxxx (PinName sck, PinName si, PinName so, PinName enable, int pagenumber, int pagesize) | |
Create the handler class. | |
~Ser25LCxxx () | |
Destroy the handler. | |
unsigned int | read (unsigned int startAdr, unsigned int len, unsigned char *buf) |
Read from the eeprom memory. | |
unsigned int | write (unsigned int startAdr, unsigned int len, const unsigned char *data) |
Writes the give buffer into the eeprom memory. | |
unsigned int | clearPage (unsigned int pageNum) |
Fills the given page with EEPROM_CLEAN_BYTE. | |
unsigned int | clearMem () |
Fills the whole eeprom with EEPROM_CLEAN_BYTE. | |
bool | isWriteInProgress () |
Return TRUE if a write is performing. | |
bool | isFullyWritable () |
Return TRUE if the entire eeprom memory is writable. | |
bool | isHalfWritable () |
Return TRUE if only the first half of the eeprom memory is writable. | |
bool | isNotWritable () |
Return TRUE if the eeprom memory is not writable. | |
void | setNotWritable () |
Set the eeprom memory not writable. | |
void | setFullyWritable () |
Set the eeprom memory fully writable. | |
void | setHalfWritable () |
Set only the first half of the eeprom memory as writable. |
Detailed Description
A class to read and write all 25* serial SPI eeprom devices from Microchip (from 25xx010 to 25xx1024).
One needs to provide total size and page size, since this cannot be read from the devices, and the page size differs even by constant size (look up the data sheet for your part!)
Definition at line 51 of file Ser25lcxxx.h.
Constructor & Destructor Documentation
Ser25LCxxx | ( | PinName | sck, |
PinName | si, | ||
PinName | so, | ||
PinName | enable, | ||
int | pagenumber, | ||
int | pagesize | ||
) |
Create the handler class.
- Parameters:
-
sck clock pin of the spi where the eeprom is connected si input pin of the spi where the eeprom is connected so output pin of the spi where the eeprom is connected enable the pin name for the port where /CS is connected pagenumber number of pages pagesize the size of each page
Definition at line 30 of file Ser25lcxxx.cpp.
~Ser25LCxxx | ( | ) |
Destroy the handler.
Definition at line 71 of file Ser25lcxxx.h.
Member Function Documentation
unsigned int clearMem | ( | ) |
Fills the whole eeprom with EEPROM_CLEAN_BYTE.
- Returns:
- the number of written bytes (it should be the eeprom size)
Definition at line 150 of file Ser25lcxxx.cpp.
unsigned int clearPage | ( | unsigned int | pageNum ) |
Fills the given page with EEPROM_CLEAN_BYTE.
- Parameters:
-
pageNum the page to clear
- Returns:
- the number of written bytes (it should be the page size)
Definition at line 143 of file Ser25lcxxx.cpp.
bool isFullyWritable | ( | ) |
Return TRUE if the entire eeprom memory is writable.
Definition at line 121 of file Ser25lcxxx.h.
bool isHalfWritable | ( | ) |
Return TRUE if only the first half of the eeprom memory is writable.
Definition at line 128 of file Ser25lcxxx.h.
bool isNotWritable | ( | ) |
Return TRUE if the eeprom memory is not writable.
Definition at line 135 of file Ser25lcxxx.h.
bool isWriteInProgress | ( | ) |
Return TRUE if a write is performing.
Definition at line 114 of file Ser25lcxxx.h.
unsigned int read | ( | unsigned int | startAdr, |
unsigned int | len, | ||
unsigned char * | buf | ||
) |
Read from the eeprom memory.
- Parameters:
-
startAdr the adress where to start reading len the number of bytes to read buf destination buffer
- Returns:
- number of read bytes
Definition at line 41 of file Ser25lcxxx.cpp.
void setFullyWritable | ( | ) |
Set the eeprom memory fully writable.
Definition at line 149 of file Ser25lcxxx.h.
void setHalfWritable | ( | ) |
Set only the first half of the eeprom memory as writable.
Definition at line 156 of file Ser25lcxxx.h.
void setNotWritable | ( | ) |
Set the eeprom memory not writable.
Definition at line 142 of file Ser25lcxxx.h.
unsigned int write | ( | unsigned int | startAdr, |
unsigned int | len, | ||
const unsigned char * | data | ||
) |
Writes the give buffer into the eeprom memory.
- Parameters:
-
startAdr the eeprom adress where to start writing (it doesn't have to match a page boundary) len number of bytes to write data data to write
- Returns:
- the number of written bytes
Definition at line 79 of file Ser25lcxxx.cpp.
Generated on Sun Jul 24 2022 01:34:27 by
