76template <
typename Derived>
87 bool Write(uint8_t addr, uint8_t reg,
const uint8_t* data,
size_t len)
noexcept {
88 return static_cast<Derived*
>(
this)->
Write(addr, reg, data, len);
99 bool Read(uint8_t addr, uint8_t reg, uint8_t* data,
size_t len)
noexcept {
100 return static_cast<Derived*
>(
this)->
Read(addr, reg, data, len);
CRTP-based template interface for I2C bus operations.
Definition pca9685_i2c_interface.hpp:77
I2cInterface & operator=(I2cInterface &&)=delete
Move assignment deleted (non-movable).
void GpioSetInactive(CtrlPin pin) noexcept
Deassert a control pin (set to INACTIVE).
Definition pca9685_i2c_interface.hpp:155
I2cInterface(const I2cInterface &)=delete
Copy constructor deleted (non-copyable; avoids slicing).
I2cInterface()=default
Protected constructor to prevent direct instantiation.
~I2cInterface()=default
Protected destructor.
bool Write(uint8_t addr, uint8_t reg, const uint8_t *data, size_t len) noexcept
Write bytes to a device register.
Definition pca9685_i2c_interface.hpp:87
bool Read(uint8_t addr, uint8_t reg, uint8_t *data, size_t len) noexcept
Read bytes from a device register.
Definition pca9685_i2c_interface.hpp:99
bool EnsureInitialized() noexcept
Ensure the I2C bus is initialized and ready for communication.
Definition pca9685_i2c_interface.hpp:114
I2cInterface(I2cInterface &&)=delete
Move constructor deleted (non-movable; use derived type to move).
void GpioSetActive(CtrlPin pin) noexcept
Assert a control pin (set to ACTIVE).
Definition pca9685_i2c_interface.hpp:147
void GpioSet(CtrlPin pin, GpioSignal signal) noexcept
Set a control pin to the specified signal state.
Definition pca9685_i2c_interface.hpp:138
I2cInterface & operator=(const I2cInterface &)=delete
Copy assignment deleted (non-copyable).
Definition pca9685.hpp:16
GpioSignal
Abstract signal level for control pins.
Definition pca9685_i2c_interface.hpp:37
@ ACTIVE
Pin function is asserted.
@ INACTIVE
Pin function is deasserted.
CtrlPin
Identifies the hardware control pins of the PCA9685.
Definition pca9685_i2c_interface.hpp:27
@ OE
Output Enable (active-low on the physical pin)