5 releases

0.2.0 Oct 30, 2024
0.1.3 Oct 9, 2024
0.1.2 Sep 23, 2024
0.1.1 Aug 20, 2024
0.1.0 Aug 20, 2024

#1390 in Embedded development

Download history 173/week @ 2024-09-22 12/week @ 2024-09-29 163/week @ 2024-10-06 24/week @ 2024-10-13 1/week @ 2024-10-20 127/week @ 2024-10-27 29/week @ 2024-11-03 14/week @ 2024-11-10 29/week @ 2024-11-17 30/week @ 2024-11-24 32/week @ 2024-12-01 40/week @ 2024-12-08 31/week @ 2024-12-15 26/week @ 2024-12-22 9/week @ 2024-12-29 36/week @ 2025-01-05

104 downloads per month
Used in 4 crates (via sparreal-rt)

MIT/Apache

18KB
401 lines

Arm PL011 驱动

本库实现了PL011 UART驱动的同步和异步接口。

Latest Version Documentation License

示例

Async

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;
}

Sync

use core::ptr::NonNull;

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

pub fn write() {
    let mut uart = Pl011::new_sync(
        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,
        }),
    );

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

License

Licensed under Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) or MIT (LICENSE-MIT or http://opensource.org/licenses/MIT)) at your choice.

Dependencies

~255KB