|
PCA9555 / PCAL9555A Driver
API reference
|
CRTP-based template interface for I2C bus operations. More...
#include <pcal95555_i2c_interface.hpp>
Public Member Functions | |
| bool | Write (uint8_t addr, uint8_t reg, const uint8_t *data, size_t len) noexcept |
| Write bytes to a device register. | |
| bool | Read (uint8_t addr, uint8_t reg, uint8_t *data, size_t len) noexcept |
| Read bytes from a device register. | |
| bool | SetAddressPins (bool a0_level, bool a1_level, bool a2_level) noexcept |
| bool | EnsureInitialized () noexcept |
| bool | RegisterInterruptHandler (std::function< void()> handler) noexcept |
GPIO Pin Control | |
Unified interface for controlling PCAL95555 hardware control pins. | |
| void | GpioSet (CtrlPin pin, GpioSignal signal) noexcept |
| Set a control pin to the specified signal state. | |
| bool | GpioRead (CtrlPin pin, GpioSignal &signal) noexcept |
| Read the current state of a control pin. | |
| void | GpioSetActive (CtrlPin pin) noexcept |
| Assert a control pin (set to ACTIVE). | |
| void | GpioSetInactive (CtrlPin pin) noexcept |
| Deassert a control pin (set to INACTIVE). | |
Protected Member Functions | |
| I2cInterface ()=default | |
| Protected constructor to prevent direct instantiation. | |
| I2cInterface (const I2cInterface &)=delete | |
| I2cInterface & | operator= (const I2cInterface &)=delete |
| I2cInterface (I2cInterface &&)=default | |
| I2cInterface & | operator= (I2cInterface &&)=default |
| ~I2cInterface ()=default | |
| Protected destructor. | |
CRTP-based template interface for I2C bus operations.
This template class provides a hardware-agnostic interface for I2C communication using the CRTP pattern. Platform-specific implementations should inherit from this template with themselves as the template parameter.
Benefits of CRTP:
Example usage:
| Derived | The derived class type (CRTP pattern) |
|
protecteddefault |
Protected constructor to prevent direct instantiation.
|
protecteddelete |
|
protecteddefault |
|
protecteddefault |
Protected destructor.
|
inlinenoexcept |
|
inlinenoexcept |
Read the current state of a control pin.
Primarily used for reading the INTN interrupt pin.
| [in] | pin | Which control pin to read. |
| [out] | signal | Receives the current signal state. |
|
inlinenoexcept |
Set a control pin to the specified signal state.
| [in] | pin | Which control pin to drive. The chips have no output-side control pin, so the driver never calls this. |
| [in] | signal | ACTIVE to assert the pin function, INACTIVE to deassert. |
|
inlinenoexcept |
Assert a control pin (set to ACTIVE).
| [in] | pin | Which control pin to assert. |
|
inlinenoexcept |
Deassert a control pin (set to INACTIVE).
| [in] | pin | Which control pin to deassert. |
|
protecteddelete |
|
protecteddefault |
|
inlinenoexcept |
Read bytes from a device register.
| addr | 7-bit I2C address of the target device. |
| reg | Register address to read from. |
| data | Pointer to the buffer to store received data. |
| len | Number of bytes to read into the buffer. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Write bytes to a device register.
| addr | 7-bit I2C address of the target device. |
| reg | Register address to write to. |
| data | Pointer to the data buffer containing bytes to send. |
| len | Number of bytes to write from the buffer. |