keymap.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /* Copyright 2015-2017 Jack Humbert
  2. * Contributor 2022 Stephon Parker
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include QMK_KEYBOARD_H
  18. enum planck_layers {
  19. _QWERTY,
  20. _LOWER,
  21. _RAISE,
  22. _ADJUST
  23. };
  24. enum planck_keycodes {
  25. QWERTY = SAFE_RANGE,
  26. LOWER,
  27. RAISE
  28. };
  29. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  30. /* Qwerty
  31. * ,-----------------------------------------------------------------------------------.
  32. * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
  33. * |------+------+------+------+------+-------------+------+------+------+------+------|
  34. * | Tab | A | S | D | F | G | H | J | K | L | ; |Enter |
  35. * |------+------+------+------+------+------|------+------+------+------+------+------|
  36. * | Shift| Z | X | C | V | B | N | M | , | . | / | ' |
  37. * |------+------+------+------+------+------+------+------+------+------+------+------|
  38. * | CAPS | Ctrl | Alt | GUI |Lower | Space |Raise | Left |Right | Up |Down |
  39. * `-----------------------------------------------------------------------------------'
  40. */
  41. [_QWERTY] = LAYOUT_planck_mit(
  42. KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
  43. KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
  44. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
  45. KC_CAPS, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, RAISE, KC_LEFT, KC_RGHT, KC_UP, KC_DOWN
  46. ),
  47. /* Lower
  48. * ,-----------------------------------------------------------------------------------.
  49. * | ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
  50. * |------+------+------+------+------+-------------+------+------+------+------+------|
  51. * | ` | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
  52. * |------+------+------+------+------+------|------+------+------+------+------+------|
  53. * | Shift| F7 | F8 | F9 | F10 | F11 | F12 | - | = | [ | ] | \ |
  54. * |------+------+------+------+------+------+------+------+------+------+------+------|
  55. * | Del | | | | | | | Next | Vol- | Vol+ | Play |
  56. * `-----------------------------------------------------------------------------------'
  57. */
  58. [_LOWER] = LAYOUT_planck_mit(
  59. KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
  60. KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
  61. KC_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
  62. KC_DEL, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
  63. ),
  64. /* Raise
  65. * ,-----------------------------------------------------------------------------------.
  66. * | ` | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
  67. * |------+------+------+------+------+-------------+------+------+------+------+------|
  68. * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
  69. * |------+------+------+------+------+------|------+------+------+------+------+------|
  70. * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
  71. * |------+------+------+------+------+------+------+------+------+------+------+------|
  72. * | | | | | | | | Next | Vol- | Vol+ | Play |
  73. * `-----------------------------------------------------------------------------------'
  74. */
  75. [_RAISE] = LAYOUT_planck_mit(
  76. KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
  77. KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
  78. _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
  79. _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
  80. ),
  81. /* Adjust (Lower + Raise)
  82. * ,-----------------------------------------------------------------------------------.
  83. * | | | | | | | | | | | | Del |
  84. * |------+------+------+------+------+-------------+------+------+------+------+------|
  85. * | | | | | |AGnorm|AGswap|Qwerty| | | | |
  86. * |------+------+------+------+------+------|------+------+------+------+------+------|
  87. * | | | | | | | | | | | | |
  88. * |------+------+------+------+------+------+------+------+------+------+------+------|
  89. * | | | | | | | | | | | |
  90. * `-----------------------------------------------------------------------------------'
  91. */
  92. [_ADJUST] = LAYOUT_planck_mit(
  93. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL ,
  94. _______, _______, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______,
  95. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  96. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  97. )
  98. };
  99. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  100. switch (keycode) {
  101. case QWERTY:
  102. if (record->event.pressed) {
  103. print("mode just switched to qwerty and this is a huge string\n");
  104. set_single_persistent_default_layer(_QWERTY);
  105. }
  106. return false;
  107. break;
  108. case LOWER:
  109. if (record->event.pressed) {
  110. layer_on(_LOWER);
  111. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  112. } else {
  113. layer_off(_LOWER);
  114. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  115. }
  116. return false;
  117. break;
  118. case RAISE:
  119. if (record->event.pressed) {
  120. layer_on(_RAISE);
  121. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  122. } else {
  123. layer_off(_RAISE);
  124. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  125. }
  126. return false;
  127. break;
  128. }
  129. return true;
  130. }