Go to the documentation of this file.
42 constexpr
static inline u8 NumLEDs = 9;
54 for(
u8 i = 0; i <= NumLEDs; i++){
81 for(
u8 i = 0; i <= NumLEDs; i++){
94 if (index >= 0 && index < NumLEDs){
95 RGBMatrix::s_LEDs[index * 4 + 0] = (0xE0 | color.
a);
96 RGBMatrix::s_LEDs[index * 4 + 1] = color.
b;
97 RGBMatrix::s_LEDs[index * 4 + 2] = color.
g;
98 RGBMatrix::s_LEDs[index * 4 + 3] = color.
r;
109 for(
u16 index = 0; index < NumLEDs; index++){
110 if(((enableMask >> index) & 0b1) == 0b1){
113 setLed(index, { 0x0000
'0000 });
124 static void dice(u8 number, RGBA8 color) {
128 case 1: setLedMasked(0b000'010
'000, color); break;
129 case 2: setLedMasked(0b001'000
'100, color); break;
130 case 3: setLedMasked(0b001'010
'100, color); break;
131 case 4: setLedMasked(0b101'000
'101, color); break;
132 case 5: setLedMasked(0b101'010
'101, color); break;
133 case 6: setLedMasked(0b101'101
'101, color); break;
142 bsp::SPIA::write(RGBMatrix::s_LEDs);
147 static inline std::array<u8, NumLEDs * 4> s_LEDs;
152 static inline void sendStartFrame() {
153 bsp::SPIA::write<std::array<u8, 4>>({ 0x00, 0x00, 0x00, 0x00 });
159 static inline void sendEndFrame() {
160 bsp::SPIA::write<std::array<u8, 4>>({ 0xFF, 0xFF, 0xFF, 0xFF });
RGBA8 color type.
Definition: types.hpp:33
uint16_t u16
Definition: types.h:37
Commonly used helper functions.
uint8_t u8
Unsigned integer definitions.
Definition: types.h:36
static void disable()
Disable the SK9822 led.
Definition: rgb_matrix.hpp:72
Commonly used type definitions and helper templates.
u8 b
Definition: types.hpp:35
static bool init()
Initialization function.
Definition: rgb_matrix.hpp:52
u8 r
Definition: types.hpp:35
static void setLed(u8 index, RGBA8 color)
set a single led to RGBA8 color
Definition: rgb_matrix.hpp:93
static void flush()
Send the saved color values to the leds.
Definition: rgb_matrix.hpp:140
static void enable()
Enables the SK9822 led.
Definition: rgb_matrix.hpp:63
u8 g
Definition: types.hpp:35
static void clear()
Clear all leds.
Definition: rgb_matrix.hpp:79
RGB Led driver SK9822 through SPI.
Definition: rgb_matrix.hpp:40
Commonly used C++ and GNU attributes.
Definition: color_sensor.hpp:32
static void setLedMasked(u16 enableMask, RGBA8 color)
set multiple leds to RGBA8 color using a bit mask
Definition: rgb_matrix.hpp:108
u8 a
Definition: types.hpp:35