ESPHome
2024.10.3
|
This class is used to create I2CRegister16 objects that act as proxies to read/write internal registers (specified with a 16 bit address) on an I2C device. More...
#include <i2c.h>
Public Member Functions | |
I2CRegister16 & | operator= (uint8_t value) |
overloads the = operator. More... | |
I2CRegister16 & | operator &= (uint8_t value) |
overloads the compound &= operator. More... | |
I2CRegister16 & | operator|= (uint8_t value) |
overloads the compound |= operator. More... | |
operator uint8_t () const | |
overloads the uint8_t() cast operator to return the I²C register value More... | |
uint8_t | get () const |
returns the register value More... | |
Protected Member Functions | |
I2CRegister16 (I2CDevice *parent, uint16_t a_register) | |
protected constructor that store the owning object and the register address. More... | |
Protected Attributes | |
I2CDevice * | parent_ |
I2CDevice object pointer. More... | |
uint16_t | register_ |
the internal 16 bits address of the register More... | |
This class is used to create I2CRegister16 objects that act as proxies to read/write internal registers (specified with a 16 bit address) on an I2C device.
typical usage:
The I²C protocol specification, reads/writes 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 to it can vary greatly from device to device. This class can be used to access in the device 8 bits registers that uses a 16 bits internal address. After sending the device address, the controller sends the internal register address (using two consecutive bytes following the big indian convention) and then read or write the register content.
|
inlineprotected |
protected constructor that store the owning object and the register address.
Only friends can create an I2CRegister16
parent | our parent |
a_register | 16 bits address of the i2c register |
uint8_t esphome::i2c::I2CRegister16::get | ( | ) | const |
I2CRegister16& esphome::i2c::I2CRegister16::operator&= | ( | uint8_t | value | ) |
overloads the compound &= operator.
This allows to reset specific bits of an I²C register
value | used for the & operation |
|
inlineexplicit |
I2CRegister16 & esphome::i2c::I2CRegister16::operator= | ( | uint8_t | value | ) |
I2CRegister16 & esphome::i2c::I2CRegister16::operator|= | ( | uint8_t | value | ) |
|
protected |
|
protected |