rgblite.h 613 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include "ws2812.h"
  3. #include "rgblight_list.h"
  4. static inline void rgblight_setrgb(uint8_t _r, uint8_t _g, uint8_t _b) {
  5. LED_TYPE leds[RGBLED_NUM] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}};
  6. ws2812_setleds(leds, RGBLED_NUM);
  7. }
  8. static void rgblight_increase_hue(void) {
  9. static uint8_t state = 0;
  10. state = (state + 1) % 3;
  11. switch (state) {
  12. case 1:
  13. rgblight_setrgb_red();
  14. break;
  15. case 2:
  16. rgblight_setrgb_blue();
  17. break;
  18. default:
  19. rgblight_setrgb_green();
  20. break;
  21. }
  22. }