stm32/serial: update to new traits.

This commit is contained in:
Dario Nieuwenhuis
2021-03-29 01:14:18 +02:00
parent 5b74e326e5
commit 3a0ddb8104
2 changed files with 84 additions and 72 deletions

View File

@ -12,10 +12,11 @@ use example_common::{panic, *};
use cortex_m::singleton;
use cortex_m_rt::entry;
use embassy::executor::{task, Executor};
use embassy::traits::uart::Uart;
use embassy::traits::uart::{Read, Write};
use embassy::util::Forever;
use embassy_stm32f4::interrupt;
use embassy_stm32f4::serial;
use futures::pin_mut;
use stm32f4xx_hal::dma::StreamsTuple;
use stm32f4xx_hal::prelude::*;
use stm32f4xx_hal::serial::config::Config;
@ -76,10 +77,12 @@ async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) {
clocks,
)
};
pin_mut!(serial);
let buf = singleton!(: [u8; 30] = [0; 30]).unwrap();
buf[5] = 0x01;
serial.send(buf).await.unwrap();
serial.write(buf).await.unwrap();
}
static EXECUTOR: Forever<Executor> = Forever::new();