mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
add a queue
function
This commit is contained in:
parent
4c1b6c8293
commit
00ef129f87
1 changed files with 11 additions and 1 deletions
12
src/lib.rs
12
src/lib.rs
|
@ -11,7 +11,7 @@
|
||||||
extern crate cortex_m;
|
extern crate cortex_m;
|
||||||
|
|
||||||
use cortex_m::ctxt::Context;
|
use cortex_m::ctxt::Context;
|
||||||
use cortex_m::interrupt::CriticalSection;
|
use cortex_m::interrupt::{CriticalSection, Nr};
|
||||||
use cortex_m::peripheral::{Peripheral, NVIC, SCB};
|
use cortex_m::peripheral::{Peripheral, NVIC, SCB};
|
||||||
use cortex_m::register::{basepri, basepri_max};
|
use cortex_m::register::{basepri, basepri_max};
|
||||||
|
|
||||||
|
@ -362,6 +362,16 @@ pub fn logical(priority: u8) -> u8 {
|
||||||
((1 << PRIORITY_BITS) - priority) << (8 - PRIORITY_BITS)
|
((1 << PRIORITY_BITS) - priority) << (8 - PRIORITY_BITS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Puts `interrupt` in the "to execute" queue
|
||||||
|
///
|
||||||
|
/// This function has no effect if the interrupt was already queued
|
||||||
|
pub fn queue<I>(interrupt: I) where I: Nr {
|
||||||
|
unsafe {
|
||||||
|
// NOTE(safe) atomic write
|
||||||
|
(*NVIC.get()).set_pending(interrupt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Fake ceiling, indicates that the resource is shared by cooperative tasks
|
/// Fake ceiling, indicates that the resource is shared by cooperative tasks
|
||||||
pub struct C0 {
|
pub struct C0 {
|
||||||
_0: (),
|
_0: (),
|
||||||
|
|
Loading…
Reference in a new issue