2021-03-07 23:15:40 +00:00
|
|
|
#![no_std]
|
|
|
|
|
|
|
|
// This mod MUST go first, so that the others see its macros.
|
|
|
|
pub(crate) mod fmt;
|
|
|
|
|
2021-03-21 19:57:49 +00:00
|
|
|
mod macros;
|
2021-01-03 00:40:40 +00:00
|
|
|
pub mod peripheral;
|
2021-03-26 22:20:27 +00:00
|
|
|
pub mod peripheral_shared;
|
2021-01-03 00:40:40 +00:00
|
|
|
pub mod ring_buffer;
|
2021-03-19 00:30:35 +00:00
|
|
|
pub mod usb;
|
2021-01-03 16:05:04 +00:00
|
|
|
|
|
|
|
/// 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();
|
|
|
|
}
|