diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:15:44 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:22:31 +0200 |
| commit | a8703b75988e1e700af701116464025679d2feb8 (patch) | |
| tree | f4ec5de70ec05e793a774049e010935ac45853ed /embassy-cortex-m/src | |
| parent | 6199bdea710cde33e5d5381b6d6abfc8af46df19 (diff) | |
Run rustfmt.
Diffstat (limited to 'embassy-cortex-m/src')
| -rw-r--r-- | embassy-cortex-m/src/executor.rs | 4 | ||||
| -rw-r--r-- | embassy-cortex-m/src/interrupt.rs | 5 | ||||
| -rw-r--r-- | embassy-cortex-m/src/peripheral.rs | 11 |
3 files changed, 9 insertions, 11 deletions
diff --git a/embassy-cortex-m/src/executor.rs b/embassy-cortex-m/src/executor.rs index 63a1519cf..34f3ec236 100644 --- a/embassy-cortex-m/src/executor.rs +++ b/embassy-cortex-m/src/executor.rs | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | use core::marker::PhantomData; | 1 | use core::marker::PhantomData; |
| 2 | 2 | ||
| 3 | use crate::interrupt::{Interrupt, InterruptExt}; | 3 | pub use embassy::executor::Executor; |
| 4 | use embassy::executor::{raw, SendSpawner}; | 4 | use embassy::executor::{raw, SendSpawner}; |
| 5 | 5 | ||
| 6 | pub use embassy::executor::Executor; | 6 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 7 | 7 | ||
| 8 | fn pend_by_number(n: u16) { | 8 | fn pend_by_number(n: u16) { |
| 9 | #[derive(Clone, Copy)] | 9 | #[derive(Clone, Copy)] |
diff --git a/embassy-cortex-m/src/interrupt.rs b/embassy-cortex-m/src/interrupt.rs index df2aad0ec..72686b402 100644 --- a/embassy-cortex-m/src/interrupt.rs +++ b/embassy-cortex-m/src/interrupt.rs | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | use core::{mem, ptr}; | ||
| 2 | |||
| 1 | use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering}; | 3 | use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering}; |
| 2 | use core::mem; | ||
| 3 | use core::ptr; | ||
| 4 | use cortex_m::peripheral::NVIC; | 4 | use cortex_m::peripheral::NVIC; |
| 5 | use embassy_hal_common::Unborrow; | 5 | use embassy_hal_common::Unborrow; |
| 6 | |||
| 7 | pub use embassy_macros::cortex_m_interrupt_take as take; | 6 | pub use embassy_macros::cortex_m_interrupt_take as take; |
| 8 | 7 | ||
| 9 | /// Implementation detail, do not use outside embassy crates. | 8 | /// Implementation detail, do not use outside embassy crates. |
diff --git a/embassy-cortex-m/src/peripheral.rs b/embassy-cortex-m/src/peripheral.rs index 40277691c..5ff690831 100644 --- a/embassy-cortex-m/src/peripheral.rs +++ b/embassy-cortex-m/src/peripheral.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | use core::marker::PhantomData; | 1 | use core::marker::PhantomData; |
| 2 | use core::mem::MaybeUninit; | 2 | use core::mem::MaybeUninit; |
| 3 | |||
| 3 | use cortex_m::peripheral::scb::VectActive; | 4 | use cortex_m::peripheral::scb::VectActive; |
| 4 | use cortex_m::peripheral::{NVIC, SCB}; | 5 | use cortex_m::peripheral::{NVIC, SCB}; |
| 5 | 6 | ||
| @@ -53,13 +54,11 @@ impl<'a, S: PeripheralState> PeripheralMutex<'a, S> { | |||
| 53 | /// Create a new `PeripheralMutex` wrapping `irq`, with `init` initializing the initial state. | 54 | /// Create a new `PeripheralMutex` wrapping `irq`, with `init` initializing the initial state. |
| 54 | /// | 55 | /// |
| 55 | /// Registers `on_interrupt` as the `irq`'s handler, and enables it. | 56 | /// Registers `on_interrupt` as the `irq`'s handler, and enables it. |
| 56 | pub fn new( | 57 | pub fn new(irq: S::Interrupt, storage: &'a mut StateStorage<S>, init: impl FnOnce() -> S) -> Self { |
| 57 | irq: S::Interrupt, | ||
| 58 | storage: &'a mut StateStorage<S>, | ||
| 59 | init: impl FnOnce() -> S, | ||
| 60 | ) -> Self { | ||
| 61 | if can_be_preempted(&irq) { | 58 | if can_be_preempted(&irq) { |
| 62 | panic!("`PeripheralMutex` cannot be created in an interrupt with higher priority than the interrupt it wraps"); | 59 | panic!( |
| 60 | "`PeripheralMutex` cannot be created in an interrupt with higher priority than the interrupt it wraps" | ||
| 61 | ); | ||
| 63 | } | 62 | } |
| 64 | 63 | ||
| 65 | let state_ptr = storage.0.as_mut_ptr(); | 64 | let state_ptr = storage.0.as_mut_ptr(); |
