aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index f5c8b992..5d49af17 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,6 +12,7 @@ pub use cortex_m::asm::{bkpt, wfi};
pub use cortex_m::interrupt::CriticalSection;
pub use cortex_m::interrupt::free as atomic;
pub use static_ref::Static;
+use cortex_m::interrupt::Nr;
#[cfg(not(armv6m))]
use cortex_m::register::{basepri_max, basepri};
@@ -175,6 +176,16 @@ impl Threshold {
impl !Send for Threshold {}
+/// Sets an interrupt as pending
+pub fn set_pending<I>(interrupt: I)
+where
+ I: Nr,
+{
+ // NOTE(safe) atomic write
+ let nvic = unsafe { &*cortex_m::peripheral::NVIC.get() };
+ nvic.set_pending(interrupt);
+}
+
#[macro_export]
macro_rules! task {
($NAME:ident, $body:path) => {