keymap.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. Copyright 2020 Jonathon Carstens jonathon@lizardtrick.com
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. // Defines names for use in layer keycodes and the keymap
  16. enum layer_names {
  17. _BASE,
  18. _TG1,
  19. };
  20. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  21. /*
  22. *
  23. * Left Middle Right
  24. * VolDn PgDn Alt+Tab (Rotary Counterclockwise)
  25. * VolUp PgUp Tab (Rotary Clockwise)
  26. * Mute Play Next (Rotary Click)
  27. *
  28. *
  29. *
  30. * ┌───┬───┬───┬───┐
  31. * │TG1│ / │ * │ - │
  32. * ├───┼───┼───┼───┤
  33. * │ 7 │ 8 │ 9 │   │
  34. * ├───┼───┼───┤ + │
  35. * │ 4 │ 5 │ 6 │   │
  36. * ├───┼───┼───┼───┤
  37. * │ 1 │ 2 │ 3 │   │
  38. * ├───┴───┼───┤Ent│
  39. * │   0   │ . │   │
  40. * └───────┴───┴───┘
  41. */
  42. [_BASE] = LAYOUT(
  43. KC_MUTE, KC_MPLY, KC_MNXT,
  44. TG(1), KC_SLSH, KC_ASTR, KC_MINS,
  45. KC_7, KC_8, KC_9, KC_PLUS,
  46. KC_4, KC_5, KC_6,
  47. KC_1, KC_2, KC_3, KC_ENT,
  48. KC_0, KC_DOT
  49. ),
  50. /*
  51. *
  52. * ┌─────────┬─────────┬─────────┬─────────┐
  53. * │ TG1 │  /  │  *  │  -  │
  54. * ├─────────┼─────────┼─────────┼─────────┤
  55. * │  Alt 7  │  Alt 8  │  Alt 9  │    │
  56. * ├─────────┼─────────┼─────────┤ + │
  57. * │  Alt 4  │  Alt 5  │  Alt 6  │    │
  58. * ├─────────┼─────────┼─────────┼─────────┤
  59. * │  Alt 1  │  Alt 2  │  Alt 3  │    │
  60. * ├─────────┴─────────┼─────────┤ Ent │
  61. * │ Escape │ Del │    │
  62. * └───────────────────┴─────────┴─────────┘
  63. */
  64. [_TG1] = LAYOUT(
  65. _______, _______, _______,
  66. _______, _______, _______, _______,
  67. A(KC_7), A(KC_8), A(KC_9), _______,
  68. A(KC_4), A(KC_5), A(KC_6),
  69. A(KC_1), A(KC_2), A(KC_3), _______,
  70. KC_ESC, KC_DEL
  71. )
  72. };
  73. bool encoder_update_user(uint8_t index, bool clockwise) {
  74. if (index == 0) { /* Left Encoder */
  75. if (clockwise) {
  76. tap_code16(KC_VOLU);
  77. } else {
  78. tap_code16(KC_VOLD);
  79. }
  80. } else if (index == 1) { /* Middle Encoder */
  81. if (clockwise) {
  82. tap_code16(KC_PGDN);
  83. } else {
  84. tap_code16(KC_PGUP);
  85. }
  86. } else if (index == 2) { /* Right Encoder */
  87. if (clockwise) {
  88. tap_code16(KC_TAB);
  89. } else {
  90. tap_code16(S(KC_TAB));
  91. }
  92. }
  93. return true;
  94. }