aboutsummaryrefslogtreecommitdiff
path: root/embassy-cortex-m/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-06-12 22:15:44 +0200
committerDario Nieuwenhuis <[email protected]>2022-06-12 22:22:31 +0200
commita8703b75988e1e700af701116464025679d2feb8 (patch)
treef4ec5de70ec05e793a774049e010935ac45853ed /embassy-cortex-m/src
parent6199bdea710cde33e5d5381b6d6abfc8af46df19 (diff)
Run rustfmt.
Diffstat (limited to 'embassy-cortex-m/src')
-rw-r--r--embassy-cortex-m/src/executor.rs4
-rw-r--r--embassy-cortex-m/src/interrupt.rs5
-rw-r--r--embassy-cortex-m/src/peripheral.rs11
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 @@
1use core::marker::PhantomData; 1use core::marker::PhantomData;
2 2
3use crate::interrupt::{Interrupt, InterruptExt}; 3pub use embassy::executor::Executor;
4use embassy::executor::{raw, SendSpawner}; 4use embassy::executor::{raw, SendSpawner};
5 5
6pub use embassy::executor::Executor; 6use crate::interrupt::{Interrupt, InterruptExt};
7 7
8fn pend_by_number(n: u16) { 8fn 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 @@
1use core::{mem, ptr};
2
1use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering}; 3use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering};
2use core::mem;
3use core::ptr;
4use cortex_m::peripheral::NVIC; 4use cortex_m::peripheral::NVIC;
5use embassy_hal_common::Unborrow; 5use embassy_hal_common::Unborrow;
6
7pub use embassy_macros::cortex_m_interrupt_take as take; 6pub 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 @@
1use core::marker::PhantomData; 1use core::marker::PhantomData;
2use core::mem::MaybeUninit; 2use core::mem::MaybeUninit;
3
3use cortex_m::peripheral::scb::VectActive; 4use cortex_m::peripheral::scb::VectActive;
4use cortex_m::peripheral::{NVIC, SCB}; 5use 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();