mark new unsafe
This commit is contained in:
parent
1c3b7541cb
commit
31ba052f14
@ -8,6 +8,7 @@
|
|||||||
use cortex_m::singleton;
|
use cortex_m::singleton;
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use embassy::executor::{task, Executor};
|
use embassy::executor::{task, Executor};
|
||||||
|
use embassy::uart::Uart;
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
use embassy_stm32f4::interrupt;
|
use embassy_stm32f4::interrupt;
|
||||||
use embassy_stm32f4::serial;
|
use embassy_stm32f4::serial;
|
||||||
@ -27,24 +28,24 @@ async fn run(dp: stm32::Peripherals, cp: cortex_m::Peripherals) {
|
|||||||
.pclk1(24.mhz())
|
.pclk1(24.mhz())
|
||||||
.freeze();
|
.freeze();
|
||||||
|
|
||||||
let mut serial = serial::Serial::new(
|
unsafe {
|
||||||
gpioa.pa9.into_alternate_af7(),
|
let mut serial = serial::Serial::new(
|
||||||
gpioa.pa10.into_alternate_af7(),
|
gpioa.pa9.into_alternate_af7(),
|
||||||
interrupt::take!(DMA2_STREAM7),
|
gpioa.pa10.into_alternate_af7(),
|
||||||
interrupt::take!(DMA2_STREAM2),
|
interrupt::take!(DMA2_STREAM7),
|
||||||
interrupt::take!(USART1),
|
interrupt::take!(DMA2_STREAM2),
|
||||||
dp.DMA2,
|
interrupt::take!(USART1),
|
||||||
dp.USART1,
|
dp.DMA2,
|
||||||
config::Parity::ParityNone,
|
dp.USART1,
|
||||||
9600.bps(),
|
config::Parity::ParityNone,
|
||||||
clocks,
|
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();
|
static EXECUTOR: Forever<Executor> = Forever::new();
|
||||||
|
@ -57,7 +57,8 @@ static STATE: State = State {
|
|||||||
static mut INSTANCE: *const Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> = ptr::null_mut();
|
static mut INSTANCE: *const Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> = ptr::null_mut();
|
||||||
|
|
||||||
impl Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> {
|
impl Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> {
|
||||||
pub fn new(
|
// Leaking futures is forbidden!
|
||||||
|
pub unsafe fn new(
|
||||||
txd: PA9<Alternate<AF7>>,
|
txd: PA9<Alternate<AF7>>,
|
||||||
rxd: PA10<Alternate<AF7>>,
|
rxd: PA10<Alternate<AF7>>,
|
||||||
tx_int: interrupt::DMA2_STREAM7Interrupt,
|
tx_int: interrupt::DMA2_STREAM7Interrupt,
|
||||||
|
Loading…
Reference in New Issue
Block a user