keymap.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* Copyright 2021 @ Adam Lickel
  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. enum custom_keycodes {
  18. #ifdef VIA_ENABLE
  19. KC_MISSION_CONTROL = USER00,
  20. #else
  21. KC_MISSION_CONTROL = SAFE_RANGE,
  22. #endif
  23. KC_LAUNCHPAD
  24. };
  25. #define KC_MCTL KC_MISSION_CONTROL
  26. #define KC_LPAD KC_LAUNCHPAD
  27. // clang-format off
  28. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  29. [0] = LAYOUT_80_with_macro(
  30. KC_MUTE, KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DEC, BL_INC, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MPLY,
  31. KC_F1, KC_F2, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_HOME,
  32. KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
  33. KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
  34. KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
  35. KC_F9, KC_F10, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(1), KC_SPC, KC_RGUI, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
  36. ),
  37. [1] = LAYOUT_80_with_macro(
  38. _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
  39. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  40. _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  41. _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
  42. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  43. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  44. ),
  45. [2] = LAYOUT_80_with_macro(
  46. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  47. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  48. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  49. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  50. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  51. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  52. ),
  53. [3] = LAYOUT_80_with_macro(
  54. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  55. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  56. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  57. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  58. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  59. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  60. )
  61. };
  62. // clang-format on
  63. bool encoder_update_user(uint8_t index, bool clockwise) {
  64. if (index == 0) {
  65. if (clockwise) {
  66. tap_code(KC_PGDN);
  67. } else {
  68. tap_code(KC_PGUP);
  69. }
  70. return false;
  71. } else if (index == 1) {
  72. if (clockwise) {
  73. tap_code(KC_VOLU);
  74. } else {
  75. tap_code(KC_VOLD);
  76. }
  77. return false;
  78. } else {
  79. return true;
  80. }
  81. }
  82. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  83. switch (keycode) {
  84. case KC_MISSION_CONTROL:
  85. if (record->event.pressed) {
  86. host_consumer_send(0x29F);
  87. } else {
  88. host_consumer_send(0);
  89. }
  90. return false;
  91. case KC_LAUNCHPAD:
  92. if (record->event.pressed) {
  93. host_consumer_send(0x2A0);
  94. } else {
  95. host_consumer_send(0);
  96. }
  97. return false;
  98. default:
  99. return true;
  100. }
  101. }