diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-03-29 01:14:18 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-29 01:14:18 +0200 |
| commit | 3a0ddb8104694717cb573aa508acb4a8bbba3ff7 (patch) | |
| tree | e02bef7b7c7d26fe8feef1efe1a1dd03d505b529 /embassy-stm32f4-examples/src | |
| parent | 5b74e326e5da8214eec9360e67f42ff2ca3905e8 (diff) | |
stm32/serial: update to new traits.
Diffstat (limited to 'embassy-stm32f4-examples/src')
| -rw-r--r-- | embassy-stm32f4-examples/src/bin/serial.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/embassy-stm32f4-examples/src/bin/serial.rs b/embassy-stm32f4-examples/src/bin/serial.rs index 49a588c25..c8e7f288f 100644 --- a/embassy-stm32f4-examples/src/bin/serial.rs +++ b/embassy-stm32f4-examples/src/bin/serial.rs | |||
| @@ -12,10 +12,11 @@ use example_common::{panic, *}; | |||
| 12 | use cortex_m::singleton; | 12 | use cortex_m::singleton; |
| 13 | use cortex_m_rt::entry; | 13 | use cortex_m_rt::entry; |
| 14 | use embassy::executor::{task, Executor}; | 14 | use embassy::executor::{task, Executor}; |
| 15 | use embassy::traits::uart::Uart; | 15 | use embassy::traits::uart::{Read, Write}; |
| 16 | use embassy::util::Forever; | 16 | use embassy::util::Forever; |
| 17 | use embassy_stm32f4::interrupt; | 17 | use embassy_stm32f4::interrupt; |
| 18 | use embassy_stm32f4::serial; | 18 | use embassy_stm32f4::serial; |
| 19 | use futures::pin_mut; | ||
| 19 | use stm32f4xx_hal::dma::StreamsTuple; | 20 | use stm32f4xx_hal::dma::StreamsTuple; |
| 20 | use stm32f4xx_hal::prelude::*; | 21 | use stm32f4xx_hal::prelude::*; |
| 21 | use stm32f4xx_hal::serial::config::Config; | 22 | use stm32f4xx_hal::serial::config::Config; |
| @@ -76,10 +77,12 @@ async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) { | |||
| 76 | clocks, | 77 | clocks, |
| 77 | ) | 78 | ) |
| 78 | }; | 79 | }; |
| 80 | pin_mut!(serial); | ||
| 81 | |||
| 79 | let buf = singleton!(: [u8; 30] = [0; 30]).unwrap(); | 82 | let buf = singleton!(: [u8; 30] = [0; 30]).unwrap(); |
| 80 | 83 | ||
| 81 | buf[5] = 0x01; | 84 | buf[5] = 0x01; |
| 82 | serial.send(buf).await.unwrap(); | 85 | serial.write(buf).await.unwrap(); |
| 83 | } | 86 | } |
| 84 | 87 | ||
| 85 | static EXECUTOR: Forever<Executor> = Forever::new(); | 88 | static EXECUTOR: Forever<Executor> = Forever::new(); |
