pub struct RtcioWakeupSource<'a, 'b> { /* private fields */ }
Available on crate feature
unstable
only.Expand description
RTC_IO wakeup source
RTC_IO wakeup allows configuring any combination of RTC_IO pins with arbitrary wakeup levels to wake up the chip from sleep. This wakeup source can be used to wake up from both light and deep sleep.
let mut rtc = Rtc::new(peripherals.LPWR);
let reason = reset_reason(Cpu::ProCpu);
let wake_reason = wakeup_cause();
println!("{:?} {?}", reason, wake_reason);
let delay = Delay::new();
let timer = TimerWakeupSource::new(Duration::from_secs(10));
let mut pin_0 = peripherals.GPIO2;
let mut pin_1 = peripherals.GPIO3;
let wakeup_pins: &mut [(&mut dyn gpio::RtcPinWithResistors, WakeupLevel)] = &mut [
(&mut pin_0, WakeupLevel::Low),
(&mut pin_1, WakeupLevel::High),
];
let rtcio = RtcioWakeupSource::new(wakeup_pins);
delay.delay_millis(100);
rtc.sleep_deep(&[&timer, &rtcio]);
Implementations§
Source§impl<'a, 'b> RtcioWakeupSource<'a, 'b>
impl<'a, 'b> RtcioWakeupSource<'a, 'b>
Sourcepub fn new(
pins: &'a mut [(&'b mut dyn RtcIoWakeupPinType, WakeupLevel)],
) -> Self
pub fn new( pins: &'a mut [(&'b mut dyn RtcIoWakeupPinType, WakeupLevel)], ) -> Self
Creates a new external wake-up source (Ext1).
Trait Implementations§
Source§impl WakeSource for RtcioWakeupSource<'_, '_>
impl WakeSource for RtcioWakeupSource<'_, '_>
Source§fn apply(
&self,
_rtc: &Rtc<'_>,
triggers: &mut WakeTriggers,
sleep_config: &mut RtcSleepConfig,
)
fn apply( &self, _rtc: &Rtc<'_>, triggers: &mut WakeTriggers, sleep_config: &mut RtcSleepConfig, )
Configures the RTC and applies the wakeup triggers.