rgblite.h (593B)
1 #pragma once 2 3 #include "ws2812.h" 4 #include "color.h" 5 6 static inline void rgblite_init(void) { 7 ws2812_init(); 8 } 9 10 static inline void rgblite_setrgb(uint8_t r, uint8_t g, uint8_t b) { 11 ws2812_set_color_all(r, g, b); 12 ws2812_flush(); 13 } 14 15 static void rgblite_increase_hue(void) { 16 static uint8_t state = 0; 17 18 state = (state + 1) % 3; 19 switch (state) { 20 case 1: 21 rgblite_setrgb(RGB_RED); 22 break; 23 case 2: 24 rgblite_setrgb(RGB_BLUE); 25 break; 26 default: 27 rgblite_setrgb(RGB_GREEN); 28 break; 29 } 30 }