keymap.c 816 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. bool encoder_update_user(uint8_t index, bool clockwise) {
  15. if (index == _LEFT) {
  16. if (clockwise) {
  17. rgblight_increase_hue();
  18. } else {
  19. rgblight_decrease_hue();
  20. }
  21. }
  22. else if (index == _MIDDLE) {
  23. if (clockwise) {
  24. rgblight_increase_sat();
  25. } else {
  26. rgblight_decrease_sat();
  27. }
  28. }
  29. else if (index == _RIGHT) {
  30. if (clockwise) {
  31. rgblight_increase_val();
  32. } else {
  33. rgblight_decrease_val();
  34. }
  35. }
  36. return true;
  37. }