Skip to main content

uniform_frame

Function uniform_frame 

Source
pub const fn uniform_frame<const CODES: usize>(
    color: Rgb,
    leds: usize,
) -> [PulseCode; CODES]
Expand description

A whole frame for leds LEDs of one colour, built at COMPILE TIME.

For an indicator the colours are known when the firmware is built, so there is nothing to generate at runtime:

ⓘ
const CODES: usize = codes_for(10);
static GREEN: [PulseCode; CODES] = uniform_frame(Rgb::new(0, 32, 0), 10);
leds.write_frame(&GREEN).await?;

That puts the frame in .rodata and costs no RAM, which is the point: the RMT wants a 32-bit code per bit, so ten LEDs are 968 B, and a runtime frame has to survive the transmit await — landing in the caller’s future and so in .bss. On a fire27 that is the region with ~1.4 KiB of total slack, and its link assert rejects it.

CODES must be at least codes_for(leds). Any surplus stays an end marker, which the RMT stops at.