This Crate provides easy to use and compile time safe access abstraction to MMIO (memory mapped input output) registers of the Raspberry Pi.
To use this crate simply add the dependency to your Cargo.toml file:
[dependencies]
ruspiro-register = "0.1.1"
In any rust file the register could be defined with their access type, size, address and optional a detailed field definition.
The register access types are ReadOnly, WriteOnly and ReadWrite. The supported register sizes are u8, u16, u32, u64.
``` use ruspiro_register::*;
defineregisters! [
ROREGISTER: ReadOnly
fn main() { let _ = RO_REGISTER::Register.get(); // read raw value from register
WO_REGISTER::Register.write(WO_REGISTER::FLAG3, 0b1010); // write only field FLAG3 into the register
RW_REGISTER::Register.set(0xFFF); // write raw value to register
} ```
Licensed under Apache License, Version 2.0, (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)