aboutsummaryrefslogtreecommitdiff
path: root/embassy-extras/src/lib.rs
blob: 4a95173cf093f1ea99f6a278392789b4d495c2e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![no_std]

// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;

pub mod peripheral;
pub mod ring_buffer;

/// Low power blocking wait loop using WFE/SEV.
pub fn low_power_wait_until(mut condition: impl FnMut() -> bool) {
    while !condition() {
        // WFE might "eat" an event that would have otherwise woken the executor.
        cortex_m::asm::wfe();
    }
    // Retrigger an event to be transparent to the executor.
    cortex_m::asm::sev();
}