From 469852c667cd7105d5eba7b197e1e2b5b9528d15 Mon Sep 17 00:00:00 2001 From: huntc Date: Wed, 1 Dec 2021 09:14:24 +1100 Subject: Removed unsafe from uarte The constructors themselves are not strictly unsafe. Interactions with DMA can be generally unsafe if a future is dropped, but that's a separate issue. It is important that we use the `unsafe` keyword diligently as it can lead to confusion otherwise. --- examples/nrf/src/bin/buffered_uart.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'examples/nrf/src/bin/buffered_uart.rs') diff --git a/examples/nrf/src/bin/buffered_uart.rs b/examples/nrf/src/bin/buffered_uart.rs index 90d288780..5d9075edf 100644 --- a/examples/nrf/src/bin/buffered_uart.rs +++ b/examples/nrf/src/bin/buffered_uart.rs @@ -24,23 +24,21 @@ async fn main(_spawner: Spawner, p: Peripherals) { let irq = interrupt::take!(UARTE0_UART0); let mut state = State::new(); - let u = unsafe { - BufferedUarte::new( - &mut state, - p.UARTE0, - p.TIMER0, - p.PPI_CH0, - p.PPI_CH1, - irq, - p.P0_08, - p.P0_06, - NoPin, - NoPin, - config, - &mut rx_buffer, - &mut tx_buffer, - ) - }; + let u = BufferedUarte::new( + &mut state, + p.UARTE0, + p.TIMER0, + p.PPI_CH0, + p.PPI_CH1, + irq, + p.P0_08, + p.P0_06, + NoPin, + NoPin, + config, + &mut rx_buffer, + &mut tx_buffer, + ); pin_mut!(u); info!("uarte initialized!"); -- cgit