rev2.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "quefrency.h"
  2. #include "split_util.h"
  3. void matrix_init_kb(void) {
  4. setPinOutput(CAPS_LOCK_LED_PIN);
  5. matrix_init_user();
  6. }
  7. bool led_update_kb(led_t led_state) {
  8. // Only update if left half
  9. if (isLeftHand && led_update_user(led_state)) {
  10. writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
  11. }
  12. return true;
  13. }
  14. void eeconfig_init_kb(void) {
  15. #ifdef BACKLIGHT_ENABLE
  16. backlight_enable();
  17. backlight_level(3);
  18. #endif
  19. #ifdef RGBLIGHT_ENABLE
  20. rgblight_enable(); // Enable RGB by default
  21. rgblight_sethsv(0, 255, 255); // Set default HSV - red hue, full saturation, full brightness
  22. #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
  23. rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 2); // set to RGB_RAINBOW_SWIRL by default
  24. #endif
  25. #endif
  26. eeconfig_update_kb(0);
  27. eeconfig_init_user();
  28. }
  29. #ifdef ENCODER_ENABLE
  30. bool encoder_update_kb(uint8_t index, bool clockwise) {
  31. if (!encoder_update_user(index, clockwise)) { return false; }
  32. if (index == 0) {
  33. if (clockwise) {
  34. tap_code(KC_PGDN);
  35. } else {
  36. tap_code(KC_PGUP);
  37. }
  38. } else if (index == 1) {
  39. if (clockwise) {
  40. tap_code(KC_VOLU);
  41. } else {
  42. tap_code(KC_VOLD);
  43. }
  44. }
  45. return false;
  46. }
  47. #endif