#include <EepromAbstractionWire.h>
Public Member Functions | |
I2cAt24Eeprom (uint8_t address, At24EepromType ty, WireType wireImpl=defaultWireTypePtr) | |
bool | hasErrorOccurred () override |
uint8_t | read8 (EepromPosition position) override |
void | write8 (EepromPosition position, uint8_t val) override |
uint16_t | read16 (EepromPosition position) override |
void | write16 (EepromPosition position, uint16_t val) override |
uint32_t | read32 (EepromPosition position) override |
void | write32 (EepromPosition position, uint32_t val) override |
void | readIntoMemArray (uint8_t *memDest, EepromPosition romSrc, uint8_t len) override |
void | writeArrayToRom (EepromPosition romDest, const uint8_t *memSrc, uint8_t len) override |
An implementation of eeprom that works with the very well known At24CXXX chips over i2c. Before using this class you must first initialise the Wire library by calling Wire.begin(); If you do not do this, your code may hang. Further, avoid any call to read or write until at least the setup() function is called. This is a limitation of the way the Wire library gets constructed.
It is your responsibility to call Wire.begin because you don't want more than one class reinitialising the Wire library.
Thanks to https://github.com/cyberp/AT24Cx for some of the ideas I've used in this library, although this is implemented differently.
I2cAt24Eeprom::I2cAt24Eeprom | ( | uint8_t | address, |
At24EepromType | ty, | ||
WireType | wireImpl = defaultWireTypePtr |
||
) |
Create an I2C EEPROM object giving it's address and the page size of the device. Page sizes are defined in this header file.
|
overridevirtual |
This indicates if an I2C error has ocrrued at any point since the last call to error. Side effect: Every call clears it's state.
Reimplemented from EepromAbstraction.
|
overridevirtual |
Read an 8 bit (byte) value at a specified position
position | address at which to read |
Implements EepromAbstraction.
|
overridevirtual |
write an 8 bit (byte) value to the specified position
position | the position at which to write |
val | the new value |
Implements EepromAbstraction.
|
overridevirtual |
read a 16 bit value at position at a specified position
position | the position at which to read |
Implements EepromAbstraction.
|
overridevirtual |
write a 16 bit value to the specified position
position | the position at which to write |
val | the value to read |
Implements EepromAbstraction.
|
overridevirtual |
read a 32 bit value at a specified position
position | the position at which to read |
Implements EepromAbstraction.
|
overridevirtual |
write a 32 bit value to position
position | the position at which to write |
val | the value to write out. |
Implements EepromAbstraction.
|
overridevirtual |
Read an array of bytes from EEPROM into memory
memDest | the memory where the EEPROM data should be copied to |
romSrc | the source position in EEPROM storage |
len | the length of the array |
Implements EepromAbstraction.
|
overridevirtual |
Writes an array of bytes from memory to EEPROM storage
romDest | the start position in eeprom storage that the array should be copied to |
memSrc | the memory where the rom should be copied from |
len | the length of the array |
Implements EepromAbstraction.