idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::i2c::master_bus::config Struct Reference

I2C master bus configuration. More...

#include <idfxx_i2c/include/idfxx/i2c/master.hpp>

Public Attributes

idfxx::gpio sda = gpio::nc()
 GPIO pin for the SDA line.
 
idfxx::gpio scl = gpio::nc()
 GPIO pin for the SCL line.
 
freq::hertz frequency {0}
 Clock frequency in Hz.
 
enum clk_source clk_source = clk_source::default_source
 Clock source for the I2C master bus.
 
uint8_t glitch_ignore_cnt = 7
 Glitch filter count (0-7). Higher values filter more noise.
 
std::optional< idfxx::intr_levelintr_level = {}
 Interrupt priority level, or empty for automatic.
 
size_t trans_queue_depth = 0
 Depth of internal transfer queue for asynchronous transactions.
 
bool enable_internal_pullup = true
 Enable internal pull-up resistors on SDA and SCL.
 
bool allow_pd = false
 Allow powering down the bus during light sleep.
 

Detailed Description

I2C master bus configuration.

All fields have sensible defaults, but you should define sda, scl, and frequency at minimum. For example:

.frequency = 400_kHz,
.glitch_ignore_cnt = 10,
.enable_internal_pullup = false,
});
I2C master bus controller with thread-safe device access.
Definition master.hpp:153
constexpr gpio gpio_21
Definition gpio.hpp:943
constexpr gpio gpio_22
Definition gpio.hpp:946
@ i2c0
I2C port 0.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Definition error.hpp:120

Definition at line 170 of file master.hpp.

Member Data Documentation

◆ allow_pd

bool idfxx::i2c::master_bus::config::allow_pd = false

Allow powering down the bus during light sleep.

Definition at line 182 of file master.hpp.

◆ clk_source

enum clk_source idfxx::i2c::master_bus::config::clk_source = clk_source::default_source

Clock source for the I2C master bus.

Definition at line 174 of file master.hpp.

◆ enable_internal_pullup

bool idfxx::i2c::master_bus::config::enable_internal_pullup = true

Enable internal pull-up resistors on SDA and SCL.

Definition at line 181 of file master.hpp.

◆ frequency

freq::hertz idfxx::i2c::master_bus::config::frequency {0}

Clock frequency in Hz.

Definition at line 173 of file master.hpp.

◆ glitch_ignore_cnt

uint8_t idfxx::i2c::master_bus::config::glitch_ignore_cnt = 7

Glitch filter count (0-7). Higher values filter more noise.

Definition at line 178 of file master.hpp.

◆ intr_level

std::optional<idfxx::intr_level> idfxx::i2c::master_bus::config::intr_level = {}

Interrupt priority level, or empty for automatic.

Definition at line 179 of file master.hpp.

◆ scl

idfxx::gpio idfxx::i2c::master_bus::config::scl = gpio::nc()

GPIO pin for the SCL line.

Definition at line 172 of file master.hpp.

◆ sda

idfxx::gpio idfxx::i2c::master_bus::config::sda = gpio::nc()

GPIO pin for the SDA line.

Definition at line 171 of file master.hpp.

◆ trans_queue_depth

size_t idfxx::i2c::master_bus::config::trans_queue_depth = 0

Depth of internal transfer queue for asynchronous transactions.

Definition at line 180 of file master.hpp.


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