idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::i2c::master_device Class Reference

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_deviceoperator= (const master_device &)=delete
 
 master_device (master_device &&other) noexcept
 
master_deviceoperator= (master_device &&other) noexcept
 
master_busbus () 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< voidtry_probe () const
 Probes the device.
 
template<typename Rep , typename Period >
result< voidtry_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<typename Rep , typename Period >
void transmit (std::span< const uint8_t > data, const std::chrono::duration< Rep, Period > &timeout)
 Transmits data to the device.
 
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< voidtry_transmit (std::span< const uint8_t > data)
 Transmits data to the device.
 
template<typename Rep , typename Period >
result< voidtry_transmit (std::span< const uint8_t > data, const std::chrono::duration< Rep, Period > &timeout)
 Transmits data to the device.
 
result< voidtry_transmit (const uint8_t *buf, size_t size)
 Transmits data to the device.
 
template<typename Rep , typename Period >
result< voidtry_transmit (const uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout)
 Transmits data to the device.
 
std::vector< uint8_treceive (size_t size)
 Receives data from the device.
 
template<typename Rep , typename Period >
std::vector< uint8_treceive (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< voidtry_receive (uint8_t *buf, size_t size)
 Receives data from the device.
 
template<typename Rep , typename Period >
result< voidtry_receive (uint8_t *buf, size_t size, const std::chrono::duration< Rep, Period > &timeout)
 Receives data from the device.
 
result< voidtry_receive (std::span< uint8_t > buf)
 Receives data from the device.
 
template<typename Rep , typename Period >
result< voidtry_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< voidtry_write_register (uint16_t reg, std::span< const uint8_t > buf)
 Writes data to a register.
 
template<typename Rep , typename Period >
result< voidtry_write_register (uint16_t reg, std::span< const uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout)
 Writes data to a register.
 
result< voidtry_write_register (uint16_t reg, const uint8_t *buf, size_t size)
 Writes data to a register.
 
template<typename Rep , typename Period >
result< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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< voidtry_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_tread_register (uint16_t reg, size_t size)
 Reads data from a register.
 
template<typename Rep , typename Period >
std::vector< uint8_tread_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< voidtry_read_register (uint16_t reg, std::span< uint8_t > buf)
 Reads data from a register.
 
template<typename Rep , typename Period >
result< voidtry_read_register (uint16_t reg, std::span< uint8_t > buf, const std::chrono::duration< Rep, Period > &timeout)
 Reads data from a register.
 
result< voidtry_read_register (uint16_t reg, uint8_t *buf, size_t size)
 Reads data from a register.
 
template<typename Rep , typename Period >
result< voidtry_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_tread_register (uint8_t high, uint8_t low, size_t size)
 Reads data from a register.
 
template<typename Rep , typename Period >
std::vector< uint8_tread_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< voidtry_read_register (uint8_t high, uint8_t low, std::span< uint8_t > buf)
 Reads data from a register.
 
template<typename Rep , typename Period >
result< voidtry_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< voidtry_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< voidtry_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_devicemake (master_bus &bus, uint16_t address, const struct config &config)
 Creates a new device on the specified bus.
 
static result< master_devicemake (master_bus &bus, uint16_t address)
 Creates a new device on the specified bus.
 

Detailed Description

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 344 of file master.hpp.

Constructor & Destructor Documentation

◆ master_device() [1/4]

idfxx::i2c::master_device::master_device ( master_bus bus,
uint16_t  address,
const struct config config 
)
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.

Parameters
busThe parent bus.
addressDevice address.
configDevice configuration.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure.
.scl_speed = 400_kHz,
});
I2C device at a specific address with register operations.
Definition master.hpp:344
master_bus & bus() const
Returns the parent bus.
Definition master.hpp:446
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Definition error.hpp:120

◆ master_device() [2/4]

idfxx::i2c::master_device::master_device ( master_bus bus,
uint16_t  address 
)
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.

Parameters
busThe parent bus.
addressDevice address.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure.

◆ ~master_device()

idfxx::i2c::master_device::~master_device ( )

◆ master_device() [3/4]

idfxx::i2c::master_device::master_device ( const master_device )
delete

◆ master_device() [4/4]

idfxx::i2c::master_device::master_device ( master_device &&  other)
noexcept

Member Function Documentation

◆ address()

uint16_t idfxx::i2c::master_device::address ( ) const
inline

Returns the device address.

Definition at line 455 of file master.hpp.

◆ bus()

master_bus & idfxx::i2c::master_device::bus ( ) const
inline

Returns the parent bus.

Precondition
The object has not been moved from.

