idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
I2C Component

Type-safe I2C master bus driver for ESP32. More...

Namespaces

namespace  idfxx
 
namespace  idfxx::i2c
 I2C master driver classes.
 

Classes

struct  idfxx::i2c::operation
 Describes a single operation in a custom I2C transaction sequence. More...
 
class  idfxx::i2c::master_bus
 I2C master bus controller with thread-safe device access. More...
 
class  idfxx::i2c::master_device
 I2C device at a specific address with register operations. More...
 

Typedefs

typedef struct i2c_master_bus_t * i2c_master_bus_handle_t
 
typedef struct i2c_master_dev_t * i2c_master_dev_handle_t
 

Enumerations

enum class  idfxx::i2c::port : int { idfxx::i2c::port::i2c0 = 0 }
 I2C port identifiers. More...
 
enum class  idfxx::i2c::clk_source : int { idfxx::i2c::clk_source::default_source = 0 }
 I2C master bus clock source. More...
 
enum class  idfxx::i2c::operation_command : int {
  idfxx::i2c::operation_command::start = 0 ,
  idfxx::i2c::operation_command::write = 1 ,
  idfxx::i2c::operation_command::read = 2 ,
  idfxx::i2c::operation_command::stop = 3
}
 I2C operation command type for custom transaction sequences. More...
 
enum class  idfxx::i2c::ack_value : uint8_t {
  idfxx::i2c::ack_value::ack = 0 ,
  idfxx::i2c::ack_value::nack = 1
}
 ACK value sent after a read operation. More...
 

Variables

static constexpr auto idfxx::i2c::DEFAULT_TIMEOUT = std::chrono::milliseconds(50)
 Default timeout for I2C operations.
 

Detailed Description

Type-safe I2C master bus driver for ESP32.

Provides I2C bus lifecycle management with thread-safe device access and register operations.

Depends on Core Utilities for error handling and GPIO Component for pin configuration.

Typedef Documentation

◆ i2c_master_bus_handle_t

typedef struct i2c_master_bus_t* i2c_master_bus_handle_t

Definition at line 39 of file master.hpp.

◆ i2c_master_dev_handle_t

typedef struct i2c_master_dev_t* i2c_master_dev_handle_t

Definition at line 40 of file master.hpp.

Enumeration Type Documentation

◆ ack_value

ACK value sent after a read operation.

Enumerator
ack 

Acknowledge — request more data.

nack 

Not-acknowledge — signal end of read.

Definition at line 116 of file master.hpp.

◆ clk_source

I2C master bus clock source.

Enumerator
default_source 

Default clock source for the target.

Definition at line 73 of file master.hpp.

◆ operation_command

I2C operation command type for custom transaction sequences.

Enumerator
start 

Send START or repeated-START condition.

write 

Write data to the bus.

read 

Read data from the bus.

stop 

Send STOP condition.

Definition at line 105 of file master.hpp.

◆ port

I2C port identifiers.

Enumerator
i2c0 

I2C port 0.

Definition at line 55 of file master.hpp.

Variable Documentation

◆ DEFAULT_TIMEOUT