Crates.io | pl011-uart |
lib.rs | pl011-uart |
version | 0.1.0 |
source | src |
created_at | 2024-11-19 04:25:00.490458 |
updated_at | 2024-11-19 04:25:00.490458 |
description | A driver for the Arm PL011 UART. |
homepage | |
repository | https://github.com/google/pl011-uart |
max_upload_size | |
id | 1452899 |
size | 39,695 |
A Rust driver for the Arm PL011 UART.
This is not an officially supported Google product.
Basic usage of the pl011-uart crate
use pl011_uart::Uart;
use core::fmt::Write;
fn main() {
// constants required for initializing the UART.
const PL011_BASE_ADDRESS: *mut u32 = 0x0900_0000 as _;
const PL011_BAUD_RATE: u32 = 115200;
const PL011_CLK_IN_HZ: u32 = 50000000;
// initialize PL011 UART.
let mut uart = unsafe { Uart::new(PL011_BASE_ADDRESS) };
uart.init(PL011_CLK_IN_HZ, PL011_BAUD_RATE);
// write to PL011 UART.
writeln!(uart, "Hello, World!").unwrap();
}
Licensed under either of
at your option.
If you want to contribute to the project, see details of how we accept contributions.