On ESP32-S2 and ESP32-S3, the GPIO’s output is always enabled.
Note that the driver must only be used on the core that has created it. Do not send the driver to
another core, either directly, or indirectly via a thread that is not pinned to a core.
use esp_hal::gpio::{
Flex,
Input,
Level,
dedicated::{DedicatedGpio, DedicatedGpioFlex},
};
// Create a pin driver:
let flex = Flex::new(peripherals.GPIO0);
// Create a dedicated GPIO driver:
let channels = DedicatedGpio::new(peripherals.GPIO_DEDICATED);
let mut dedicated_io = DedicatedGpioFlex::new(channels.channel0, flex);
// Now you can use the pin:
let level = dedicated_io.level();