components

Module led_matrix

Source
Expand description

Component for matrices of LEDs.

§Usage

let led_matrix = components::led_matrix::LedMatrixComponent::new(
    mux_alarm,
    components::led_line_component_static!(
        nrf52833::gpio::GPIOPin,
        &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]],
    ),
    components::led_line_component_static!(
        nrf52833::gpio::GPIOPin,
        &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]],
    ),
    kernel::hil::gpio::ActivationMode::ActiveLow,
    kernel::hil::gpio::ActivationMode::ActiveHigh,
    60,
)
.finalize(components::led_matrix_component_static!(
    nrf52833::gpio::GPIOPin,
    nrf52::rtc::Rtc<'static>,
    5,
    5
));

§Single LED usage

let led = components::led_matrix_led!(
    nrf52::gpio::GPIOPin<'static>,
    capsules_core::virtualizers::virtual_alarm::VirtualMuxAlarm<'static, nrf52::rtc::Rtc<'static>>,
    led,
    1,
    2
);

§Array LED usage

let leds = components::led_matrix_leds!(
    nrf52::gpio::GPIOPin<'static>,
    capsules_core::virtualizers::virtual_alarm::VirtualMuxAlarm<'static, nrf52::rtc::Rtc<'static>>,
    led,
    (0, 0),
    (1, 0),
    (2, 0),
    (3, 0),
    (4, 0),
    (0, 1)
    // ...
);

Structs§