[][src]Trait esp32_hal::gpio::Pin

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) { ... } }

Functions available on all pins

Required methods

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

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
)

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 unlisten(&mut self)

Stop listening to all pin interrupts

fn clear_interrupt(&mut self)

Clear a pending interrupt

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

Check if the non maskable interrupt for this pin is set for the current core

fn enable_hold(&mut self, on: bool)

Enable/Disable holding of the pads current state even through reset or deep sleep

Loading content...

Provided methods

fn listen(&mut self, event: Event)

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.

Loading content...

Implementors

impl<MODE> Pin for Gpio0<MODE>[src]

impl<MODE> Pin for Gpio1<MODE>[src]

impl<MODE> Pin for Gpio2<MODE>[src]

impl<MODE> Pin for Gpio3<MODE>[src]

impl<MODE> Pin for Gpio4<MODE>[src]

impl<MODE> Pin for Gpio5<MODE>[src]

impl<MODE> Pin for Gpio6<MODE>[src]

impl<MODE> Pin for Gpio7<MODE>[src]

impl<MODE> Pin for Gpio8<MODE>[src]

impl<MODE> Pin for Gpio9<MODE>[src]

impl<MODE> Pin for Gpio10<MODE>[src]

impl<MODE> Pin for Gpio11<MODE>[src]

impl<MODE> Pin for Gpio12<MODE>[src]

impl<MODE> Pin for Gpio13<MODE>[src]

impl<MODE> Pin for Gpio14<MODE>[src]

impl<MODE> Pin for Gpio15<MODE>[src]

impl<MODE> Pin for Gpio16<MODE>[src]

impl<MODE> Pin for Gpio17<MODE>[src]

impl<MODE> Pin for Gpio18<MODE>[src]

impl<MODE> Pin for Gpio19<MODE>[src]

impl<MODE> Pin for Gpio20<MODE>[src]

impl<MODE> Pin for Gpio21<MODE>[src]

impl<MODE> Pin for Gpio22<MODE>[src]

impl<MODE> Pin for Gpio23<MODE>[src]

impl<MODE> Pin for Gpio25<MODE>[src]

impl<MODE> Pin for Gpio26<MODE>[src]

impl<MODE> Pin for Gpio27<MODE>[src]

impl<MODE> Pin for Gpio32<MODE>[src]

impl<MODE> Pin for Gpio33<MODE>[src]

impl<MODE> Pin for Gpio34<MODE>[src]

impl<MODE> Pin for Gpio35<MODE>[src]

impl<MODE> Pin for Gpio36<MODE>[src]

impl<MODE> Pin for Gpio37<MODE>[src]

impl<MODE> Pin for Gpio38<MODE>[src]

impl<MODE> Pin for Gpio39<MODE>[src]

Loading content...