rev1.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "kbo5000.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. bool encoder_update_kb(uint8_t index, bool clockwise) {
  30. if (!encoder_update_user(index, clockwise)) { return false; }
  31. if (index == 0) {
  32. if (clockwise) {
  33. tap_code(KC_PGDN);
  34. } else {
  35. tap_code(KC_PGUP);
  36. }
  37. } else if (index == 1) {
  38. if (clockwise) {
  39. tap_code(KC_VOLU);
  40. } else {
  41. tap_code(KC_VOLD);
  42. }
  43. } else if (index == 2) {
  44. if (clockwise) {
  45. tap_code(KC_DOWN);
  46. } else {
  47. tap_code(KC_UP);
  48. }
  49. }
  50. return false;
  51. }