Library to use 25LCxxx chips
Fork of 25LCxxx_SPI by
Diff: Ser25lcxxx.h
- Revision:
- 4:0c31e878a076
- Parent:
- 3:d9429070ea6f
diff -r d9429070ea6f -r 0c31e878a076 Ser25lcxxx.h --- a/Ser25lcxxx.h Mon Jan 14 04:26:13 2013 +0000 +++ b/Ser25lcxxx.h Thu Mar 14 13:19:40 2013 +0000 @@ -42,7 +42,7 @@ @param bytes the size of you eeprom in bytes (NOT bits, eg. a 25LC010 has 128 bytes) @param pagesize the size of a single page, to provide overruns */ - Ser25LCxxx(SPI *spi, PinName enable, int bytes, int pagesize); + Ser25LCxxx(SPI *spi, PinName enable, uint32_t bytes, uint32_t pagesize); /** destroys the handler, and frees the /CS pin @@ -55,7 +55,7 @@ @param len the number of bytes to read (must not exceed the end of memory) @return NULL if the adresses are out of range, the pointer to the data otherwise */ - int* read(unsigned int startAdr, unsigned int len); + uint8_t* read( uint32_t startAdr, uint32_t len); /** writes the give buffer into the memory. This function handles dividing the write into @@ -64,29 +64,29 @@ @param len the number of bytes to read (must not exceed the end of memory) @return false if the adresses are out of range */ - bool write(unsigned int startAdr, unsigned int len, int* data); + bool write( uint32_t startAdr, uint32_t len, const uint8_t* data); /** fills the given page with 0xFF @param pageNum the page number to clear @return if the pageNum is out of range */ - bool clearPage(unsigned int pageNum); + bool clearPage( uint32_t pageNum); /** fills the while eeprom with 0xFF */ void clearMem(); private: - bool writePage(unsigned int startAdr, unsigned int len, int* data); - int readStatus(); + bool writePage( uint32_t startAdr, uint32_t len, const uint8_t* data); + uint8_t readStatus(); void waitForWrite(); void enableWrite(); SPI* _spi; DigitalOut* _enable; - int _size,_pageSize; + uint32_t _size,_pageSize; };