1 unstable release
new 0.1.0 | Nov 19, 2024 |
---|
#434 in Embedded development
15KB
222 lines
pl011-uart
A Rust driver for the Arm PL011 UART.
This is not an officially supported Google product.
Usage
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();
}
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
If you want to contribute to the project, see details of how we accept contributions.
Dependencies
~0.4–0.8MB
~19K SLoC