2021-05-16 00:57:46 +00:00
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(trait_alias)]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
2021-05-20 08:54:10 +00:00
|
|
|
#![allow(incomplete_features)]
|
2021-05-16 00:57:46 +00:00
|
|
|
|
|
|
|
#[path = "../example_common.rs"]
|
|
|
|
mod example_common;
|
|
|
|
use core::fmt::Write;
|
2021-07-27 13:03:18 +00:00
|
|
|
use embassy::executor::Spawner;
|
2021-07-23 15:49:53 +00:00
|
|
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
2021-07-15 03:42:06 +00:00
|
|
|
use embassy_stm32::dma::NoDma;
|
2021-05-16 00:57:46 +00:00
|
|
|
use embassy_stm32::usart::{Config, Uart};
|
2021-07-27 13:03:18 +00:00
|
|
|
use embassy_stm32::Peripherals;
|
2021-07-15 03:42:06 +00:00
|
|
|
use embassy_traits::uart::Write as _;
|
2021-05-16 00:57:46 +00:00
|
|
|
use example_common::*;
|
|
|
|
use heapless::String;
|
|
|
|
|
2021-07-27 13:03:18 +00:00
|
|
|
#[embassy::main]
|
|
|
|
async fn main(_spawner: Spawner, p: Peripherals) {
|
|
|
|
info!("Hello World!");
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
Dbgmcu::enable_all();
|
|
|
|
}
|
2021-05-16 00:57:46 +00:00
|
|
|
|
|
|
|
let config = Config::default();
|
2021-07-17 06:04:33 +00:00
|
|
|
let mut usart = Uart::new(p.USART3, p.PD9, p.PD8, p.DMA1_CH3, NoDma, config);
|
2021-05-16 00:57:46 +00:00
|
|
|
|
2021-05-25 02:17:24 +00:00
|
|
|
for n in 0u32.. {
|
2021-05-16 00:57:46 +00:00
|
|
|
let mut s: String<128> = String::new();
|
|
|
|
core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap();
|
|
|
|
|
2021-07-15 03:42:06 +00:00
|
|
|
usart.write(s.as_bytes()).await.unwrap();
|
2021-05-16 00:57:46 +00:00
|
|
|
info!("wrote DMA");
|
|
|
|
}
|
|
|
|
}
|