diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-05-11 01:27:46 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-05-11 01:34:24 +0200 |
commit | e0809ab0fb64ff71be23e2d041d4fbae67dca234 (patch) | |
tree | 3ac40e1f52a0ed3981d2983074fafe70563548e6 /embassy-rp | |
parent | e6a8c8bfcce1e882d4cd6b37c83eb6662762810b (diff) | |
download | embassy-e0809ab0fb64ff71be23e2d041d4fbae67dca234.zip |
Switch to use PrioritX enums.
Diffstat (limited to 'embassy-rp')
-rw-r--r-- | embassy-rp/src/interrupt.rs | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/embassy-rp/src/interrupt.rs b/embassy-rp/src/interrupt.rs index cb9f3654..262f7f54 100644 --- a/embassy-rp/src/interrupt.rs +++ b/embassy-rp/src/interrupt.rs @@ -3,48 +3,9 @@ //! This module implements an API for managing interrupts compatible with //! nrf_softdevice::interrupt. Intended for switching between the two at compile-time. -use core::sync::atomic::{compiler_fence, Ordering}; - -use crate::pac::NVIC_PRIO_BITS; - // Re-exports pub use embassy::interrupt::{declare, take, Interrupt}; - -#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[repr(u8)] -pub enum Priority { - Level0 = 0, - Level1 = 1, - Level2 = 2, - Level3 = 3, - Level4 = 4, - Level5 = 5, - Level6 = 6, - Level7 = 7, -} - -impl From<u8> for Priority { - fn from(priority: u8) -> Self { - match priority >> (8 - NVIC_PRIO_BITS) { - 0 => Self::Level0, - 1 => Self::Level1, - 2 => Self::Level2, - 3 => Self::Level3, - 4 => Self::Level4, - 5 => Self::Level5, - 6 => Self::Level6, - 7 => Self::Level7, - _ => unreachable!(), - } - } -} - -impl From<Priority> for u8 { - fn from(p: Priority) -> Self { - (p as u8) << (8 - NVIC_PRIO_BITS) - } -} +pub use embassy_extras::interrupt::Priority3 as Priority; mod irqs { use super::*; |