rev2.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include "rev2.h"
  2. #ifdef RGB_MATRIX_ENABLE
  3. led_config_t g_led_config = { {
  4. // Key Matrix to LED Index
  5. { 0, 1, 2 },
  6. { 3, 4, 5 },
  7. { 6, 7, 8 }
  8. }, {
  9. // LED Index to Physical Position
  10. { 0, 0 }, { 112, 0 }, { 224, 0 },
  11. { 0, 32 }, { 112, 32 }, { 224, 32 },
  12. { 0, 64 }, { 112, 64 }, { 224, 64 },
  13. { 56, 64 }, { 168, 64 },
  14. }, {
  15. // LED Index to Flag
  16. 4, 4, 4,
  17. 4, 4, 4,
  18. 4, 4, 4,
  19. 2, 2
  20. } };
  21. #endif
  22. void eeconfig_init_kb(void) {
  23. #ifdef RGBLIGHT_ENABLE
  24. rgblight_enable(); // Enable RGB by default
  25. rgblight_sethsv(0, 255, 255); // Set default HSV - red hue, full saturation, full brightness
  26. # ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
  27. rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 2); // set to RGB_RAINBOW_SWIRL by default
  28. # endif
  29. #endif
  30. #ifdef RGB_MATRIX_ENABLE
  31. rgb_matrix_enable(); // Enable RGB by default
  32. #endif
  33. eeconfig_update_kb(0);
  34. eeconfig_init_user();
  35. }
  36. bool encoder_update_kb(uint8_t index, bool clockwise) {
  37. if (!encoder_update_user(index, clockwise)) { return false; }
  38. if (index == 0) {
  39. if (clockwise) {
  40. tap_code(KC_VOLU);
  41. } else {
  42. tap_code(KC_VOLD);
  43. }
  44. }
  45. else if (index == 1) {
  46. if (clockwise) {
  47. tap_code(KC_DOWN);
  48. } else {
  49. tap_code(KC_UP);
  50. }
  51. }
  52. else if (index == 2) {
  53. if (clockwise) {
  54. tap_code(KC_PGDN);
  55. } else {
  56. tap_code(KC_PGUP);
  57. }
  58. }
  59. return false;
  60. }