keymap.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include QMK_KEYBOARD_H
  2. enum encoder_names {
  3. _LEFT,
  4. _RIGHT,
  5. _MIDDLE,
  6. };
  7. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  8. [0] = LAYOUT(
  9. KC_A, KC_B, KC_C,
  10. KC_D, KC_E, KC_F,
  11. KC_G, KC_H, RGB_MOD
  12. ),
  13. /*
  14. | RESET | N/A | Media Stop |
  15. | Held: Layer 2 | Home | RGB Mode |
  16. | Media Previous | End | Media Next |
  17. */
  18. [1] = LAYOUT(
  19. RESET , BL_STEP, KC_STOP,
  20. _______, KC_HOME, RGB_MOD,
  21. KC_MPRV, KC_END , KC_MNXT
  22. ),
  23. };
  24. void encoder_update_user(uint8_t index, bool clockwise) {
  25. if (index == _LEFT) {
  26. if (clockwise) {
  27. rgblight_increase_hue();
  28. } else {
  29. rgblight_decrease_hue();
  30. }
  31. }
  32. else if (index == _MIDDLE) {
  33. if (clockwise) {
  34. rgblight_increase_sat();
  35. } else {
  36. rgblight_decrease_sat();
  37. }
  38. }
  39. else if (index == _RIGHT) {
  40. if (clockwise) {
  41. rgblight_increase_val();
  42. } else {
  43. rgblight_decrease_val();
  44. }
  45. }
  46. }