Struct Ext0WakeupSource

Source
pub struct Ext0WakeupSource<P: RtcIoWakeupPinType> { /* private fields */ }
Available on crate feature unstable only.
Expand description

External wake-up source (Ext0).


let delay = Delay::new();
let mut rtc = Rtc::new(peripherals.LPWR);

let config = InputConfig::default().with_pull(Pull::None);
let mut pin_4 = peripherals.GPIO4;
let pin_4_input = Input::new(pin_4.reborrow(), config);

let reason = reset_reason(Cpu::ProCpu);
let wake_reason = wakeup_cause();

println!("{:?} {?}", reason, wake_reason);

let timer = TimerWakeupSource::new(Duration::from_secs(30));

core::mem::drop(pin_4_input);
let ext0 = Ext0WakeupSource::new(pin_4, WakeupLevel::High);

delay.delay_millis(100);
rtc.sleep_deep(&[&timer, &ext0]);

Implementations§

Source§

impl<P: RtcIoWakeupPinType> Ext0WakeupSource<P>

Source

pub fn new(pin: P, level: WakeupLevel) -> Self

Creates a new external wake-up source (Ext0``) with the specified pin and wake-up level.

Trait Implementations§

Source§

impl<P: RtcPin> Drop for Ext0WakeupSource<P>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<P: RtcPin> WakeSource for Ext0WakeupSource<P>

Source§

fn apply( &self, _rtc: &Rtc<'_>, triggers: &mut WakeTriggers, sleep_config: &mut RtcSleepConfig, )

Configures the RTC and applies the wakeup triggers.

Auto Trait Implementations§

§

impl<P> !Freeze for Ext0WakeupSource<P>

§

impl<P> !RefUnwindSafe for Ext0WakeupSource<P>

§

impl<P> Send for Ext0WakeupSource<P>
where P: Send,

§

impl<P> !Sync for Ext0WakeupSource<P>

§

impl<P> Unpin for Ext0WakeupSource<P>
where P: Unpin,

§

impl<P> UnwindSafe for Ext0WakeupSource<P>
where P: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.