ws2812_constants!() { /* proc-macro */ }Expand description
Proc macro that generates a constant with the given name that contains all 256 combinations of patters to send a byte to WS2812
ยงExample:
// This creates a `const WRITE_4_BYTE_CONSTANTS: [[u8;4]; 256]
// Note that this requires 1K flash
use ws2812_spi_write_constants::ws2812_constants;
ws2812_constants!(WRITE_4_BYTE_CONSTANTS);
assert_eq!(
WRITE_4_BYTE_CONSTANTS[0b0000_0000],
[0b0100_0100, 0b0100_0100, 0b0100_0100, 0b0100_0100]
);
assert_eq!(
WRITE_4_BYTE_CONSTANTS[0b0100_1100],
[0b0100_0111, 0b0100_0100, 0b0111_0111, 0b0100_0100]
);
assert_eq!(
WRITE_4_BYTE_CONSTANTS[0b1111_1111],
[0b0111_0111, 0b0111_0111, 0b0111_0111, 0b0111_0111]
);