aboutsummaryrefslogtreecommitdiff
path: root/src/interrupt.rs
diff options
context:
space:
mode:
authorGravatar Adam Greig <adam@adamgreig.com> 2020-09-20 14:54:34 +0100
committerGravatar Adam Greig <adam@adamgreig.com> 2020-09-20 14:54:34 +0100
commit67ee1ce6c485262ca2ea4d551d5cef2fc69fdd23 (patch)
tree3e1f291afe6a913f8062150da83567820ed6e525 /src/interrupt.rs
parentaa77c89a5ff0f81f5bbd52799fe8caf12fb493d6 (diff)
downloadcortex-m-67ee1ce6c485262ca2ea4d551d5cef2fc69fdd23.tar.gz
cortex-m-67ee1ce6c485262ca2ea4d551d5cef2fc69fdd23.tar.zst
cortex-m-67ee1ce6c485262ca2ea4d551d5cef2fc69fdd23.zip
Implement InterruptNumber for bare_metal::Nr
Diffstat (limited to 'src/interrupt.rs')
-rw-r--r--src/interrupt.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/interrupt.rs b/src/interrupt.rs
index 68719ec..ad76ff2 100644
--- a/src/interrupt.rs
+++ b/src/interrupt.rs
@@ -1,6 +1,6 @@
//! Interrupts
-pub use bare_metal::{CriticalSection, Mutex};
+pub use bare_metal::{CriticalSection, Mutex, Nr};
/// Trait for enums of external interrupt numbers.
///
@@ -23,6 +23,15 @@ pub unsafe trait InterruptNumber: Copy {
fn number(self) -> u16;
}
+/// Implement InterruptNumber for the old bare_metal::Nr trait.
+/// This implementation is for backwards compatibility only and will be removed in cortex-m 0.8.
+#[deprecated(since="0.7.0", note="Please update your PAC to one using the latest svd2rust")]
+unsafe impl<T: Nr + Copy> InterruptNumber for T {
+ fn number(self) -> u16 {
+ self.nr() as u16
+ }
+}
+
/// Disables all interrupts
#[inline]
pub fn disable() {