async_api/
async_api.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use core::ptr::NonNull;

use arm_pl011_rs::{Config, DataBits, Parity, Pl011, StopBits};
use embedded_io_async::*;

pub async fn write() {
    let mut uart = Pl011::new(
        NonNull::new(0x0900_0000 as *mut u8).unwrap(),
        Some(Config {
            baud_rate: 115200,
            clock_freq: 24000000,
            data_bits: DataBits::Bits8,
            stop_bits: StopBits::STOP1,
            parity: Parity::None,
        }),
    )
    .await;

    uart.write_all("uart output\n".as_bytes()).await;
}