custom_rgb.c 609 B

12345678910111213141516171819202122232425
  1. #include "csc027.h"
  2. #include "custom_rgb.h"
  3. #if defined(RGBLIGHT_ENABLE)
  4. void keyboard_post_init_user(void) {
  5. rgblight_enable_noeeprom();
  6. rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
  7. uint16_t user_hue = rgblight_get_hue();
  8. for (uint16_t i = 0; i < 256; ++i) {
  9. rgblight_sethsv_noeeprom((i + user_hue) % 256, 255, 255);
  10. wait_ms(5);
  11. }
  12. rgblight_sethsv_noeeprom(0, 0, 0);
  13. }
  14. void on_usb_led_off(void) {
  15. rgblight_sethsv_noeeprom(0, 0, rgblight_get_val() - 85);
  16. }
  17. void on_usb_led_on(void) {
  18. rgblight_sethsv_noeeprom(0, 0, rgblight_get_val() + 85);
  19. }
  20. #endif