|
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. A moved-from object must not be used: any operation other than destruction or assignment is undefined behavior.
Definition at line 420 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 533 of file master.hpp.
|
inline |
Returns the parent bus.
Definition at line 524 of file master.hpp.
|
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. |
| std::system_error | on failure. |
Definition at line 798 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 813 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
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. |
| std::system_error | on failure. |
Definition at line 907 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 919 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Returns the underlying ESP-IDF device handle.
Definition at line 530 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 542 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 553 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 1649 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 1667 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
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 1680 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 1693 of file master.hpp.
References idfxx::timeout, and 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. |
| std::system_error | on error. |
Definition at line 1707 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 1721 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 1822 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 1841 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 1856 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 1873 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Receives data from the device.
| size | Number of bytes to receive. |
| std::system_error | on error. |
Definition at line 963 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 977 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
| std::system_error | on error. |
Definition at line 1015 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 1027 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
| size | Number of bytes to receive. |
| std::system_error | on error. |
Definition at line 990 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 1003 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 862 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 610 of file master.hpp.
References idfxx::unwrap().
|
inline |
Transmits data to the device.
| buf | Data to transmit. |
| size | Number of bytes. |
| std::system_error | on error. |
Definition at line 668 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 681 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 625 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 655 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Transmits data to the device.
| data | Data to transmit. |
| std::system_error | on error. |
Definition at line 589 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 637 of file master.hpp.
References idfxx::timeout, and 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. |
Definition at line 828 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 845 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 934 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 948 of file master.hpp.
References idfxx::timeout.
|
inline |
Probes the device.
Definition at line 563 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 573 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 1734 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 1749 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 1762 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 1776 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 1789 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 1805 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 1893 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 1909 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 1923 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 1938 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 1957 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 1973 of file master.hpp.
References idfxx::timeout.
|
inline |
Receives data from the device.
| size | Number of bytes to receive. |
Definition at line 1039 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 1051 of file master.hpp.
References idfxx::timeout.
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
Definition at line 1090 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 1101 of file master.hpp.
References idfxx::timeout.
|
inline |
Receives data from the device.
| buf | Buffer for received data. |
| size | Number of bytes to receive. |
Definition at line 1064 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 1079 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 709 of file master.hpp.
|
inline |
Transmits data to the device.
| buf | Data to transmit. |
| size | Number of bytes. |
Definition at line 767 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 782 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 724 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 755 of file master.hpp.
References idfxx::timeout.
|
inline |
Transmits data to the device.
| data | Data to transmit. |
Definition at line 693 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 738 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 1198 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 1213 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 1170 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 1185 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 1340 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 1356 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 1306 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 1321 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 1613 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 1628 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
Definition at line 1581 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 1595 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 1545 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 1560 of file master.hpp.
References idfxx::timeout.
|
inline |
Writes data to multiple registers.
| registers | Register addresses. |
| buf | Data to write. |
Definition at line 1513 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 1527 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 1142 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 1157 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 1115 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 1128 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 1269 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 1286 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 1233 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 1249 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 1479 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 1495 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 1446 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 1461 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 1409 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 1425 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 1376 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 1391 of file master.hpp.
References idfxx::timeout, and idfxx::unwrap().