components

Module gpio

Source
Expand description

Components for GPIO pins.

§Usage

The gpio_component_helper! macro takes ’static references to GPIO pins. When GPIO instances are owned values, the gpio_component_helper_owned! can be used, indicating that the passed values are owned values. This macro will perform static allocation of the passed in GPIO pins internally.

let gpio = components::gpio::GpioComponent::new(
    board_kernel,
    components::gpio_component_helper!(
        nrf52840::gpio::GPIOPin,
        // left side of the USB plug
        0 => &nrf52840::gpio::PORT[Pin::P0_13],
        1 => &nrf52840::gpio::PORT[Pin::P0_15],
        2 => &nrf52840::gpio::PORT[Pin::P0_17],
        3 => &nrf52840::gpio::PORT[Pin::P0_20],
        4 => &nrf52840::gpio::PORT[Pin::P0_22],
        5 => &nrf52840::gpio::PORT[Pin::P0_24],
        6 => &nrf52840::gpio::PORT[Pin::P1_00],
        7 => &nrf52840::gpio::PORT[Pin::P0_09],
        8 => &nrf52840::gpio::PORT[Pin::P0_10],
        // right side of the USB plug
        9 => &nrf52840::gpio::PORT[Pin::P0_31],
        10 => &nrf52840::gpio::PORT[Pin::P0_29],
        11 => &nrf52840::gpio::PORT[Pin::P0_02],
        12 => &nrf52840::gpio::PORT[Pin::P1_15],
        13 => &nrf52840::gpio::PORT[Pin::P1_13],
        14 => &nrf52840::gpio::PORT[Pin::P1_10],
        // Below the PCB
        15 => &nrf52840::gpio::PORT[Pin::P0_26],
        16 => &nrf52840::gpio::PORT[Pin::P0_04],
        17 => &nrf52840::gpio::PORT[Pin::P0_11],
        18 => &nrf52840::gpio::PORT[Pin::P0_14],
        19 => &nrf52840::gpio::PORT[Pin::P1_11],
        20 => &nrf52840::gpio::PORT[Pin::P1_07],
        21 => &nrf52840::gpio::PORT[Pin::P1_01],
        22 => &nrf52840::gpio::PORT[Pin::P1_04],
        23 => &nrf52840::gpio::PORT[Pin::P1_02]
    ),
).finalize(components::gpio_component_static!(nrf52840::gpio::GPIOPin));

Structs§

Type Aliases§