diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-02-20 00:27:24 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-02-20 00:27:24 +0100 |
| commit | 03ddc949a04c6dd76cb30eefb4a7bce9111cfbbc (patch) | |
| tree | 53bf70677083b5cc30f9e1a4f7f59edb0dc0102b /embassy-nrf | |
| parent | e45496900009c0049617fc4930cc5130980c0e4a (diff) | |
PeripheralMutex should be Unpin
Diffstat (limited to 'embassy-nrf')
| -rw-r--r-- | embassy-nrf/src/util/peripheral.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/embassy-nrf/src/util/peripheral.rs b/embassy-nrf/src/util/peripheral.rs index fee343d90..6062c9d32 100644 --- a/embassy-nrf/src/util/peripheral.rs +++ b/embassy-nrf/src/util/peripheral.rs | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | use core::cell::UnsafeCell; | ||
| 2 | use core::marker::{PhantomData, PhantomPinned}; | ||
| 1 | use core::pin::Pin; | 3 | use core::pin::Pin; |
| 2 | use core::sync::atomic::{compiler_fence, Ordering}; | 4 | use core::sync::atomic::{compiler_fence, Ordering}; |
| 3 | use core::{cell::UnsafeCell, marker::PhantomData}; | ||
| 4 | 5 | ||
| 5 | use crate::fmt::*; | 6 | use crate::fmt::*; |
| 6 | use crate::interrupt::OwnedInterrupt; | 7 | use crate::interrupt::OwnedInterrupt; |
| @@ -12,14 +13,16 @@ pub trait PeripheralState { | |||
| 12 | 13 | ||
| 13 | pub struct PeripheralMutex<S: PeripheralState> { | 14 | pub struct PeripheralMutex<S: PeripheralState> { |
| 14 | inner: Option<(UnsafeCell<S>, S::Interrupt)>, | 15 | inner: Option<(UnsafeCell<S>, S::Interrupt)>, |
| 15 | not_send: PhantomData<*mut ()>, | 16 | _not_send: PhantomData<*mut ()>, |
| 17 | _pinned: PhantomPinned, | ||
| 16 | } | 18 | } |
| 17 | 19 | ||
| 18 | impl<S: PeripheralState> PeripheralMutex<S> { | 20 | impl<S: PeripheralState> PeripheralMutex<S> { |
| 19 | pub fn new(state: S, irq: S::Interrupt) -> Self { | 21 | pub fn new(state: S, irq: S::Interrupt) -> Self { |
| 20 | Self { | 22 | Self { |
| 21 | inner: Some((UnsafeCell::new(state), irq)), | 23 | inner: Some((UnsafeCell::new(state), irq)), |
| 22 | not_send: PhantomData, | 24 | _not_send: PhantomData, |
| 25 | _pinned: PhantomPinned, | ||
| 23 | } | 26 | } |
| 24 | } | 27 | } |
| 25 | 28 | ||
