stm32/usart_v1: add read

This commit is contained in:
Dario Nieuwenhuis
2021-05-15 04:25:44 +02:00
parent 852ca5a1c5
commit befc052cba
2 changed files with 34 additions and 2 deletions

View File

@ -25,9 +25,13 @@ async fn main_task() {
let config = Config::default();
let mut usart = Uart::new(p.USART3, p.PD9, p.PD8, config, 16_000_000);
usart.bwrite_all(b"Hello Embassy World!\r\n").unwrap();
info!("wrote Hello, starting echo");
let mut buf = [0u8; 1];
loop {
info!("wrote");
usart.bwrite_all(b"Hello Embassy World!\r\n").unwrap();
usart.read(&mut buf).unwrap();
usart.bwrite_all(&buf).unwrap();
}
}