Macro esp_ward::init_i2c_custom
source · macro_rules! init_i2c_custom { ($peripherals:ident, $clocks:ident, $sda_pin:expr, $scl_pin:expr, $freq:expr) => { ... }; }
Expand description
Initializes a custom I2C configuration, allowing for arbitrary SDA and SCL pins and frequency.
§Arguments
$peripherals
: The peripherals instance taken from the board.$clocks
: The system clocks initialized beforehand.$sda_pin
: The pin to use for SDA.$scl_pin
: The pin to use for SCL.$freq
: The frequency for I2C communication.
§Examples
let peripherals = esp_ward::take_periph!();
let system = esp_ward::take_system!(peripherals);
let (clocks, pins) = esp_ward::init_chip!(peripherals, system);
let mut i2c =
esp_ward::init_i2c_custom!(peripherals, &clocks, pins.gpio21, pins.gpio22, 100u32.kHz());