rgblite.h (529B)
1 // Copyright 2022 Makoto Kurauchi (@MakotoKurauchi) 2 // SPDX-License-Identifier: GPL-2.0-or-later 3 4 #pragma once 5 6 #include "ws2812.h" 7 #include "color.h" 8 9 static inline void rgblite_init(void) { 10 ws2812_init(); 11 } 12 13 static inline void rgblite_setrgb(rgb_t rgb) { 14 ws2812_set_color_all(rgb.r, rgb.g, rgb.b); 15 ws2812_flush(); 16 } 17 18 static void rgblite_increase_hue(void) { 19 static uint8_t state = 0; 20 21 hsv_t hsv = { 255, 255, 255 }; 22 hsv.h = state; 23 state = (state + 8) % 256; 24 25 rgblite_setrgb(hsv_to_rgb(hsv)); 26 27 }