Class that stores state and functions for interacting with I2C EEPROM chips.
More...
#include <Adafruit_EEPROM_I2C.h>
|
| Adafruit_EEPROM_I2C (void) |
|
bool | begin (uint8_t addr=EEPROM_DEFAULT_ADDRESS, TwoWire *theWire=&Wire) |
| Sets up the hardware and initializes I2C. More...
|
|
bool | write (uint16_t addr, uint8_t value) |
| Writes a byte at the specific EEPROM address. More...
|
|
uint8_t | read (uint16_t addr) |
| Reads an 8 bit value from the specified EEPROM address. More...
|
|
bool | write (uint16_t addr, uint8_t *buffer, uint16_t num) |
| Writes multiple bytes at the specific EEPROM address. More...
|
|
bool | read (uint16_t addr, uint8_t *buffer, uint16_t num) |
| Reads multiple bytes from the specified EEPROM address. More...
|
|
template<class T > |
uint16_t | writeObject (uint16_t addr, const T &value) |
| Write any object to memory. More...
|
|
template<class T > |
uint16_t | readObject (uint16_t addr, T &value) |
| Read any object from memory. More...
|
|
Class that stores state and functions for interacting with I2C EEPROM chips.
◆ Adafruit_EEPROM_I2C()
Adafruit_EEPROM_I2C::Adafruit_EEPROM_I2C |
( |
void |
| ) |
|
◆ begin()
Sets up the hardware and initializes I2C.
- Parameters
-
addr | The I2C address to be used. |
theWire | The Wire object to be used for I2C connections. |
- Returns
- True if initialization was successful, otherwise false.
◆ write() [1/2]
bool Adafruit_EEPROM_I2C::write |
( |
uint16_t |
addr, |
|
|
uint8_t |
value |
|
) |
| |
Writes a byte at the specific EEPROM address.
- Parameters
-
[in] | addr | The 16-bit address to write to in EEPROM memory |
[in] | value | The 8-bit value to write at addr |
- Returns
- True on I2C command success, false on timeout or I2C failure
◆ read() [1/2]
uint8_t Adafruit_EEPROM_I2C::read |
( |
uint16_t |
addr | ) |
|
Reads an 8 bit value from the specified EEPROM address.
- Parameters
-
addr | The 16-bit address to read from in EEPROM memory |
- Returns
- The 8-bit value retrieved at addr
◆ write() [2/2]
bool Adafruit_EEPROM_I2C::write |
( |
uint16_t |
addr, |
|
|
uint8_t * |
buffer, |
|
|
uint16_t |
num |
|
) |
| |
Writes multiple bytes at the specific EEPROM address.
- Parameters
-
[in] | addr | The 16-bit address to write to in EEPROM memory |
[in] | buffer | Pointer to buffer of bytes to write |
| num | How many bytes to write! |
- Returns
- True on I2C command success, false on timeout or I2C failure
◆ read() [2/2]
bool Adafruit_EEPROM_I2C::read |
( |
uint16_t |
addr, |
|
|
uint8_t * |
buffer, |
|
|
uint16_t |
num |
|
) |
| |
Reads multiple bytes from the specified EEPROM address.
- Parameters
-
addr | The 16-bit address to read from in EEPROM memory |
buffer | Pointer to buffer of bytes that will be filled! |
num | How many bytes to write! |
- Returns
- The 8-bit value retrieved at addr
◆ writeObject()
template<class T >
uint16_t Adafruit_EEPROM_I2C::writeObject |
( |
uint16_t |
addr, |
|
|
const T & |
value |
|
) |
| |
|
inline |
Write any object to memory.
- Parameters
-
addr | The 16-bit address to write to in EEPROM memory |
value | The templated object we will be writing |
- Returns
- The number of bytes written
◆ readObject()
template<class T >
uint16_t Adafruit_EEPROM_I2C::readObject |
( |
uint16_t |
addr, |
|
|
T & |
value |
|
) |
| |
|
inline |
Read any object from memory.
- Parameters
-
addr | The 16-bit address to write to in EEPROM memory |
value | The address of the templated object we will be writing INTO |
- Returns
- The number of bytes read
◆ i2c_dev
Adafruit_I2CDevice* Adafruit_EEPROM_I2C::i2c_dev = NULL |
|
protected |
The internal I2C device for communication
◆ _addr
uint8_t Adafruit_EEPROM_I2C::_addr = 0 |
|
protected |
The I2C address, sometimes needed!
The documentation for this class was generated from the following files: