Expand description

API for General Purpose I/O (GPIO)

The entry point to this API is GPIO. It can be used to initialize the peripheral, and is required to convert instances of Pin to a GpioPin, which provides the core GPIO API.

The GPIO peripheral is described in the following user manuals:

  • LPC82x user manual, chapter 9
  • LPC84x user manual, chapter 12

Examples

Initialize a GPIO pin and set its output to HIGH:

use lpc8xx_hal::{
    prelude::*,
    Peripherals,
    gpio,
};

let mut p = Peripherals::take().unwrap();

let mut syscon = p.SYSCON.split();

#[cfg(feature = "82x")]
let gpio = p.GPIO;
#[cfg(feature = "845")]
let gpio = p.GPIO.enable(&mut syscon.handle);

let pio0_12 = p.pins.pio0_12.into_output_pin(
    gpio.tokens.pio0_12,
    gpio::Level::High,
);

Please refer to the examples in the repository for more example code.

Modules

Contains types to indicate the direction of GPIO pins

Structs

Interface to the GPIO peripheral
A pin used for general purpose I/O (GPIO).
This is an internal type that should be of no concern to users of this crate

Enums

The voltage level of a pin