diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-04-22 19:58:24 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-04-22 19:58:24 +0200 |
| commit | 3251a21fb7f7d0bcbd4e900274f4917c58ab9c87 (patch) | |
| tree | 1193acee1e41822b0cbf538f6271ccad35c056aa /examples/stm32l4/src | |
| parent | ea0a701ebd142ea42e05e51e844bd53cc9bdf354 (diff) | |
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.
Diffstat (limited to 'examples/stm32l4/src')
| -rw-r--r-- | examples/stm32l4/src/bin/usart_blocking_async.rs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/examples/stm32l4/src/bin/usart_blocking_async.rs b/examples/stm32l4/src/bin/usart_blocking_async.rs deleted file mode 100644 index 7efccace5..000000000 --- a/examples/stm32l4/src/bin/usart_blocking_async.rs +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt_rtt as _; // global logger | ||
| 6 | use panic_probe as _; | ||
| 7 | |||
| 8 | use defmt::*; | ||
| 9 | use embassy::executor::Spawner; | ||
| 10 | use embassy_stm32::dma::NoDma; | ||
| 11 | use embassy_stm32::usart::{Config, Uart}; | ||
| 12 | use embassy_stm32::Peripherals; | ||
| 13 | use embassy_traits::adapter::BlockingAsync; | ||
| 14 | use embedded_hal_async::serial::{Read, Write}; | ||
| 15 | |||
| 16 | #[embassy::main] | ||
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | ||
| 18 | let config = Config::default(); | ||
| 19 | let usart = Uart::new(p.UART4, p.PA1, p.PA0, NoDma, NoDma, config); | ||
| 20 | let mut usart = BlockingAsync::new(usart); | ||
| 21 | |||
| 22 | unwrap!(usart.write(b"Hello Embassy World!\r\n").await); | ||
| 23 | info!("wrote Hello, starting echo"); | ||
| 24 | |||
| 25 | let mut buf = [0u8; 1]; | ||
| 26 | loop { | ||
| 27 | unwrap!(usart.read(&mut buf).await); | ||
| 28 | unwrap!(usart.write(&buf).await); | ||
| 29 | } | ||
| 30 | } | ||
