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
This commit is contained in:
Dario Nieuwenhuis
2022-06-09 21:28:13 +02:00
committed by GitHub
parent 77c7d8f31b
commit db344c2bda
6 changed files with 25 additions and 48 deletions

View File

@ -22,8 +22,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
let irq = interrupt::take!(USART3);
let mut tx_buf = [0u8; 32];
let mut rx_buf = [0u8; 32];
let mut buf_usart =
unsafe { BufferedUart::new(&mut state, usart, irq, &mut tx_buf, &mut rx_buf) };
let mut buf_usart = BufferedUart::new(&mut state, usart, irq, &mut tx_buf, &mut rx_buf);
loop {
let buf = buf_usart.fill_buf().await.unwrap();