Adafruit ILI9341 Display Library
Public Member Functions | Protected Attributes | List of all members
Adafruit_EEPROM_I2C Class Reference

Class that stores state and functions for interacting with I2C EEPROM chips. More...

#include <Adafruit_EEPROM_I2C.h>

Inheritance diagram for Adafruit_EEPROM_I2C:
Adafruit_FRAM_I2C

Public Member Functions

 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...
 

Protected Attributes

Adafruit_I2CDevice * i2c_dev = NULL
 
uint8_t _addr = 0
 

Detailed Description

Class that stores state and functions for interacting with I2C EEPROM chips.

Constructor & Destructor Documentation

◆ Adafruit_EEPROM_I2C()

Adafruit_EEPROM_I2C::Adafruit_EEPROM_I2C ( void  )

Constructor

Member Function Documentation

◆ begin()

bool Adafruit_EEPROM_I2C::begin ( uint8_t  addr = EEPROM_DEFAULT_ADDRESS,
TwoWire *  theWire = &Wire 
)

Sets up the hardware and initializes I2C.

Parameters
addrThe I2C address to be used.
theWireThe 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]addrThe 16-bit address to write to in EEPROM memory
[in]valueThe 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
addrThe 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]addrThe 16-bit address to write to in EEPROM memory
[in]bufferPointer to buffer of bytes to write
numHow 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
addrThe 16-bit address to read from in EEPROM memory
bufferPointer to buffer of bytes that will be filled!
numHow 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
addrThe 16-bit address to write to in EEPROM memory
valueThe 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
addrThe 16-bit address to write to in EEPROM memory
valueThe address of the templated object we will be writing INTO
Returns
The number of bytes read

Member Data Documentation

◆ 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: