diff options
| author | huntc <[email protected]> | 2021-12-01 09:14:24 +1100 |
|---|---|---|
| committer | huntc <[email protected]> | 2021-12-01 09:14:24 +1100 |
| commit | 469852c667cd7105d5eba7b197e1e2b5b9528d15 (patch) | |
| tree | c3a7b3e1d294ae129b38d11127dd88229fa0ed6e /examples/nrf/src/bin/buffered_uart.rs | |
| parent | e36e36dab6b19ae90c6f78b1cdd2233e295bd171 (diff) | |
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.
Diffstat (limited to 'examples/nrf/src/bin/buffered_uart.rs')
| -rw-r--r-- | examples/nrf/src/bin/buffered_uart.rs | 32 |
1 files changed, 15 insertions, 17 deletions
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) { | |||
| 24 | 24 | ||
| 25 | let irq = interrupt::take!(UARTE0_UART0); | 25 | let irq = interrupt::take!(UARTE0_UART0); |
| 26 | let mut state = State::new(); | 26 | let mut state = State::new(); |
| 27 | let u = unsafe { | 27 | let u = BufferedUarte::new( |
| 28 | BufferedUarte::new( | 28 | &mut state, |
| 29 | &mut state, | 29 | p.UARTE0, |
| 30 | p.UARTE0, | 30 | p.TIMER0, |
| 31 | p.TIMER0, | 31 | p.PPI_CH0, |
| 32 | p.PPI_CH0, | 32 | p.PPI_CH1, |
| 33 | p.PPI_CH1, | 33 | irq, |
| 34 | irq, | 34 | p.P0_08, |
| 35 | p.P0_08, | 35 | p.P0_06, |
| 36 | p.P0_06, | 36 | NoPin, |
| 37 | NoPin, | 37 | NoPin, |
| 38 | NoPin, | 38 | config, |
| 39 | config, | 39 | &mut rx_buffer, |
| 40 | &mut rx_buffer, | 40 | &mut tx_buffer, |
| 41 | &mut tx_buffer, | 41 | ); |
| 42 | ) | ||
| 43 | }; | ||
| 44 | pin_mut!(u); | 42 | pin_mut!(u); |
| 45 | 43 | ||
| 46 | info!("uarte initialized!"); | 44 | info!("uarte initialized!"); |
