The Responder class provides an abstract interface for an I2C device operating in responder (target) mode. It handles callbacks for various I2C transaction events.
Public Member Functions | |
constexpr | Responder (Address address, ResponderEvents &events) |
Status | Enable () |
Status | Disable () |
Protected Member Functions | |
virtual Status | DoEnable ()=0 |
Implementation of Enable() | |
virtual Status | DoDisable ()=0 |
Implementation of Disable() | |
bool | OnStartRead () |
bool | OnStartWrite () |
bool | OnWrite (ConstByteSpan data) |
Result< ConstByteSpan > | OnRead () |
bool | OnStop () |
const Address & | address () const |
|
inlineprotected |
|
inline |
Stop listening to the port
|
protectedpure virtual |
Implementation of Disable()
Implemented in pw::i2c::ZephyrResponder.
|
protectedpure virtual |
Implementation of Enable()
Implemented in pw::i2c::ZephyrResponder.
|
inline |
Start listening to the port
|
inlineprotected |
Called when the I2C initiator is attempting to read data from the responder. The responder should fill the provided buffer
with data to be sent to the initiator. This function may be called multiple times within a single I2C read transaction.
|
inlineprotected |
Called when the I2C initiator initiates a read operation from this responder. This indicates that the initiator is expecting data from the responder. The responder should prepare for subsequent OnRead() calls.
|
inlineprotected |
Called when the I2C initiator initiates a write operation to this responder. This indicates that the initiator is about to send data to the responder. The responder should prepare for subsequent OnWrite() calls.
|
inlineprotected |
Called when the I2C initiator issues a STOP condition, signaling the end of the current transaction. This callback allows the responder to perform any necessary cleanup or state reset.
|
inlineprotected |
Called when the I2C initiator has written data to the responder. This function may be called multiple times within a single I2C write transaction if the initiator sends data in chunks.
data | A span containing the data written by the initiator. |