pub struct Regular<'r> { /* private fields */ }Expand description
Regular sleep mode
Provides a Sleep implementation for the regular sleep mode and uses the
WKT to wake the microcontroller up again, at the right time. Only clocks
that the WKT supports can be used. See wkt::Clock for more details.
§Examples
use lpc8xx_hal::{
prelude::*,
Peripherals,
clock::Ticks,
pac::CorePeripherals,
sleep,
};
let mut cp = CorePeripherals::take().unwrap();
let mut p = Peripherals::take().unwrap();
let mut pmu = p.PMU.split();
let mut syscon = p.SYSCON.split();
let mut wkt = p.WKT.enable(&mut syscon.handle);
let clock = syscon.iosc_derived_clock;
let mut sleep = sleep::Regular::prepare(
&mut pmu.handle,
&mut cp.SCB,
&mut wkt,
);
let delay = Ticks { value: 750_000, clock: &clock }; // 1000 ms
// This will put the microcontroller into sleep mode.
sleep.sleep(delay);Implementations§
Source§impl<'r> Regular<'r>
impl<'r> Regular<'r>
Sourcepub fn prepare(pmu: &'r mut Handle, scb: &'r mut SCB, wkt: &'r mut WKT) -> Self
pub fn prepare(pmu: &'r mut Handle, scb: &'r mut SCB, wkt: &'r mut WKT) -> Self
Prepare regular sleep mode
Returns an instance of sleep::Regular, which implements Sleep and
can therefore be used to put the microcontroller to sleep.
Requires references to various peripherals, which will be borrowed for
as long as the sleep::Regular instance exists, as they will be needed
for every call to Sleep::sleep.
Trait Implementations§
Auto Trait Implementations§
impl<'r> Freeze for Regular<'r>
impl<'r> RefUnwindSafe for Regular<'r>
impl<'r> Send for Regular<'r>
impl<'r> !Sync for Regular<'r>
impl<'r> Unpin for Regular<'r>
impl<'r> !UnwindSafe for Regular<'r>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more