[][src]Crate apu_pcengines_hal

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

InPin

Access to one input pin

Mapping

Access to all GPIO pins.

OutPin

Access to one output pin

Enums

ApuErrors
IoPin

Use into_input() or into_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

Functions

init

Type Definitions

MappingResult