Merge pull request #132 from theunkn0wn1/patch/stm_serial_example
[STM32] Reborrow serial and demonstrate using it twice.
This commit is contained in:
commit
388558263b
1 changed files with 3 additions and 2 deletions
|
@ -12,7 +12,7 @@ use example_common::{panic, *};
|
|||
use cortex_m::singleton;
|
||||
use cortex_m_rt::entry;
|
||||
use embassy::executor::{Executor, Spawner};
|
||||
use embassy::traits::uart::{Read, Write};
|
||||
use embassy::traits::uart::{Read, ReadUntilIdle, Write};
|
||||
use embassy::util::Forever;
|
||||
use embassy_stm32::interrupt;
|
||||
use embassy_stm32::serial;
|
||||
|
@ -75,5 +75,6 @@ async fn main(spawner: Spawner) {
|
|||
let buf = singleton!(: [u8; 30] = [0; 30]).unwrap();
|
||||
|
||||
buf[5] = 0x01;
|
||||
serial.write(buf).await.unwrap();
|
||||
serial.as_mut().write(buf).await.unwrap();
|
||||
serial.as_mut().read_until_idle(buf).await.unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue