1
0

keymap.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Copyright 2021 Caleb Lightfoot
  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. YEEHAW = SAFE_RANGE,
  19. SQUASHKB,
  20. };
  21. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  22. [0] = LAYOUT(
  23. KC_VOLU,
  24. KC_VOLD,
  25. KC_MPRV, YEEHAW, KC_UP, SQUASHKB,
  26. MO(1), KC_MNXT, KC_LEFT, KC_DOWN, KC_RIGHT,
  27. KC_MPLY, LCTL(KC_S),
  28. RGB_TOG
  29. ),
  30. [1] = LAYOUT(
  31. RGB_HUI,
  32. RGB_HUD,
  33. RGB_SAI, RGB_VAI, RGB_VAD, RGB_SPI,
  34. KC_TRNS, RGB_SAD, RGB_M_P, RGB_MOD, RGB_SPD,
  35. KC_TRNS, KC_TRNS,
  36. RESET
  37. ),
  38. [2] = LAYOUT(
  39. _______,
  40. _______,
  41. _______, _______, _______, _______,
  42. _______, _______, _______, _______, _______,
  43. _______, _______,
  44. _______
  45. ),
  46. [3] = LAYOUT(
  47. _______,
  48. _______,
  49. _______, _______, _______, _______,
  50. _______, _______, _______, _______, _______,
  51. _______, _______,
  52. _______
  53. ),
  54. };
  55. bool encoder_update_user(uint8_t index, bool clockwise) {
  56. if (index == 0) { /* First encoder */
  57. if (clockwise) {
  58. tap_code(KC_VOLD);
  59. } else {
  60. tap_code(KC_VOLU);
  61. }
  62. }
  63. return true;
  64. }
  65. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  66. switch (keycode) {
  67. case YEEHAW:
  68. if (record->event.pressed) {
  69. SEND_STRING("yeehaw!");
  70. }
  71. break;
  72. case SQUASHKB:
  73. if (record->event.pressed) {
  74. SEND_STRING("http://squashkb.com");
  75. }
  76. break;
  77. }
  78. return true;
  79. };