logo

qmk_firmware

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

keymap.c (6401B)


  1. /* Copyright 2019 ENDO Katsuhiro <ka2hiro@kagizaraya.jp>
  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. // Defines the keycodes used by our macros in process_record_user
  18. enum layer_names {
  19. _QWERTY,
  20. _LOWER,
  21. _RAISE,
  22. _ADJUST,
  23. };
  24. // Defines the keycodes used by our macros in process_record_user
  25. enum custom_keycodes {
  26. LOWER = SAFE_RANGE,
  27. RAISE,
  28. ADJUST,
  29. };
  30. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  31. /* Qwerty
  32. *
  33. * ,----------------------------------------------------------------------------.
  34. * | Q | W | E | R | T | Y | U | I | O | P | BkSp |
  35. * |------+------+------+------+------|------+------+------+------+------|------|
  36. * | A | S | D | F | G | H | J | K | L | ; | Enter|
  37. * |------+------+------+------+------|------+------+------+------+------|------|
  38. * | Z | X | C | V | B | N | M | , | . | / | Shift|
  39. * `-------------+------+------+------|------+------+------+------+------+------'
  40. * | GUI | LOWER|Ctrl/Esc|Space| RAISE| Alt | Tab |
  41. * `------------------------------------------------'
  42. */
  43. [_QWERTY] = LAYOUT(
  44. KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
  45. KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
  46. KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT,
  47. KC_LGUI, LOWER, MT(MOD_LCTL, KC_ESC), KC_SPC, RAISE, KC_LALT, KC_TAB
  48. ),
  49. /* Raise
  50. *
  51. * ,----------------------------------------------------------------------------.
  52. * | ! | @ | # | $ | % | ^ | & | * | ( | ) | |
  53. * |------+------+------+------+------|------+------+------+------+------|------|
  54. * | Tab | _ | + | | | ~ | : | " | > | { | } | |
  55. * |------+------+------+------+------|------+------+------+------+------|------|
  56. * | Caps| - | = | \ | ` | ; | ' | < | [ | ] | |
  57. * `-------------+------+------+------|------+------+------+------+------+------'
  58. * | | | | | | | |
  59. * `------------------------------------------------'
  60. */
  61. [_RAISE] = LAYOUT(
  62. KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
  63. KC_TAB, KC_UNDS, KC_PLUS, KC_PIPE, KC_TILD, KC_COLN, KC_DQUO, KC_GT, KC_LCBR, KC_RCBR, _______,
  64. KC_CAPS, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, KC_SCLN, KC_QUOT, KC_LT, KC_LBRC, KC_RBRC, _______,
  65. _______, _______, _______, _______, _______, _______, _______
  66. ),
  67. /* Lower
  68. *
  69. * ,----------------------------------------------------------------------------.
  70. * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
  71. * |------+------+------+------+------|------+------+------+------+------|------|
  72. * | Tab | | | |Enter | Left | Down | Up | Right| Enter| |
  73. * |------+------+------+------+------|------+------+------+------+------|------|
  74. * | Ctrl| | GUI | Alt | Del | BkSp | PgUp | PgDn | | | |
  75. * `-------------+------+------+------|------+------+------+------+------+------'
  76. * | | | | | | | |
  77. * `------------------------------------------------'
  78. */
  79. [_LOWER] = LAYOUT(
  80. KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
  81. KC_TAB, _______, _______, _______, KC_ENT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_ENT, _______,
  82. KC_LCTL, _______, KC_LGUI, KC_LALT, KC_DEL, KC_BSPC, KC_PGUP, KC_PGDN, _______, _______, _______,
  83. _______, _______, _______, _______, _______, _______, _______
  84. ),
  85. /* Adjust (Lower + Raise)
  86. *
  87. * ,----------------------------------------------------------------------------.
  88. * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | |
  89. * |------+------+------+------+------|------+------+------+------+------|------|
  90. * | F11 | F12 | |RGBSAI|RGBSAD|RGBVAI|RGBVAD| | | | |
  91. * |------+------+------+------+------|------+------+------+------+------|------|
  92. * | Reset|RGBTOG|RGBMOD|RGBHUI|RGBHUD| Prev | Next | Vol- | Vol+ | Play | |
  93. * `-------------+------+------+------|------+------+------+------+------+------'
  94. * | | | | | | | |
  95. * `------------------------------------------------'
  96. */
  97. [_ADJUST] = LAYOUT(
  98. KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
  99. KC_F11, KC_F12, UG_PREV, UG_SATU, UG_SATD, UG_VALU, UG_VALD, _______, _______, _______, _______,
  100. QK_BOOT, UG_TOGG, UG_NEXT, UG_HUEU, UG_HUED, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______,
  101. _______, _______, _______, _______, _______, _______, _______
  102. )
  103. };
  104. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  105. switch (keycode) {
  106. case LOWER:
  107. if (record->event.pressed) {
  108. layer_on(_LOWER);
  109. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  110. } else {
  111. layer_off(_LOWER);
  112. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  113. }
  114. return false;
  115. case RAISE:
  116. if (record->event.pressed) {
  117. layer_on(_RAISE);
  118. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  119. } else {
  120. layer_off(_RAISE);
  121. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  122. }
  123. return false;
  124. case ADJUST:
  125. if (record->event.pressed) {
  126. layer_on(_ADJUST);
  127. } else {
  128. layer_off(_ADJUST);
  129. }
  130. return false;
  131. }
  132. return true;
  133. }