logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (1860B)


  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. UG_TOGG
  29. ),
  30. [1] = LAYOUT(
  31. UG_HUEU,
  32. UG_HUED,
  33. UG_SATU, UG_VALU, UG_VALD, UG_SPDU,
  34. KC_TRNS, UG_SATD, RGB_M_P, UG_NEXT, UG_SPDD,
  35. KC_TRNS, KC_TRNS,
  36. QK_BOOT
  37. ),
  38. };
  39. bool encoder_update_user(uint8_t index, bool clockwise) {
  40. if (index == 0) { /* First encoder */
  41. if (clockwise) {
  42. tap_code(KC_VOLU);
  43. } else {
  44. tap_code(KC_VOLD);
  45. }
  46. }
  47. return true;
  48. }
  49. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  50. switch (keycode) {
  51. case YEEHAW:
  52. if (record->event.pressed) {
  53. SEND_STRING("yeehaw!");
  54. }
  55. break;
  56. case SQUASHKB:
  57. if (record->event.pressed) {
  58. SEND_STRING("https://squashkb.com");
  59. }
  60. break;
  61. }
  62. return true;
  63. };