keymap.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Copyright 2019 Josh Johnson
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include QMK_KEYBOARD_H
  17. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  18. [0] = LAYOUT( /* Base */
  19. KC_MUTE, KC_MPLY,
  20. KC_7, KC_8, KC_9, KC_PAST,
  21. KC_4, KC_5, KC_6, KC_PMNS,
  22. KC_1, KC_2, KC_3, KC_PPLS,
  23. MO(1), KC_0, KC_PDOT, KC_PENT
  24. ),
  25. [1] = LAYOUT( /* LED Control */
  26. _______, _______,
  27. _______, RGB_MOD, RGB_RMOD, RGB_TOG,
  28. RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI,
  29. RGB_SAD, RGB_SAI, _______, _______,
  30. _______, _______, RESET, _______
  31. ),
  32. [2] = LAYOUT(
  33. _______, _______,
  34. _______, _______, _______, _______,
  35. _______, _______, _______, _______,
  36. _______, _______, _______, _______,
  37. _______, _______, _______, _______
  38. ),
  39. [3] = LAYOUT(
  40. _______, _______,
  41. _______, _______, _______, _______,
  42. _______, _______, _______, _______,
  43. _______, _______, _______, _______,
  44. _______, _______, _______, _______
  45. ),
  46. };
  47. bool encoder_update_user(uint8_t index, bool clockwise) {
  48. if (index == 0) { /* Left Encoder */
  49. if (clockwise) {
  50. tap_code(KC_VOLD);
  51. } else {
  52. tap_code(KC_VOLU);
  53. }
  54. } else if (index == 1) { /* Right Encoder */
  55. if (clockwise) {
  56. tap_code(KC_MPRV);
  57. } else {
  58. tap_code(KC_MNXT);
  59. }
  60. }
  61. return true;
  62. }