logo

qmk_firmware

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

keymap.c (2110B)


  1. /* Copyright 2019
  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 layers {
  18. _BASE = 0,
  19. _FN1,
  20. _FN2,
  21. };
  22. // Defines the keycodes used by our macros in process_record_user
  23. enum custom_keycodes {
  24. QMKBEST = SAFE_RANGE,
  25. QMKURL
  26. };
  27. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  28. [_BASE] = LAYOUT_ortho_4x4(
  29. KC_PGUP, KC_HOME, KC_UP, KC_END ,
  30. KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT,
  31. MO(_FN2), KC_VOLU, KC_MPLY, KC_MPRV,
  32. MO(_FN1), KC_VOLD, KC_MUTE, KC_MNXT
  33. ),
  34. [_FN1] = LAYOUT_ortho_4x4(
  35. KC_ESC, KC_P7, KC_P8, KC_P9,
  36. KC_TAB, KC_P4, KC_P5, KC_P6,
  37. KC_ENT, KC_P1, KC_P2, KC_P3,
  38. _______, KC_P0, KC_P0, KC_DOT
  39. ),
  40. [_FN2] = LAYOUT_ortho_4x4(
  41. UG_TOGG, UG_HUEU, UG_SATU, UG_VALU,
  42. UG_NEXT, UG_HUED, UG_SATD, UG_VALD,
  43. _______, _______, _______, QK_BOOT,
  44. BL_STEP, _______, QMKBEST, QMKURL
  45. )
  46. };
  47. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  48. switch (keycode) {
  49. case QMKBEST:
  50. if (record->event.pressed) {
  51. // when keycode QMKBEST is pressed
  52. SEND_STRING("QMK is the best thing ever!");
  53. } else {
  54. // when keycode QMKBEST is released
  55. }
  56. break;
  57. case QMKURL:
  58. if (record->event.pressed) {
  59. // when keycode QMKURL is pressed
  60. SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER));
  61. } else {
  62. // when keycode QMKURL is released
  63. }
  64. break;
  65. }
  66. return true;
  67. }