Expand description
A safe wrapper around the direct memory interface of the APU2+ hardware.
This is a typesafe zero-cost abstraction over raw pointers.
To adhere to rusts safety there are runtime checks and all pins must be returned with Mapping::free_pin
use apu_pcengines_hal::{MappingResult, APU_LED1, APU_LED2, APU_LED3};
fn main() -> MappingResult<()> {
let mut map = apu_pcengines_hal::init()?;
println!("init done: {:?}", map);
let led2 = map.get_pin(APU_LED2)?;
println!("led2: {:?}", led2);
let mut led2 = led2.into_input();
let val = led2.get();
println!("led2: {:?} = {}", led2, val);
let mut led2 = led2.into_output();
println!("led2: {:?}", led2);
led2.set(!val);
map.free_pin(led2);
Ok(())
}Structs§
Enums§
- ApuErrors
- IoPin
- Use
into_input()orinto_output()to use. See module docs.
Constants§
- APU_
GPIO_ 32 - APU_
GPIO_ 33 - APU_
GPIO_ 51 - APU_
GPIO_ 55 - APU_
GPIO_ 57 - APU_
GPIO_ 58 - APU_
GPIO_ 59 - APU_
GPIO_ 64 - APU_
GPIO_ 68 - APU_
GPIO_ 70 - APU_
LED1 - APU_
LED2 - APU_
LED3 - APU_
MODESW - APU_
SIMSWAP