|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
I2C device at a specific address with register operations. More...
Classes | |
| struct | config |
| I2C device configuration. More... | |
Public Member Functions | |
| master_device (master_bus &bus, uint16_t address, const struct config &config) | |
| Creates a new device on the specified bus. | |
| master_device (master_bus &bus, uint16_t address) | |
| Creates a new device on the specified bus. | |
| ~master_device () | |
| master_device (const master_device &)=delete | |
| master_device & | operator= (const master_device &)=delete |
| master_device (master_device &&other) noexcept | |
| master_device & | operator= (master_device &&other) noexcept |
| master_bus & | bus () const |
| Returns the parent bus. | |
| i2c_master_dev_handle_t | handle () const |
| Returns the underlying ESP-IDF device handle. | |
| uint16_t | address () const |
| Returns the device address. | |
| void | probe () const |
| Probes the device. | |
| template<typename Rep , typename Period > | |
| void | probe (const std::chrono::duration< Rep, Period > &timeout) const |
| Probes the device. | |
| result< void > | try_probe () const |
| Probes the device. | |
| template<typename Rep , typename Period > | |
| result< void > | try_probe (const std::chrono::duration< Rep, Period > &timeout) const |
| Probes the device. | |
| void | transmit (std::span< const uint8_t > data) |
| Transmits data to the device. | |
| template<std::convertible_to< std::span< const uint8_t > >... Buffers> requires (sizeof...(Buffers) > 1) | |
| void | transmit (Buffers... buffers) |
| Transmits data from multiple buffers in a single I2C transaction. | |
| void | transmit (std::span< const std::span< const uint8_t > > buffers) |
| Transmits data from multiple buffers in a single I2C transaction. | |
| template<typename Rep , typename Period > | |
| void | transmit (std::span< const uint8_t > data, const std::chrono::duration< Rep, Period > &timeout) |
| Transmits data to the device. | |
| template<typename Rep , typename Period > | |
| void | transmit (std::span< const std::span< const uint8_t > > buffers, const std::chrono::duration< Rep, Period > &timeout) |
| Transmits data from multiple buffers in a single I2C transaction. | |
| void | transmit (const uint8_t *buf, size_t size) |
| Transmits data to the device. | |
| template<typename Rep , typename Period > | |
| void | transmit (const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Transmits data to the device. | |
| result< void > | try_transmit (std::span< const uint8_t > data) |
| Transmits data to the device. | |
| template<std::convertible_to< std::span< const uint8_t > >... Buffers> requires (sizeof...(Buffers) > 1) | |
| result< void > | try_transmit (Buffers... buffers) |
| Transmits data from multiple buffers in a single I2C transaction. | |
| result< void > | try_transmit (std::span< const std::span< const uint8_t > > buffers) |
| Transmits data from multiple buffers in a single I2C transaction. | |
| template<typename Rep , typename Period > | |
| result< void > | try_transmit (std::span< const uint8_t > data, const std::chrono::duration< Rep, Period > &timeout) |
| Transmits data to the device. | |
| template<typename Rep , typename Period > | |
| result< void > | try_transmit (std::span< const std::span< const uint8_t > > buffers, const std::chrono::duration< Rep, Period > &timeout) |
| Transmits data from multiple buffers in a single I2C transaction. | |
| result< void > | try_transmit (const uint8_t *buf, size_t size) |
| Transmits data to the device. | |
| template<typename Rep , typename Period > | |
| result< void > | try_transmit (const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Transmits data to the device. | |
| void | change_address (uint16_t new_address) |
| Changes the I2C address used for subsequent operations. | |
| template<typename Rep , typename Period > | |
| void | change_address (uint16_t new_address, const std::chrono::duration< Rep, Period > &timeout) |
| Changes the I2C address used for subsequent operations. | |
| result< void > | try_change_address (uint16_t new_address) |
| Changes the I2C address used for subsequent operations. | |
| template<typename Rep , typename Period > | |
| result< void > | try_change_address (uint16_t new_address, const std::chrono::duration< Rep, Period > &timeout) |
| Changes the I2C address used for subsequent operations. | |
| void | register_event_callbacks (std::move_only_function< bool() const > on_trans_done) |
| Registers a callback for transaction-done events. | |
| result< void > | try_register_event_callbacks (std::move_only_function< bool() const > on_trans_done) |
| Registers a callback for transaction-done events. | |
| void | execute_operations (std::span< const operation > ops) |
| Executes a custom sequence of I2C operations. | |
| template<typename Rep , typename Period > | |
| void | execute_operations (std::span< const operation > ops, const std::chrono::duration< Rep, Period > &timeout) |
| Executes a custom sequence of I2C operations. | |
| result< void > | try_execute_operations (std::span< const operation > ops) |
| Executes a custom sequence of I2C operations. | |
| template<typename Rep , typename Period > | |
| result< void > | try_execute_operations (std::span< const operation > ops, const std::chrono::duration< Rep, Period > &timeout) |
| Executes a custom sequence of I2C operations. | |
| std::vector< uint8_t > | receive (size_t size) |
| Receives data from the device. | |
| template<typename Rep , typename Period > | |
| std::vector< uint8_t > | receive (size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Receives data from the device. | |
| void | receive (uint8_t *buf, size_t size) |
| Receives data from the device. | |
| template<typename Rep , typename Period > | |
| void | receive (uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Receives data from the device. | |
| void | receive (std::span< uint8_t > buf) |
| Receives data from the device. | |
| template<typename Rep , typename Period > | |
| void | receive (std::span< uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Receives data from the device. | |
| result< std::vector< uint8_t > > | try_receive (size_t size) |
| Receives data from the device. | |
| template<typename Rep , typename Period > | |
| result< std::vector< uint8_t > > | try_receive (size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Receives data from the device. | |
| result< void > | try_receive (uint8_t *buf, size_t size) |
| Receives data from the device. | |
| template<typename Rep , typename Period > | |
| result< void > | try_receive (uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Receives data from the device. | |
| result< void > | try_receive (std::span< uint8_t > buf) |
| Receives data from the device. | |
| template<typename Rep , typename Period > | |
| result< void > | try_receive (std::span< uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Receives data from the device. | |
| void | write_register (uint16_t reg, std::span< const uint8_t > buf) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| void | write_register (uint16_t reg, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| void | write_register (uint16_t reg, const uint8_t *buf, size_t size) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| void | write_register (uint16_t reg, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| result< void > | try_write_register (uint16_t reg, std::span< const uint8_t > buf) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_register (uint16_t reg, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| result< void > | try_write_register (uint16_t reg, const uint8_t *buf, size_t size) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_register (uint16_t reg, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| void | write_register (uint8_t high, uint8_t low, std::span< const uint8_t > buf) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| void | write_register (uint8_t high, uint8_t low, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| void | write_register (uint8_t high, uint8_t low, const uint8_t *buf, size_t size) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| void | write_register (uint8_t high, uint8_t low, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| result< void > | try_write_register (uint8_t high, uint8_t low, std::span< const uint8_t > buf) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_register (uint8_t high, uint8_t low, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| result< void > | try_write_register (uint8_t high, uint8_t low, const uint8_t *buf, size_t size) |
| Writes data to a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_register (uint8_t high, uint8_t low, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to a register. | |
| void | write_registers (std::span< const uint16_t > registers, std::span< const uint8_t > buf) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| void | write_registers (std::span< const uint16_t > registers, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| void | write_registers (std::span< const uint16_t > registers, const uint8_t *buf, size_t size) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| void | write_registers (std::span< const uint16_t > registers, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| void | write_registers (std::initializer_list< uint16_t > registers, std::span< const uint8_t > buf) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| void | write_registers (std::initializer_list< uint16_t > registers, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| void | write_registers (std::initializer_list< uint16_t > registers, const uint8_t *buf, size_t size) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| void | write_registers (std::initializer_list< uint16_t > registers, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| result< void > | try_write_registers (std::span< const uint16_t > registers, std::span< const uint8_t > buf) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_registers (std::span< const uint16_t > registers, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| result< void > | try_write_registers (std::span< const uint16_t > registers, const uint8_t *buf, size_t size) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_registers (std::span< const uint16_t > registers, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| result< void > | try_write_registers (std::initializer_list< uint16_t > registers, std::span< const uint8_t > buf) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_registers (std::initializer_list< uint16_t > registers, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| result< void > | try_write_registers (std::initializer_list< uint16_t > registers, const uint8_t *buf, size_t size) |
| Writes data to multiple registers. | |
| template<typename Rep , typename Period > | |
| result< void > | try_write_registers (std::initializer_list< uint16_t > registers, const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Writes data to multiple registers. | |
| std::vector< uint8_t > | read_register (uint16_t reg, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| std::vector< uint8_t > | read_register (uint16_t reg, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| void | read_register (uint16_t reg, std::span< uint8_t > buf) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| void | read_register (uint16_t reg, std::span< uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| void | read_register (uint16_t reg, uint8_t *buf, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| void | read_register (uint16_t reg, uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| result< std::vector< uint8_t > > | try_read_register (uint16_t reg, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| result< std::vector< uint8_t > > | try_read_register (uint16_t reg, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| result< void > | try_read_register (uint16_t reg, std::span< uint8_t > buf) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_read_register (uint16_t reg, std::span< uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| result< void > | try_read_register (uint16_t reg, uint8_t *buf, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_read_register (uint16_t reg, uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| std::vector< uint8_t > | read_register (uint8_t high, uint8_t low, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| std::vector< uint8_t > | read_register (uint8_t high, uint8_t low, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| void | read_register (uint8_t high, uint8_t low, uint8_t *buf, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| void | read_register (uint8_t high, uint8_t low, uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| result< std::vector< uint8_t > > | try_read_register (uint8_t high, uint8_t low, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| result< std::vector< uint8_t > > | try_read_register (uint8_t high, uint8_t low, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| result< void > | try_read_register (uint8_t high, uint8_t low, std::span< uint8_t > buf) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_read_register (uint8_t high, uint8_t low, std::span< uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
| result< void > | try_read_register (uint8_t high, uint8_t low, uint8_t *buf, size_t size) |
| Reads data from a register. | |
| template<typename Rep , typename Period > | |
| result< void > | try_read_register (uint8_t high, uint8_t low, uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout) |
| Reads data from a register. | |
Static Public Member Functions | |
| static result< master_device > | make (master_bus &bus, uint16_t address, const struct config &config) |
| Creates a new device on the specified bus. | |
| static result< master_device > | make (master_bus &bus, uint16_t address) |
| Creates a new device on the specified bus. | |
I2C device at a specific address with register operations.
Represents a specific device on an I2C bus. Provides methods for raw data transfer and register-based read/write operations.
This type is non-copyable and move-only. Result-returning methods on a moved-from object return errc::invalid_state. Simple accessors return default/null values.
Definition at line 421 of file master.hpp.
|
explicit |
Creates a new device on the specified bus.
Does not take ownership of bus. It is the caller's responsibility to ensure that this device does not outlive the bus.
| bus | The parent bus. |
| address | Device address. |
| config | Device configuration. |
| std::system_error | on failure. |
|
explicit |
Creates a new device on the specified bus.
Does not take ownership of bus. It is the caller's responsibility to ensure that this device does not outlive the bus.
| bus | The parent bus. |
| address | Device address. |
| std::system_error | on failure. |
| idfxx::i2c::master_device::~master_device | ( | ) |
|
delete |
|
noexcept |
|
inline |
Returns the device address.
Definition at line 534 of file master.hpp.
|
inline |
Returns the parent bus.
Definition at line 525 of file master.hpp.
Changes the I2C address used for subsequent operations.
Useful for devices whose address can change at runtime, such as after configuring an I2C multiplexer.
| new_address | The new device address. |
| std::system_error | on failure. |
Definition at line 799 of file master.hpp.
References idfxx::unwrap().
|
inline |
Changes the I2C address used for subsequent operations.
Useful for devices whose address can change at runtime, such as after configuring an I2C multiplexer.
| new_address | The new device address. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on failure. |
Definition at line 814 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Executes a custom sequence of I2C operations.
Performs the given sequence of START, WRITE, READ, and STOP operations. Useful for non-standard I2C protocols.
| ops | Operations to execute. |
| std::system_error | on failure. |
Definition at line 908 of file master.hpp.
References idfxx::unwrap().
|
inline |
Executes a custom sequence of I2C operations.
| ops | Operations to execute. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on failure. |
Definition at line 920 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Returns the underlying ESP-IDF device handle.
Definition at line 531 of file master.hpp.
|
static |
Creates a new device on the specified bus.
Does not take ownership of bus. It is the caller's responsibility to ensure that this device does not outlive the bus.
| bus | The parent bus. |
| address | Device address. |
|
static |
Creates a new device on the specified bus.
Does not take ownership of bus. It is the caller's responsibility to ensure that this device does not outlive the bus.
| bus | The parent bus. |
| address | Device address. |
| config | Device configuration. |
|
delete |
|
noexcept |
|
inline |
Probes the device.
| std::system_error | if the device does not acknowledge or on error. |
Definition at line 543 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT, and probe().
Referenced by probe().
|
inline |
Probes the device.
| timeout | Maximum time to wait for response. |
| std::system_error | if the device does not acknowledge or on error. |
Definition at line 554 of file master.hpp.
References idfxx::timeout, idfxx::i2c::master_bus::try_probe(), and idfxx::unwrap().
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| size | Number of bytes to read. |
| std::system_error | on error. |
Definition at line 1650 of file master.hpp.
References idfxx::unwrap().
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1668 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
| std::system_error | on error. |
Definition at line 1681 of file master.hpp.
References idfxx::unwrap().
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1694 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
| std::system_error | on error. |
Definition at line 1708 of file master.hpp.
References idfxx::unwrap().
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1722 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| size | Number of bytes to read. |
| std::system_error | on error. |
Definition at line 1823 of file master.hpp.
References idfxx::unwrap().
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1842 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
| std::system_error | on error. |
Definition at line 1857 of file master.hpp.
References idfxx::unwrap().
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1874 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Receives data from the device.
| size | Number of bytes to receive. |
| std::system_error | on error. |
Definition at line 964 of file master.hpp.
References idfxx::unwrap().
|
inline |
Receives data from the device.
| size | Number of bytes to receive. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 978 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Receives data from the device.
| buf | Buffer for received data. |
| std::system_error | on error. |
Definition at line 1016 of file master.hpp.
References idfxx::unwrap().
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1028 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Receives data from the device.
| buf | Buffer for received data. |
| size | Number of bytes to receive. |
| std::system_error | on error. |
Definition at line 991 of file master.hpp.
References idfxx::unwrap().
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
| size | Number of bytes to receive. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1004 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Registers a callback for transaction-done events.
The callback runs in ISR context when an asynchronous transaction completes. It should return true if a higher-priority task was woken. Only useful when the bus was created with a non-zero trans_queue_depth.
| on_trans_done | Transaction-done callback. |
| std::system_error | on failure. |
Definition at line 863 of file master.hpp.
References idfxx::unwrap().
|
inline |
Transmits data from multiple buffers in a single I2C transaction.
Convenience overload that accepts two or more buffers as separate arguments.
| Buffers | Types convertible to std::span<const uint8_t>. |
| buffers | Buffers to transmit, in order. |
| std::system_error | on error. |
Definition at line 611 of file master.hpp.
References idfxx::unwrap().
Transmits data to the device.
| buf | Data to transmit. |
| size | Number of bytes. |
| std::system_error | on error. |
Definition at line 669 of file master.hpp.
References idfxx::unwrap().
|
inline |
Transmits data to the device.
| buf | Data to transmit. |
| size | Number of bytes. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 682 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Transmits data from multiple buffers in a single I2C transaction.
Performs a scatter-gather transmit, sending data from each buffer sequentially without intermediate stop conditions.
| buffers | Buffers to transmit, in order. |
| std::system_error | on error. |
Definition at line 626 of file master.hpp.
References idfxx::unwrap().
|
inline |
Transmits data from multiple buffers in a single I2C transaction.
Performs a scatter-gather transmit, sending data from each buffer sequentially without intermediate stop conditions.
| buffers | Buffers to transmit, in order. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 656 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Transmits data to the device.
| data | Data to transmit. |
| std::system_error | on error. |
Definition at line 590 of file master.hpp.
References idfxx::unwrap().
|
inline |
Transmits data to the device.
| data | Data to transmit. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 638 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
Changes the I2C address used for subsequent operations.
Useful for devices whose address can change at runtime, such as after configuring an I2C multiplexer.
| new_address | The new device address. |
Definition at line 829 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Changes the I2C address used for subsequent operations.
Useful for devices whose address can change at runtime, such as after configuring an I2C multiplexer.
| new_address | The new device address. |
| timeout | Maximum time to wait for completion. |
Definition at line 846 of file master.hpp.
References idfxx::timeout.
|
inline |
Executes a custom sequence of I2C operations.
Performs the given sequence of START, WRITE, READ, and STOP operations. Useful for non-standard I2C protocols.
| ops | Operations to execute. |
Definition at line 935 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Executes a custom sequence of I2C operations.
| ops | Operations to execute. |
| timeout | Maximum time to wait for completion. |
Definition at line 949 of file master.hpp.
References idfxx::timeout.
Probes the device.
Definition at line 564 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT, and try_probe().
Referenced by try_probe().
|
inline |
Probes the device.
| timeout | Maximum time to wait for response. |
Definition at line 574 of file master.hpp.
References idfxx::error(), idfxx::invalid_state, and idfxx::timeout.
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| size | Number of bytes to read. |
Definition at line 1735 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
Definition at line 1750 of file master.hpp.
References idfxx::timeout.
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
Definition at line 1763 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
Definition at line 1777 of file master.hpp.
References idfxx::timeout.
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
Definition at line 1790 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Reads data from a register.
| reg | Register address (16-bit, MSB first). |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
Definition at line 1806 of file master.hpp.
References idfxx::timeout.
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| size | Number of bytes to read. |
Definition at line 1894 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
Definition at line 1910 of file master.hpp.
References idfxx::timeout.
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Buffer for received data. |
Definition at line 1924 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Buffer for received data. |
| timeout | Maximum time to wait for completion. |
Definition at line 1939 of file master.hpp.
References idfxx::timeout.
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
Definition at line 1958 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Reads data from a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Buffer for received data. |
| size | Number of bytes to read. |
| timeout | Maximum time to wait for completion. |
Definition at line 1974 of file master.hpp.
References idfxx::timeout.
Receives data from the device.
| size | Number of bytes to receive. |
Definition at line 1040 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT, and try_receive().
Referenced by try_receive().
|
inline |
Receives data from the device.
| size | Number of bytes to receive. |
| timeout | Maximum time to wait for completion. |
Definition at line 1052 of file master.hpp.
References idfxx::timeout.
Receives data from the device.
| buf | Buffer for received data. |
Definition at line 1091 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT, and try_receive().
Referenced by try_receive().
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
| timeout | Maximum time to wait for completion. |
Definition at line 1102 of file master.hpp.
References idfxx::timeout.
Receives data from the device.
| buf | Buffer for received data. |
| size | Number of bytes to receive. |
Definition at line 1065 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
| size | Number of bytes to receive. |
| timeout | Maximum time to wait for completion. |
Definition at line 1080 of file master.hpp.
References idfxx::timeout.
| result< void > idfxx::i2c::master_device::try_register_event_callbacks | ( | std::move_only_function< bool() const > | on_trans_done | ) |
Registers a callback for transaction-done events.
The callback runs in ISR context when an asynchronous transaction completes. It should return true if a higher-priority task was woken. Only useful when the bus was created with a non-zero trans_queue_depth.
| on_trans_done | Transaction-done callback. |
|
inline |
Transmits data from multiple buffers in a single I2C transaction.
Convenience overload that accepts two or more buffers as separate arguments.
| Buffers | Types convertible to std::span<const uint8_t>. |
| buffers | Buffers to transmit, in order. |
Definition at line 710 of file master.hpp.
Transmits data to the device.
| buf | Data to transmit. |
| size | Number of bytes. |
Definition at line 768 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Transmits data to the device.
| buf | Data to transmit. |
| size | Number of bytes. |
| timeout | Maximum time to wait for completion. |
Definition at line 783 of file master.hpp.
References idfxx::timeout.
|
inline |
Transmits data from multiple buffers in a single I2C transaction.
Performs a scatter-gather transmit, sending data from each buffer sequentially without intermediate stop conditions.
| buffers | Buffers to transmit, in order. |
Definition at line 725 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Transmits data from multiple buffers in a single I2C transaction.
Performs a scatter-gather transmit, sending data from each buffer sequentially without intermediate stop conditions.
| buffers | Buffers to transmit, in order. |
| timeout | Maximum time to wait for completion. |
Definition at line 756 of file master.hpp.
References idfxx::timeout.
Transmits data to the device.
| data | Data to transmit. |
Definition at line 694 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Transmits data to the device.
| data | Data to transmit. |
| timeout | Maximum time to wait for completion. |
Definition at line 739 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
| size | Number of bytes. |
Definition at line 1199 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
| size | Number of bytes. |
| timeout | Maximum time to wait for completion. |
Definition at line 1214 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
Definition at line 1171 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
Definition at line 1186 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
| size | Number of bytes. |
Definition at line 1341 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
| size | Number of bytes. |
| timeout | Maximum time to wait for completion. |
Definition at line 1357 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
Definition at line 1307 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
Definition at line 1322 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
Definition at line 1614 of file master.hpp.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
| timeout | Maximum time to wait for completion. |
Definition at line 1629 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
Definition at line 1582 of file master.hpp.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
Definition at line 1596 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
Definition at line 1546 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
| timeout | Maximum time to wait for completion. |
Definition at line 1561 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
Definition at line 1514 of file master.hpp.
References idfxx::i2c::DEFAULT_TIMEOUT.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
Definition at line 1528 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
| size | Number of bytes. |
| std::system_error | on error. |
Definition at line 1143 of file master.hpp.
References idfxx::unwrap().
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
| size | Number of bytes. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1158 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
| std::system_error | on error. |
Definition at line 1116 of file master.hpp.
References idfxx::unwrap().
|
inline |
Writes data to a register.
| reg | Register address (16-bit, MSB first). |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1129 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
| size | Number of bytes. |
| std::system_error | on error. |
Definition at line 1270 of file master.hpp.
References idfxx::unwrap().
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
| size | Number of bytes. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1287 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
| std::system_error | on error. |
Definition at line 1234 of file master.hpp.
References idfxx::unwrap().
|
inline |
Writes data to a register.
| high | High byte of register address. |
| low | Low byte of register address. |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1250 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
| std::system_error | on error. |
Definition at line 1480 of file master.hpp.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1496 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| std::system_error | on error. |
Definition at line 1447 of file master.hpp.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1462 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
| std::system_error | on error. |
Definition at line 1410 of file master.hpp.
References idfxx::unwrap().
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| size | Number of bytes per register. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1426 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| std::system_error | on error. |
Definition at line 1377 of file master.hpp.
References idfxx::unwrap().
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
| timeout | Maximum time to wait for completion. |
| std::system_error | on error. |
Definition at line 1392 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().