PeripheralMutex should be Unpin
This commit is contained in:
parent
e454969000
commit
03ddc949a0
@ -8,6 +8,7 @@ use example_common::*;
|
|||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use defmt::panic;
|
use defmt::panic;
|
||||||
|
use futures::pin_mut;
|
||||||
use nrf52840_hal as hal;
|
use nrf52840_hal as hal;
|
||||||
use nrf52840_hal::gpio;
|
use nrf52840_hal::gpio;
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ async fn run() {
|
|||||||
buffered_uarte::Parity::EXCLUDED,
|
buffered_uarte::Parity::EXCLUDED,
|
||||||
buffered_uarte::Baudrate::BAUD115200,
|
buffered_uarte::Baudrate::BAUD115200,
|
||||||
);
|
);
|
||||||
|
pin_mut!(u);
|
||||||
|
|
||||||
info!("uarte initialized!");
|
info!("uarte initialized!");
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
use core::cell::UnsafeCell;
|
||||||
|
use core::marker::{PhantomData, PhantomPinned};
|
||||||
use core::pin::Pin;
|
use core::pin::Pin;
|
||||||
use core::sync::atomic::{compiler_fence, Ordering};
|
use core::sync::atomic::{compiler_fence, Ordering};
|
||||||
use core::{cell::UnsafeCell, marker::PhantomData};
|
|
||||||
|
|
||||||
use crate::fmt::*;
|
use crate::fmt::*;
|
||||||
use crate::interrupt::OwnedInterrupt;
|
use crate::interrupt::OwnedInterrupt;
|
||||||
@ -12,14 +13,16 @@ pub trait PeripheralState {
|
|||||||
|
|
||||||
pub struct PeripheralMutex<S: PeripheralState> {
|
pub struct PeripheralMutex<S: PeripheralState> {
|
||||||
inner: Option<(UnsafeCell<S>, S::Interrupt)>,
|
inner: Option<(UnsafeCell<S>, S::Interrupt)>,
|
||||||
not_send: PhantomData<*mut ()>,
|
_not_send: PhantomData<*mut ()>,
|
||||||
|
_pinned: PhantomPinned,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: PeripheralState> PeripheralMutex<S> {
|
impl<S: PeripheralState> PeripheralMutex<S> {
|
||||||
pub fn new(state: S, irq: S::Interrupt) -> Self {
|
pub fn new(state: S, irq: S::Interrupt) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: Some((UnsafeCell::new(state), irq)),
|
inner: Some((UnsafeCell::new(state), irq)),
|
||||||
not_send: PhantomData,
|
_not_send: PhantomData,
|
||||||
|
_pinned: PhantomPinned,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user