restrict unsafe block

This commit is contained in:
xoviat
2021-01-06 21:02:02 -06:00
parent 31ba052f14
commit a168b9ef51
2 changed files with 53 additions and 57 deletions

View File

@ -28,8 +28,8 @@ async fn run(dp: stm32::Peripherals, cp: cortex_m::Peripherals) {
.pclk1(24.mhz())
.freeze();
unsafe {
let mut serial = serial::Serial::new(
let mut serial = unsafe {
serial::Serial::new(
gpioa.pa9.into_alternate_af7(),
gpioa.pa10.into_alternate_af7(),
interrupt::take!(DMA2_STREAM7),
@ -40,12 +40,12 @@ async fn run(dp: stm32::Peripherals, cp: cortex_m::Peripherals) {
config::Parity::ParityNone,
9600.bps(),
clocks,
);
let buf = singleton!(: [u8; 30] = [0; 30]).unwrap();
)
};
let buf = singleton!(: [u8; 30] = [0; 30]).unwrap();
buf[5] = 0x01;
serial.send(buf).await;
}
buf[5] = 0x01;
serial.send(buf).await;
}
static EXECUTOR: Forever<Executor> = Forever::new();