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.
This commit is contained in:
@ -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!");
|
||||
|
@ -18,8 +18,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
config.baudrate = uarte::Baudrate::BAUD115200;
|
||||
|
||||
let irq = interrupt::take!(UARTE0_UART0);
|
||||
let mut uart =
|
||||
unsafe { uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, NoPin, NoPin, config) };
|
||||
let mut uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, NoPin, NoPin, config);
|
||||
|
||||
info!("uarte initialized!");
|
||||
|
||||
|
Reference in New Issue
Block a user