Crates.io | arm-pl011-rs |
lib.rs | arm-pl011-rs |
version | 0.2.0 |
source | src |
created_at | 2024-08-20 06:00:00.934725 |
updated_at | 2024-10-30 06:31:39.581635 |
description | PL011 UART driver |
homepage | |
repository | https://gitee.com/zr233/arm-pl011-rs |
max_upload_size | |
id | 1344920 |
size | 22,769 |
本库实现了PL011 UART驱动的同步和异步接口。
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;
}
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());
}
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.