Skip to content

Commit 67ee1ce

Browse files
committed
Implement InterruptNumber for bare_metal::Nr
1 parent aa77c89 commit 67ee1ce

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/interrupt.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Interrupts
22
3-
pub use bare_metal::{CriticalSection, Mutex};
3+
pub use bare_metal::{CriticalSection, Mutex, Nr};
44

55
/// Trait for enums of external interrupt numbers.
66
///
@@ -23,6 +23,15 @@ pub unsafe trait InterruptNumber: Copy {
2323
fn number(self) -> u16;
2424
}
2525

26+
/// Implement InterruptNumber for the old bare_metal::Nr trait.
27+
/// This implementation is for backwards compatibility only and will be removed in cortex-m 0.8.
28+
#[deprecated(since="0.7.0", note="Please update your PAC to one using the latest svd2rust")]
29+
unsafe impl<T: Nr + Copy> InterruptNumber for T {
30+
fn number(self) -> u16 {
31+
self.nr() as u16
32+
}
33+
}
34+
2635
/// Disables all interrupts
2736
#[inline]
2837
pub fn disable() {

0 commit comments

Comments
 (0)