You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

  1. /* Copyright 2019 @ninjonas
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "ninjonas.h"
  17. layer_state_t layer_state_set_user (layer_state_t state) {
  18. return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  19. }
  20. #ifdef RGBLIGHT_ENABLE
  21. extern rgblight_config_t rgblight_config;
  22. #endif
  23. void keyboard_post_init_user() {
  24. #ifdef RGBLIGHT_ENABLE
  25. // Cycles through the entire hue wheel and resetting to default color
  26. uint16_t default_hue = rgblight_config.hue;
  27. rgblight_enable_noeeprom();
  28. layer_state_set_user(layer_state);
  29. rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
  30. for (uint16_t i = 255; i > 0; i--) {
  31. rgblight_sethsv_noeeprom((i + default_hue) % 255, rgblight_config.sat, rgblight_config.val);
  32. matrix_scan();
  33. wait_ms(10);
  34. }
  35. #endif
  36. layer_state_set_user(layer_state);
  37. }