aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l4/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-04-22 19:58:24 +0200
committerDario Nieuwenhuis <[email protected]>2022-04-22 19:58:24 +0200
commit3251a21fb7f7d0bcbd4e900274f4917c58ab9c87 (patch)
tree1193acee1e41822b0cbf538f6271ccad35c056aa /examples/stm32l4/src
parentea0a701ebd142ea42e05e51e844bd53cc9bdf354 (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.rs30
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
5use defmt_rtt as _; // global logger
6use panic_probe as _;
7
8use defmt::*;
9use embassy::executor::Spawner;
10use embassy_stm32::dma::NoDma;
11use embassy_stm32::usart::{Config, Uart};
12use embassy_stm32::Peripherals;
13use embassy_traits::adapter::BlockingAsync;
14use embedded_hal_async::serial::{Read, Write};
15
16#[embassy::main]
17async 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}