keymap.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright 2019 Danny Nguyen <danny@keeb.io>
  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. /*
  19. | Knob 1: Scrl Dn/Up | | Knob 2: Vol Dn/Up |
  20. | Press: Mute | Up | Press: Play/Pause |
  21. | Left | Down | Right |
  22. | Media Previous | MO(1)| Media Next |
  23. */
  24. [0] = LAYOUT(
  25. KC_MUTE, KC_UP, KC_MPLY,
  26. KC_LEFT, KC_DOWN, KC_RIGHT,
  27. KC_MPRV, MO(1), KC_MNXT
  28. ),
  29. /*
  30. | QK_BOOT | Home | Media Stop |
  31. | | End | |
  32. | CTRL_END | | CTRL_HOME |
  33. */
  34. [1] = LAYOUT(
  35. QK_BOOT, KC_HOME, KC_STOP,
  36. _______, KC_END, _______,
  37. LCTL(KC_END), _______, LCTL(KC_HOME)
  38. ),
  39. };
  40. bool encoder_update_user(uint8_t index, bool clockwise) {
  41. if (index == 0) {
  42. if (clockwise) {
  43. tap_code(KC_MS_WH_UP);
  44. } else {
  45. tap_code(KC_MS_WH_DOWN);
  46. }
  47. }
  48. else if (index == 1) {
  49. if (clockwise) {
  50. tap_code(KC_VOLU);
  51. } else {
  52. tap_code(KC_VOLD);
  53. }
  54. }
  55. return true;
  56. }