diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-06-09 21:28:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 21:28:13 +0200 |
commit | db344c2bda55bd0352a43720788185cc4d3a420e (patch) | |
tree | b93b2d927d5c84b74dce456f9be5e88ec4bbfe18 /embassy-nrf | |
parent | 77c7d8f31b89d13117a7294842d60f02950fdd23 (diff) | |
download | embassy-db344c2bda55bd0352a43720788185cc4d3a420e.zip |
common/PeripheralMutex: remove unsafe API. (#802)
Following the project's decision that "leak unsafe" APIs are not marked as "unsafe",
update PeripheralMutex to accept non-'static state without unsafe.
Fixes #801
Diffstat (limited to 'embassy-nrf')
-rw-r--r-- | embassy-nrf/src/buffered_uarte.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index e1d32a31..6972d625 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs @@ -164,22 +164,20 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { ppi_ch2.enable(); Self { - inner: unsafe { - PeripheralMutex::new_unchecked(irq, &mut state.0, move || StateInner { - phantom: PhantomData, - timer, - _ppi_ch1: ppi_ch1, - _ppi_ch2: ppi_ch2, - - rx: RingBuffer::new(rx_buffer), - rx_state: RxState::Idle, - rx_waker: WakerRegistration::new(), - - tx: RingBuffer::new(tx_buffer), - tx_state: TxState::Idle, - tx_waker: WakerRegistration::new(), - }) - }, + inner: PeripheralMutex::new(irq, &mut state.0, move || StateInner { + phantom: PhantomData, + timer, + _ppi_ch1: ppi_ch1, + _ppi_ch2: ppi_ch2, + + rx: RingBuffer::new(rx_buffer), + rx_state: RxState::Idle, + rx_waker: WakerRegistration::new(), + + tx: RingBuffer::new(tx_buffer), + tx_state: TxState::Idle, + tx_waker: WakerRegistration::new(), + }), } } |