|
ESPHome 2025.12.0-dev
|
This class is used to create I2CRegister objects that act as proxies to read/write internal registers on an I2C device. More...
#include <i2c.h>
Public Member Functions | |
| I2CRegister & | operator= (uint8_t value) |
| overloads the = operator. | |
| I2CRegister & | operator&= (uint8_t value) |
| overloads the compound &= operator. | |
| I2CRegister & | operator|= (uint8_t value) |
| overloads the compound |= operator. | |
| operator uint8_t () const | |
| overloads the uint8_t() cast operator to return the I²C register value | |
| uint8_t | get () const |
| returns the register value | |
Protected Member Functions | |
| I2CRegister (I2CDevice *parent, uint8_t a_register) | |
| protected constructor that stores the owning object and the register address. | |
Protected Attributes | |
| I2CDevice * | parent_ |
| I2CDevice object pointer. | |
| uint8_t | register_ |
| the internal address of the register | |
This class is used to create I2CRegister objects that act as proxies to read/write internal registers on an I2C device.
typical usage:
The I²C protocol specifies how to read/write in sets of 8-bits followed by an Acknowledgement (ACK/NACK) from the device receiving the data. How the device interprets the bits read/written can vary greatly from device to device. However most of the devices follow the same protocol for reading/writing 8 bit registers using as implemented in the I2CRegister: after sending the device address, the controller sends one byte with the internal register address and then read or write the specified register content.
|
inlineprotected |
protected constructor that stores the owning object and the register address.
Note as only friends can create an I2CRegister
| parent | our parent |
| a_register | address of the i2c register |
| uint8_t esphome::i2c::I2CRegister::get | ( | ) | const |
|
inlineexplicit |
| I2CRegister & esphome::i2c::I2CRegister::operator&= | ( | uint8_t | value | ) |
| I2CRegister & esphome::i2c::I2CRegister::operator= | ( | uint8_t | value | ) |
| I2CRegister & esphome::i2c::I2CRegister::operator|= | ( | uint8_t | value | ) |
|
protected |
|
protected |