ESPHome
2024.12.2
|
WeikaiRegister objects acts as proxies to access remote register independently of the bus type. More...
#include <weikai.h>
Public Member Functions | |
WeikaiRegister (WeikaiComponent *const comp, uint8_t reg, uint8_t channel) | |
WeikaiRegister constructor. More... | |
virtual | ~WeikaiRegister () |
WeikaiRegister & | operator= (uint8_t value) |
overloads the = operator. More... | |
WeikaiRegister & | operator &= (uint8_t value) |
overloads the compound &= operator. More... | |
WeikaiRegister & | operator|= (uint8_t value) |
overloads the compound |= operator. More... | |
operator uint8_t () const | |
cast operator that returns the content of the weikai register More... | |
virtual uint8_t | read_reg () const =0 |
reads the register More... | |
virtual void | write_reg (uint8_t value)=0 |
writes the register More... | |
virtual void | read_fifo (uint8_t *data, size_t length) const =0 |
read an array of bytes from the receiver fifo More... | |
virtual void | write_fifo (uint8_t *data, size_t length)=0 |
write an array of bytes to the transmitter fifo More... | |
Data Fields | |
WeikaiComponent *const | comp_ |
pointer to our parent (aggregation) More... | |
uint8_t | register_ |
address of the register More... | |
uint8_t | channel_ |
channel for this register More... | |
WeikaiRegister objects acts as proxies to access remote register independently of the bus type.
This is an abstract interface class that provides many operations to access to registers while hiding the actual implementation. This allow to accesses the registers in the Weikai component abstract class independently of the actual bus (I2C, SPI). The derived classes will actually implements the specific bus operations dependant of the bus used.
typical usage of WeikaiRegister:
|
inline |
WeikaiRegister constructor.
comp | our parent WeikaiComponent |
reg | address of the register |
channel | the channel of this register |
|
inlinevirtual |
WeikaiRegister& esphome::weikai::WeikaiRegister::operator&= | ( | uint8_t | value | ) |
overloads the compound &= operator.
This is often used to reset bits in the weikai register
value | performs an & operation with value and store the result |
|
inline |
WeikaiRegister & esphome::weikai::WeikaiRegister::operator= | ( | uint8_t | value | ) |
overloads the = operator.
This is used to set a value into the weikai register
value | to be set |
Definition at line 136 of file weikai.cpp.
WeikaiRegister & esphome::weikai::WeikaiRegister::operator|= | ( | uint8_t | value | ) |
overloads the compound |= operator.
This is often used to set bits in the weikai register
value | performs an | operation with value and store the result |
Definition at line 147 of file weikai.cpp.
|
pure virtual |
read an array of bytes from the receiver fifo
data | pointer to data buffer |
length | number of bytes to read |
Implemented in esphome::weikai_i2c::WeikaiRegisterI2C, and esphome::weikai_spi::WeikaiRegisterSPI.
|
pure virtual |
reads the register
Implemented in esphome::weikai_i2c::WeikaiRegisterI2C, and esphome::weikai_spi::WeikaiRegisterSPI.
|
pure virtual |
write an array of bytes to the transmitter fifo
data | pointer to data buffer |
length | number of bytes to write |
Implemented in esphome::weikai_i2c::WeikaiRegisterI2C, and esphome::weikai_spi::WeikaiRegisterSPI.
|
pure virtual |
writes the register
value | to write in the register |
Implemented in esphome::weikai_i2c::WeikaiRegisterI2C, and esphome::weikai_spi::WeikaiRegisterSPI.
uint8_t esphome::weikai::WeikaiRegister::channel_ |
WeikaiComponent* const esphome::weikai::WeikaiRegister::comp_ |
uint8_t esphome::weikai::WeikaiRegister::register_ |