C/C++ API Reference
Loading...
Searching...
No Matches
pw::i2c::Device Class Reference

Overview

The common interface for generic I2C devices. Reads and writes arbitrary chunks of data over an I2C bus to an I2C device. This class contains pw::i2c::Address and wraps the pw::i2c::Initiator API. Only works with devices that have a single device address.

pw::i2c::Device is intended to represent ownership of a specific responder. Individual transactions are atomic but there's no synchronization for sequences of transactions. Therefore, shared access should be faciliated with higher-level application abstractions. To help enforce this, pw::i2c::Device instances are only movable and not copyable.

Inheritance diagram for pw::i2c::Device:
pw::i2c::RegisterDevice

Public Member Functions

constexpr Device (Initiator &initiator, Address device_address)
 
 Device (const Device &)=delete
 
 Device (Device &&)=default
 
Status TransferFor (span< const Message > messages, chrono::SystemClock::duration timeout)
 Wraps pw::i2c::Initiator::TransferFor.
 
Status WriteReadFor (ConstByteSpan tx_buffer, ByteSpan rx_buffer, chrono::SystemClock::duration timeout)
 Wraps pw::i2c::Initiator::WriteReadFor.
 
Status WriteReadFor (const void *tx_buffer, size_t tx_size_bytes, void *rx_buffer, size_t rx_size_bytes, chrono::SystemClock::duration timeout)
 
Status WriteFor (ConstByteSpan tx_buffer, chrono::SystemClock::duration timeout)
 Wraps pw::i2c::Initiator::WriteFor.
 
Status WriteFor (const void *tx_buffer, size_t tx_size_bytes, chrono::SystemClock::duration timeout)
 
Status ReadFor (ByteSpan rx_buffer, chrono::SystemClock::duration timeout)
 Wraps pw::i2c::Initiator::ReadFor.
 
Status ReadFor (void *rx_buffer, size_t rx_size_bytes, chrono::SystemClock::duration timeout)
 
Status ProbeFor (chrono::SystemClock::duration timeout)
 Wraps pw::i2c::Initiator::ProbeDeviceFor.
 

The documentation for this class was generated from the following file: