Module capsules_extra::led_matrix

source ·
Expand description

Service capsule for access to LEDs on a LED matrix.

§Usage

let led_matrix = components::led_matrix_component_helper!(
    nrf52833::gpio::GPIOPin,
    nrf52::rtc::Rtc<'static>,
    mux_alarm,
    @fps => 60,
    @cols => kernel::hil::gpio::ActivationMode::ActiveLow,
        &nrf52833_peripherals.gpio_port[LED_MATRIX_COLS[0]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_COLS[1]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_COLS[2]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_COLS[3]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_COLS[4]],
    @rows => kernel::hil::gpio::ActivationMode::ActiveHigh,
        &nrf52833_peripherals.gpio_port[LED_MATRIX_ROWS[0]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_ROWS[1]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_ROWS[2]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_ROWS[3]],
        &nrf52833_peripherals.gpio_port[LED_MATRIX_ROWS[4]]

)
.finalize(components::led_matrix_component_buf!(
    nrf52833::gpio::GPIOPin,
    nrf52::rtc::Rtc<'static>
));

let led = static_init!(
    capsules::led::LedDriver<
        'static,
        capsules::led_matrix::LedMatrixLed<
            'static,
            nrf52::gpio::GPIOPin<'static>,
            capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52::rtc::Rtc<'static>>,
        >,
        25,
    >,
    capsules::led::LedDriver::new(components::led_matrix_leds!(
        nrf52::gpio::GPIOPin<'static>,
        capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52::rtc::Rtc<'static>>,
        led_matrix,
        (0, 0),
        (1, 0),
        (2, 0),
        (3, 0),
        (4, 0),
        (0, 1),
        (1, 1),
        (2, 1),
        (3, 1),
        (4, 1),
        (0, 2),
        (1, 2),
        (2, 2),
        (3, 2),
        (4, 2),
        (0, 3),
        (1, 3),
        (2, 3),
        (3, 3),
        (4, 3),
        (0, 4),
        (1, 4),
        (2, 4),
        (3, 4),
        (4, 4)
    )),
);

Structs§