pub struct DedicatedGpioOutput<'lt> { /* private fields */ }Expand description
A dedicated GPIO output driver.
Due to how the hardware works, DedicatedGpioOutput can drive any number of GPIO pins. To
create a driver, you can use the DedicatedGpioOutput::new method, then
DedicatedGpioOutput::with_pin to add output drivers.
output_level is currently not available on ESP32-S3 due to
an LLVM bug. See https://github.com/espressif/llvm-project/issues/120 for details.
§Examples
use esp_hal::gpio::{
Level,
Output,
OutputConfig,
dedicated::{DedicatedGpio, DedicatedGpioOutput},
};
// Create a dedicated GPIO driver:
let channels = DedicatedGpio::new(peripherals.GPIO_DEDICATED);
let dedicated_output = DedicatedGpioOutput::new(channels.channel0);
// Add any number of output pin drivers:
let output = Output::new(peripherals.GPIO0, Level::Low, OutputConfig::default());
let mut dedicated_output = dedicated_output.with_pin(output);
// Now you can use the pin.
dedicated_output.set_level(Level::High);Implementations§
Source§impl<'lt> DedicatedGpioOutput<'lt>
impl<'lt> DedicatedGpioOutput<'lt>
Sourcepub fn new<CH>(channel: CH) -> Selfwhere
CH: OutputChannel + 'lt,
pub fn new<CH>(channel: CH) -> Selfwhere
CH: OutputChannel + 'lt,
Creates a new dedicated GPIO output driver.
This function returns an empty driver. You will need to add output drivers to it using the
Self::with_pin method.
Sourcepub fn with_pin(self, pin: impl OutputDriver + 'lt) -> Self
pub fn with_pin(self, pin: impl OutputDriver + 'lt) -> Self
Adds a new output driver to the GPIO pins.
A dedicated GPIO output driver can control any number of GPIO pins. The pins will be released when the driver is dropped. This function does not change the state of the newly added GPIO pin.
Trait Implementations§
Source§impl Drop for DedicatedGpioOutput<'_>
Available on crate feature unstable only.
impl Drop for DedicatedGpioOutput<'_>
Available on crate feature
unstable only.Source§impl ErrorType for DedicatedGpioOutput<'_>
Available on crate feature unstable only.
impl ErrorType for DedicatedGpioOutput<'_>
Available on crate feature
unstable only.Source§impl OutputPin for DedicatedGpioOutput<'_>
Available on crate feature unstable only.
impl OutputPin for DedicatedGpioOutput<'_>
Available on crate feature
unstable only.