Trait esp32_hal::gpio::Pin [−][src]
pub trait Pin { fn sleep_mode(&mut self, on: bool) -> &mut Self; fn set_alternate_function(
&mut self,
alternate: AlternateFunction
) -> &mut Self; fn listen_with_options(
&mut self,
event: Event,
pro_int: bool,
app_int: bool,
pro_nmi: bool,
app_nmi: bool,
wake_up_from_light_sleep: bool
); fn unlisten(&mut self); fn clear_interrupt(&mut self); fn is_interrupt_set(&mut self) -> bool; fn is_non_maskable_interrupt_set(&mut self) -> bool; fn enable_hold(&mut self, on: bool); fn listen(&mut self, event: Event) { ... } }
Expand description
Functions available on all pins
Required methods
fn sleep_mode(&mut self, on: bool) -> &mut Self
fn sleep_mode(&mut self, on: bool) -> &mut Self
Enable/Disable the sleep mode of the pad
fn set_alternate_function(&mut self, alternate: AlternateFunction) -> &mut Self
fn set_alternate_function(&mut self, alternate: AlternateFunction) -> &mut Self
Set the alternate function
fn listen_with_options(
&mut self,
event: Event,
pro_int: bool,
app_int: bool,
pro_nmi: bool,
app_nmi: bool,
wake_up_from_light_sleep: bool
)
fn listen_with_options(
&mut self,
event: Event,
pro_int: bool,
app_int: bool,
pro_nmi: bool,
app_nmi: bool,
wake_up_from_light_sleep: bool
)
Start listening to pin interrupt event
The event sets the type of edge or level triggering. Interrupts can be individually enabled for the app and pro cores and either a regular interrupt can be fired or a non-maskable interrupt (NMI). Also wake-up from light sleep can be enabled
This function overwrites any previous settings, so if any of the boolean are set to false the interrupt of that type and to that core are disabled.
*Note: Edge triggering is not supported for wake-up
Note: Even though the interrupt is called NMI it can be routed to any level via the interrupt::enable_with_priority function.
Note: ESP32 has a bug (3.14), which prevents correct triggering of interrupts when multiple GPIOs are configured for edge triggering in a group (GPIO0-31 is one group, GPIO32-39 is the other group). This can be worked around by using level triggering on the GPIO with edge triggering on the CPU.
fn clear_interrupt(&mut self)
fn clear_interrupt(&mut self)
Clear a pending interrupt
fn is_interrupt_set(&mut self) -> bool
fn is_interrupt_set(&mut self) -> bool
Check if interrupt for this pin is set for the current core
fn is_non_maskable_interrupt_set(&mut self) -> bool
fn is_non_maskable_interrupt_set(&mut self) -> bool
Check if the non maskable interrupt for this pin is set for the current core
fn enable_hold(&mut self, on: bool)
fn enable_hold(&mut self, on: bool)
Enable/Disable holding of the pads current state even through reset or deep sleep
Provided methods
Start listening to pin interrupt event
The event sets the type of edge or level triggering.
This is a wrapper around listen_with_options, which enables the interrupt for the current core and disables all other options.
Note: ESP32 has a bug (3.14), which prevents correct triggering of interrupts when multiple GPIOs are configured for edge triggering in a group (GPIO0-31 is one group, GPIO32-39 is the other group). This can be worked around by using level triggering on the GPIO with edge triggering on the CPU.