Review changes
This commit is contained in:
parent
4271226fc0
commit
1028b5c671
1 changed files with 5 additions and 21 deletions
|
@ -5,20 +5,17 @@
|
||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use embassy::executor::Executor;
|
use embassy::executor::Spawner;
|
||||||
use embassy::util::Forever;
|
|
||||||
use embassy_stm32::dma::NoDma;
|
use embassy_stm32::dma::NoDma;
|
||||||
use embassy_stm32::usart::{Config, Uart};
|
use embassy_stm32::usart::{Config, Uart};
|
||||||
|
use embassy_stm32::Peripherals;
|
||||||
use embassy_traits::uart::Write as _Write;
|
use embassy_traits::uart::Write as _Write;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::main]
|
||||||
async fn main_task() {
|
async fn main(_spawner: Spawner, p: Peripherals) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let mut usart = Uart::new(p.UART7, p.PA8, p.PA15, p.DMA1_CH1, NoDma, config);
|
let mut usart = Uart::new(p.UART7, p.PA8, p.PA15, p.DMA1_CH1, NoDma, config);
|
||||||
|
|
||||||
|
@ -26,21 +23,8 @@ async fn main_task() {
|
||||||
let mut s: String<128> = String::new();
|
let mut s: String<128> = String::new();
|
||||||
core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap();
|
core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap();
|
||||||
|
|
||||||
usart.write(s.as_bytes()).await.ok();
|
unwrap!(usart.write(s.as_bytes()).await);
|
||||||
|
|
||||||
info!("wrote DMA");
|
info!("wrote DMA");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static EXECUTOR: Forever<Executor> = Forever::new();
|
|
||||||
|
|
||||||
#[entry]
|
|
||||||
fn main() -> ! {
|
|
||||||
info!("Hello World!");
|
|
||||||
|
|
||||||
let executor = EXECUTOR.put(Executor::new());
|
|
||||||
|
|
||||||
executor.run(|spawner| {
|
|
||||||
unwrap!(spawner.spawn(main_task()));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue