pub fn write_ll(mask: u32, value: u32)Expand description
Low-level function to write any number of dedicated output channels at once.
The mask selects which channels to write to. Channel positions are in
order: bit 0 marks channel 0, bit 1 marks channel 1, etc.
value is the value to write to the selected channels. A 0 bit sets the
channel’s output to low, a 1 bit sets it to high.
§Example
use esp_hal::gpio::{
Level,
Output,
OutputConfig,
dedicated::{DedicatedGpio, DedicatedGpioOutput, write_ll},
};
// Create dedicated GPIO drivers:
let channels = DedicatedGpio::new(peripherals.GPIO_DEDICATED);
let dedicated_output0 = DedicatedGpioOutput::new(channels.channel0);
let dedicated_output1 = DedicatedGpioOutput::new(channels.channel1);
let dedicated_output2 = DedicatedGpioOutput::new(channels.channel2);
// Configure output drivers:
let output0 = Output::new(peripherals.GPIO0, Level::Low, OutputConfig::default());
let output1 = Output::new(peripherals.GPIO1, Level::Low, OutputConfig::default());
let output2 = Output::new(peripherals.GPIO2, Level::Low, OutputConfig::default());
let output3 = Output::new(peripherals.GPIO3, Level::Low, OutputConfig::default());
// Configure dedicated output drivers:
let dedicated_output0 = dedicated_output0.with_pin(output0).with_pin(output1);
let dedicated_output1 = dedicated_output1.with_pin(output2);
let dedicated_output2 = dedicated_output2.with_pin(output3);
// Write all pins at once:
const MASK: u32 = 0b00000111;
const VALUE: u32 = 0b00000101; // Set GPIOs 0, 1, and 3 to high, 2 to low.
write_ll(MASK, VALUE);