Switch to crates.io embedded-hal, embedded-hal-async.

This temporarily removes support for the async UART trait, since it's
not yet in embedded-hal-async.
This commit is contained in:
Dario Nieuwenhuis
2022-04-22 19:58:24 +02:00
parent ea0a701ebd
commit 3251a21fb7
15 changed files with 31 additions and 55 deletions

View File

@ -1,30 +0,0 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use defmt_rtt as _; // global logger
use panic_probe as _;
use defmt::*;
use embassy::executor::Spawner;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
use embassy_stm32::Peripherals;
use embassy_traits::adapter::BlockingAsync;
use embedded_hal_async::serial::{Read, Write};
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
let config = Config::default();
let usart = Uart::new(p.UART4, p.PA1, p.PA0, NoDma, NoDma, config);
let mut usart = BlockingAsync::new(usart);
unwrap!(usart.write(b"Hello Embassy World!\r\n").await);
info!("wrote Hello, starting echo");
let mut buf = [0u8; 1];
loop {
unwrap!(usart.read(&mut buf).await);
unwrap!(usart.write(&buf).await);
}
}