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.

65 lines
2.0 KiB

  1. /* Copyright 2020 Casey Webster <casey@e1337.dev>
  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 "cwebster2.h"
  17. userspace_config_t userspace_config;
  18. __attribute__((weak)) void matrix_scan_keymap(void) {}
  19. void matrix_scan_user(void) {
  20. static bool has_ran_yet;
  21. if (!has_ran_yet) {
  22. has_ran_yet = true;
  23. startup_user();
  24. }
  25. matrix_scan_keymap();
  26. }
  27. void keyboard_post_init_rgb(void) {
  28. #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION)
  29. /*if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); }*/
  30. /*if (rgblight_config.enable) {*/
  31. /*layer_state_set_user(layer_state);*/
  32. /*uint16_t old_hue = rgblight_config.hue;*/
  33. uint16_t old_hue = 170;
  34. rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
  35. for (uint16_t i = 255; i > 0; i--) {
  36. rgblight_sethsv_noeeprom( ( i + old_hue) % 255, 255, 255);
  37. matrix_scan();
  38. wait_ms(10);
  39. }
  40. /*}*/
  41. #endif
  42. /*layer_state_set_user(layer_state);*/
  43. }
  44. __attribute__((weak)) void eeconfig_init_keymap(void) {}
  45. void eeconfig_init_user(void) {
  46. userspace_config.raw = 0;
  47. userspace_config.rgb_layer_change = true;
  48. eeconfig_update_user(userspace_config.raw);
  49. eeconfig_init_keymap();
  50. keyboard_init();
  51. }
  52. bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
  53. value &= 0xF;
  54. mask &= 0xF;
  55. return (value & mask) == mask;
  56. }