Definition at line 446 of file master.hpp.

◆ handle()

i2c_master_dev_handle_t idfxx::i2c::master_device::handle ( ) const
inline

Returns the underlying ESP-IDF device handle.

Definition at line 452 of file master.hpp.

◆ make() [1/2]

static result< master_device > idfxx::i2c::master_device::make ( master_bus bus,
uint16_t  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.

Parameters
busThe parent bus.
addressDevice address.
Returns
The new master_device, or an error.

◆ make() [2/2]

static result< master_device > idfxx::i2c::master_device::make ( master_bus bus,
uint16_t  address,
const struct config config 
)
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.

Parameters
busThe parent bus.
addressDevice address.
configDevice configuration.
Returns
The new master_device, or an error.
auto device = idfxx::i2c::master_device::make(bus, 0x3C, {
.scl_speed = 400_kHz,
});
static result< master_device > make(master_bus &bus, uint16_t address, const struct config &config)
Creates a new device on the specified bus.

◆ operator=() [1/2]

master_device & idfxx::i2c::master_device::operator= ( const master_device )
delete

◆ operator=() [2/2]

master_device & idfxx::i2c::master_device::operator= ( master_device &&  other)
noexcept

◆ probe() [1/2]

void idfxx::i2c::master_device::probe ( ) const
inline

Probes the device.

Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_errorif the device does not acknowledge or on error.

Definition at line 464 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT, and probe().

Referenced by probe().

◆ probe() [2/2]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::probe ( const std::chrono::duration< Rep, Period > &  timeout) const
inline

Probes the device.

Parameters
timeoutMaximum time to wait for response.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_errorif the device does not acknowledge or on error.

Definition at line 475 of file master.hpp.

References idfxx::timeout, idfxx::i2c::master_bus::try_probe(), and idfxx::unwrap().

◆ read_register() [1/10]

std::vector< uint8_t > idfxx::i2c::master_device::read_register ( uint16_t  reg,
size_t  size 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
sizeNumber of bytes to read.
Returns
Received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1303 of file master.hpp.

References idfxx::unwrap().

◆ read_register() [2/10]

template<typename Rep , typename Period >
std::vector< uint8_t > idfxx::i2c::master_device::read_register ( uint16_t  reg,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Returns
Received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1321 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ read_register() [3/10]

void idfxx::i2c::master_device::read_register ( uint16_t  reg,
std::span< uint8_t buf 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1334 of file master.hpp.

References idfxx::unwrap().

◆ read_register() [4/10]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::read_register ( uint16_t  reg,
std::span< uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1347 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ read_register() [5/10]

void idfxx::i2c::master_device::read_register ( uint16_t  reg,
uint8_t buf,
size_t  size 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
sizeNumber of bytes to read.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1361 of file master.hpp.

References idfxx::unwrap().

◆ read_register() [6/10]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::read_register ( uint16_t  reg,
uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1375 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ read_register() [7/10]

std::vector< uint8_t > idfxx::i2c::master_device::read_register ( uint8_t  high,
uint8_t  low,
size_t  size 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
sizeNumber of bytes to read.
Returns
Received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1476 of file master.hpp.

References idfxx::unwrap().

◆ read_register() [8/10]

template<typename Rep , typename Period >
std::vector< uint8_t > idfxx::i2c::master_device::read_register ( uint8_t  high,
uint8_t  low,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Returns
Received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1495 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ read_register() [9/10]

void idfxx::i2c::master_device::read_register ( uint8_t  high,
uint8_t  low,
uint8_t buf,
size_t  size 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufBuffer for received data.
sizeNumber of bytes to read.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1510 of file master.hpp.

References idfxx::unwrap().

◆ read_register() [10/10]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::read_register ( uint8_t  high,
uint8_t  low,
uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufBuffer for received data.
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1527 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ receive() [1/6]

std::vector< uint8_t > idfxx::i2c::master_device::receive ( size_t  size)
inline

Receives data from the device.

Parameters
sizeNumber of bytes to receive.
Returns
Received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 617 of file master.hpp.

References idfxx::unwrap().

◆ receive() [2/6]

template<typename Rep , typename Period >
std::vector< uint8_t > idfxx::i2c::master_device::receive ( size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Receives data from the device.

Parameters
sizeNumber of bytes to receive.
timeoutMaximum time to wait for completion.
Returns
Received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 631 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ receive() [3/6]

void idfxx::i2c::master_device::receive ( std::span< uint8_t buf)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 669 of file master.hpp.

References idfxx::unwrap().

◆ receive() [4/6]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::receive ( std::span< uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 681 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ receive() [5/6]

void idfxx::i2c::master_device::receive ( uint8_t buf,
size_t  size 
)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
sizeNumber of bytes to receive.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 644 of file master.hpp.

References idfxx::unwrap().

◆ receive() [6/6]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::receive ( uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
sizeNumber of bytes to receive.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 657 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ transmit() [1/4]

void idfxx::i2c::master_device::transmit ( const uint8_t buf,
size_t  size 
)
inline

Transmits data to the device.

Parameters
bufData to transmit.
sizeNumber of bytes.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 536 of file master.hpp.

References idfxx::unwrap().

◆ transmit() [2/4]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::transmit ( const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Transmits data to the device.

Parameters
bufData to transmit.
sizeNumber of bytes.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 549 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ transmit() [3/4]

void idfxx::i2c::master_device::transmit ( std::span< const uint8_t data)
inline

Transmits data to the device.

Parameters
dataData to transmit.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 511 of file master.hpp.

References idfxx::unwrap().

◆ transmit() [4/4]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::transmit ( std::span< const uint8_t data,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Transmits data to the device.

Parameters
dataData to transmit.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 523 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ try_probe() [1/2]

result< void > idfxx::i2c::master_device::try_probe ( ) const
inline

Probes the device.

Returns
Success if the device acknowledges, or an error.

Definition at line 485 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT, and try_probe().

Referenced by try_probe().

◆ try_probe() [2/2]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_probe ( const std::chrono::duration< Rep, Period > &  timeout) const
inline

Probes the device.

Parameters
timeoutMaximum time to wait for response.
Returns
Success if the device acknowledges, or an error.

Definition at line 495 of file master.hpp.

References idfxx::error(), idfxx::invalid_state, and idfxx::timeout.

◆ try_read_register() [1/12]

result< std::vector< uint8_t > > idfxx::i2c::master_device::try_read_register ( uint16_t  reg,
size_t  size 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
sizeNumber of bytes to read.
Returns
Received data, or an error.

Definition at line 1388 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_read_register() [2/12]

template<typename Rep , typename Period >
result< std::vector< uint8_t > > idfxx::i2c::master_device::try_read_register ( uint16_t  reg,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Returns
Received data, or an error.

Definition at line 1403 of file master.hpp.

References idfxx::timeout.

◆ try_read_register() [3/12]

result< void > idfxx::i2c::master_device::try_read_register ( uint16_t  reg,
std::span< uint8_t buf 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
Returns
Success, or an error.

Definition at line 1416 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_read_register() [4/12]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_read_register ( uint16_t  reg,
std::span< uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
Returns
Success, or an error.

Definition at line 1430 of file master.hpp.

References idfxx::timeout.

◆ try_read_register() [5/12]

result< void > idfxx::i2c::master_device::try_read_register ( uint16_t  reg,
uint8_t buf,
size_t  size 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
sizeNumber of bytes to read.
Returns
Success, or an error.

Definition at line 1443 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_read_register() [6/12]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_read_register ( uint16_t  reg,
uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
regRegister address (16-bit, MSB first).
bufBuffer for received data.
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1459 of file master.hpp.

References idfxx::timeout.

◆ try_read_register() [7/12]

result< std::vector< uint8_t > > idfxx::i2c::master_device::try_read_register ( uint8_t  high,
uint8_t  low,
size_t  size 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
sizeNumber of bytes to read.
Returns
Received data, or an error.

Definition at line 1547 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_read_register() [8/12]

template<typename Rep , typename Period >
result< std::vector< uint8_t > > idfxx::i2c::master_device::try_read_register ( uint8_t  high,
uint8_t  low,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Returns
Received data, or an error.

Definition at line 1563 of file master.hpp.

References idfxx::timeout.

◆ try_read_register() [9/12]

result< void > idfxx::i2c::master_device::try_read_register ( uint8_t  high,
uint8_t  low,
std::span< uint8_t buf 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufBuffer for received data.
Returns
Success, or an error.

Definition at line 1577 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_read_register() [10/12]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_read_register ( uint8_t  high,
uint8_t  low,
std::span< uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufBuffer for received data.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1592 of file master.hpp.

References idfxx::timeout.

◆ try_read_register() [11/12]

result< void > idfxx::i2c::master_device::try_read_register ( uint8_t  high,
uint8_t  low,
uint8_t buf,
size_t  size 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufBuffer for received data.
sizeNumber of bytes to read.
Returns
Success, or an error.

Definition at line 1611 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_read_register() [12/12]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_read_register ( uint8_t  high,
uint8_t  low,
uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Reads data from a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufBuffer for received data.
sizeNumber of bytes to read.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1627 of file master.hpp.

References idfxx::timeout.

◆ try_receive() [1/6]

result< std::vector< uint8_t > > idfxx::i2c::master_device::try_receive ( size_t  size)
inline

Receives data from the device.

Parameters
sizeNumber of bytes to receive.
Returns
Received data, or an error.

Definition at line 693 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT, and try_receive().

Referenced by try_receive().

◆ try_receive() [2/6]

template<typename Rep , typename Period >
result< std::vector< uint8_t > > idfxx::i2c::master_device::try_receive ( size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Receives data from the device.

Parameters
sizeNumber of bytes to receive.
timeoutMaximum time to wait for completion.
Returns
Received data, or an error.

Definition at line 705 of file master.hpp.

References idfxx::timeout.

◆ try_receive() [3/6]

result< void > idfxx::i2c::master_device::try_receive ( std::span< uint8_t buf)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
Returns
Success, or an error.

Definition at line 744 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT, and try_receive().

Referenced by try_receive().

◆ try_receive() [4/6]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_receive ( std::span< uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 755 of file master.hpp.

References idfxx::timeout.

◆ try_receive() [5/6]

result< void > idfxx::i2c::master_device::try_receive ( uint8_t buf,
size_t  size 
)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
sizeNumber of bytes to receive.
Returns
Success, or an error.

Definition at line 718 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_receive() [6/6]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_receive ( uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Receives data from the device.

Parameters
bufBuffer for received data.
sizeNumber of bytes to receive.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 733 of file master.hpp.

References idfxx::timeout.

◆ try_transmit() [1/4]

result< void > idfxx::i2c::master_device::try_transmit ( const uint8_t buf,
size_t  size 
)
inline

Transmits data to the device.

Parameters
bufData to transmit.
sizeNumber of bytes.
Returns
Success, or an error.

Definition at line 587 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_transmit() [2/4]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_transmit ( const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Transmits data to the device.

Parameters
bufData to transmit.
sizeNumber of bytes.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 602 of file master.hpp.

References idfxx::timeout.

◆ try_transmit() [3/4]

result< void > idfxx::i2c::master_device::try_transmit ( std::span< const uint8_t data)
inline

Transmits data to the device.

Parameters
dataData to transmit.
Returns
Success, or an error.

Definition at line 561 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_transmit() [4/4]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_transmit ( std::span< const uint8_t data,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Transmits data to the device.

Parameters
dataData to transmit.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 575 of file master.hpp.

References idfxx::timeout.

◆ try_write_register() [1/8]

result< void > idfxx::i2c::master_device::try_write_register ( uint16_t  reg,
const uint8_t buf,
size_t  size 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
sizeNumber of bytes.
Returns
Success, or an error.

Definition at line 852 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_write_register() [2/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_register ( uint16_t  reg,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
sizeNumber of bytes.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 867 of file master.hpp.

References idfxx::timeout.

◆ try_write_register() [3/8]

result< void > idfxx::i2c::master_device::try_write_register ( uint16_t  reg,
std::span< const uint8_t buf 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
Returns
Success, or an error.

Definition at line 824 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_write_register() [4/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_register ( uint16_t  reg,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 839 of file master.hpp.

References idfxx::timeout.

◆ try_write_register() [5/8]

result< void > idfxx::i2c::master_device::try_write_register ( uint8_t  high,
uint8_t  low,
const uint8_t buf,
size_t  size 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
sizeNumber of bytes.
Returns
Success, or an error.

Definition at line 994 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_write_register() [6/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_register ( uint8_t  high,
uint8_t  low,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
sizeNumber of bytes.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1010 of file master.hpp.

References idfxx::timeout.

◆ try_write_register() [7/8]

result< void > idfxx::i2c::master_device::try_write_register ( uint8_t  high,
uint8_t  low,
std::span< const uint8_t buf 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
Returns
Success, or an error.

Definition at line 960 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_write_register() [8/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_register ( uint8_t  high,
uint8_t  low,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 975 of file master.hpp.

References idfxx::timeout.

◆ try_write_registers() [1/8]

result< void > idfxx::i2c::master_device::try_write_registers ( std::initializer_list< uint16_t registers,
const uint8_t buf,
size_t  size 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
Returns
Success, or an error.

Definition at line 1267 of file master.hpp.

◆ try_write_registers() [2/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_registers ( std::initializer_list< uint16_t registers,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1282 of file master.hpp.

References idfxx::timeout.

◆ try_write_registers() [3/8]

result< void > idfxx::i2c::master_device::try_write_registers ( std::initializer_list< uint16_t registers,
std::span< const uint8_t buf 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
Returns
Success, or an error.

Definition at line 1235 of file master.hpp.

◆ try_write_registers() [4/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_registers ( std::initializer_list< uint16_t registers,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1249 of file master.hpp.

References idfxx::timeout.

◆ try_write_registers() [5/8]

result< void > idfxx::i2c::master_device::try_write_registers ( std::span< const uint16_t registers,
const uint8_t buf,
size_t  size 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
Returns
Success, or an error.

Definition at line 1199 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_write_registers() [6/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_registers ( std::span< const uint16_t registers,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1214 of file master.hpp.

References idfxx::timeout.

◆ try_write_registers() [7/8]

result< void > idfxx::i2c::master_device::try_write_registers ( std::span< const uint16_t registers,
std::span< const uint8_t buf 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
Returns
Success, or an error.

Definition at line 1167 of file master.hpp.

References idfxx::i2c::DEFAULT_TIMEOUT.

◆ try_write_registers() [8/8]

template<typename Rep , typename Period >
result< void > idfxx::i2c::master_device::try_write_registers ( std::span< const uint16_t registers,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
timeoutMaximum time to wait for completion.
Returns
Success, or an error.

Definition at line 1181 of file master.hpp.

References idfxx::timeout.

◆ write_register() [1/8]

void idfxx::i2c::master_device::write_register ( uint16_t  reg,
const uint8_t buf,
size_t  size 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
sizeNumber of bytes.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 796 of file master.hpp.

References idfxx::unwrap().

◆ write_register() [2/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_register ( uint16_t  reg,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
sizeNumber of bytes.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 811 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ write_register() [3/8]

void idfxx::i2c::master_device::write_register ( uint16_t  reg,
std::span< const uint8_t buf 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 769 of file master.hpp.

References idfxx::unwrap().

◆ write_register() [4/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_register ( uint16_t  reg,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
regRegister address (16-bit, MSB first).
bufData to write.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 782 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ write_register() [5/8]

void idfxx::i2c::master_device::write_register ( uint8_t  high,
uint8_t  low,
const uint8_t buf,
size_t  size 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
sizeNumber of bytes.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 923 of file master.hpp.

References idfxx::unwrap().

◆ write_register() [6/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_register ( uint8_t  high,
uint8_t  low,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
sizeNumber of bytes.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 940 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ write_register() [7/8]

void idfxx::i2c::master_device::write_register ( uint8_t  high,
uint8_t  low,
std::span< const uint8_t buf 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 887 of file master.hpp.

References idfxx::unwrap().

◆ write_register() [8/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_register ( uint8_t  high,
uint8_t  low,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to a register.

Parameters
highHigh byte of register address.
lowLow byte of register address.
bufData to write.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 903 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ write_registers() [1/8]

void idfxx::i2c::master_device::write_registers ( std::initializer_list< uint16_t registers,
const uint8_t buf,
size_t  size 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1133 of file master.hpp.

◆ write_registers() [2/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_registers ( std::initializer_list< uint16_t registers,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1149 of file master.hpp.

References idfxx::timeout.

◆ write_registers() [3/8]

void idfxx::i2c::master_device::write_registers ( std::initializer_list< uint16_t registers,
std::span< const uint8_t buf 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1100 of file master.hpp.

◆ write_registers() [4/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_registers ( std::initializer_list< uint16_t registers,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1115 of file master.hpp.

References idfxx::timeout.

◆ write_registers() [5/8]

void idfxx::i2c::master_device::write_registers ( std::span< const uint16_t registers,
const uint8_t buf,
size_t  size 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1063 of file master.hpp.

References idfxx::unwrap().

◆ write_registers() [6/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_registers ( std::span< const uint16_t registers,
const uint8_t buf,
size_t  size,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
sizeNumber of bytes per register.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1079 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ write_registers() [7/8]

void idfxx::i2c::master_device::write_registers ( std::span< const uint16_t registers,
std::span< const uint8_t buf 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1030 of file master.hpp.

References idfxx::unwrap().

◆ write_registers() [8/8]

template<typename Rep , typename Period >
void idfxx::i2c::master_device::write_registers ( std::span< const uint16_t registers,
std::span< const uint8_t buf,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Writes data to multiple registers.

Parameters
registersRegister addresses.
bufData to write.
timeoutMaximum time to wait for completion.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron error.

Definition at line 1045 of file master.hpp.

References idfxx::timeout, and idfxx::unwrap().


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