diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-07-23 14:00:19 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-07-23 14:00:19 +0200 |
| commit | 4901c34d9c4cd326ab9bca02dd099a663da2567f (patch) | |
| tree | 8225afebb595fb10c1d67148c0d19b7b732853da /embassy-cortex-m | |
| parent | 8a9d2f59af004902d3978a2922843833b98bcce0 (diff) | |
Rename Unborrowed -> PeripheralRef, Unborrow -> Peripheral
Diffstat (limited to 'embassy-cortex-m')
| -rw-r--r-- | embassy-cortex-m/src/interrupt.rs | 4 | ||||
| -rw-r--r-- | embassy-cortex-m/src/peripheral.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/embassy-cortex-m/src/interrupt.rs b/embassy-cortex-m/src/interrupt.rs index 715f00381..7358caa46 100644 --- a/embassy-cortex-m/src/interrupt.rs +++ b/embassy-cortex-m/src/interrupt.rs | |||
| @@ -3,7 +3,7 @@ use core::{mem, ptr}; | |||
| 3 | 3 | ||
| 4 | use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering}; | 4 | use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering}; |
| 5 | use cortex_m::peripheral::NVIC; | 5 | use cortex_m::peripheral::NVIC; |
| 6 | use embassy_hal_common::Unborrow; | 6 | use embassy_hal_common::Peripheral; |
| 7 | pub use embassy_macros::cortex_m_interrupt_take as take; | 7 | pub use embassy_macros::cortex_m_interrupt_take as take; |
| 8 | 8 | ||
| 9 | /// Implementation detail, do not use outside embassy crates. | 9 | /// Implementation detail, do not use outside embassy crates. |
| @@ -32,7 +32,7 @@ unsafe impl cortex_m::interrupt::InterruptNumber for NrWrap { | |||
| 32 | 32 | ||
| 33 | /// Represents an interrupt type that can be configured by embassy to handle | 33 | /// Represents an interrupt type that can be configured by embassy to handle |
| 34 | /// interrupts. | 34 | /// interrupts. |
| 35 | pub unsafe trait Interrupt: Unborrow<Target = Self> { | 35 | pub unsafe trait Interrupt: Peripheral<P = Self> { |
| 36 | /// Return the NVIC interrupt number for this interrupt. | 36 | /// Return the NVIC interrupt number for this interrupt. |
| 37 | fn number(&self) -> u16; | 37 | fn number(&self) -> u16; |
| 38 | /// Steal an instance of this interrupt | 38 | /// Steal an instance of this interrupt |
diff --git a/embassy-cortex-m/src/peripheral.rs b/embassy-cortex-m/src/peripheral.rs index c5fa20e71..e2f295579 100644 --- a/embassy-cortex-m/src/peripheral.rs +++ b/embassy-cortex-m/src/peripheral.rs | |||
| @@ -3,7 +3,7 @@ use core::mem::MaybeUninit; | |||
| 3 | 3 | ||
| 4 | use cortex_m::peripheral::scb::VectActive; | 4 | use cortex_m::peripheral::scb::VectActive; |
| 5 | use cortex_m::peripheral::{NVIC, SCB}; | 5 | use cortex_m::peripheral::{NVIC, SCB}; |
| 6 | use embassy_hal_common::{unborrow, Unborrow, Unborrowed}; | 6 | use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; |
| 7 | 7 | ||
| 8 | use crate::interrupt::{Interrupt, InterruptExt, Priority}; | 8 | use crate::interrupt::{Interrupt, InterruptExt, Priority}; |
| 9 | 9 | ||
| @@ -33,7 +33,7 @@ impl<S> StateStorage<S> { | |||
| 33 | /// a safe way. | 33 | /// a safe way. |
| 34 | pub struct PeripheralMutex<'a, S: PeripheralState> { | 34 | pub struct PeripheralMutex<'a, S: PeripheralState> { |
| 35 | state: *mut S, | 35 | state: *mut S, |
| 36 | irq: Unborrowed<'a, S::Interrupt>, | 36 | irq: PeripheralRef<'a, S::Interrupt>, |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | /// Whether `irq` can be preempted by the current interrupt. | 39 | /// Whether `irq` can be preempted by the current interrupt. |
| @@ -62,11 +62,11 @@ impl<'a, S: PeripheralState> PeripheralMutex<'a, S> { | |||
| 62 | /// | 62 | /// |
| 63 | /// Registers `on_interrupt` as the `irq`'s handler, and enables it. | 63 | /// Registers `on_interrupt` as the `irq`'s handler, and enables it. |
| 64 | pub fn new( | 64 | pub fn new( |
| 65 | irq: impl Unborrow<Target = S::Interrupt> + 'a, | 65 | irq: impl Peripheral<P = S::Interrupt> + 'a, |
| 66 | storage: &'a mut StateStorage<S>, | 66 | storage: &'a mut StateStorage<S>, |
| 67 | init: impl FnOnce() -> S, | 67 | init: impl FnOnce() -> S, |
| 68 | ) -> Self { | 68 | ) -> Self { |
| 69 | unborrow!(irq); | 69 | into_ref!(irq); |
| 70 | 70 | ||
| 71 | if can_be_preempted(&*irq) { | 71 | if can_be_preempted(&*irq) { |
| 72 | panic!( | 72 | panic!( |
