keymap.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* Copyright 2015-2017 Jack Humbert
  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. extern keymap_config_t keymap_config;
  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. BACKLIT,
  29. EXT_PLV
  30. };
  31. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  32. /* Qwerty
  33. * ,-----------------------------------------------------------------------------------.
  34. * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
  35. * |------+------+------+------+------+-------------+------+------+------+------+------|
  36. * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
  37. * |------+------+------+------+------+------|------+------+------+------+------+------|
  38. * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
  39. * |------+------+------+------+------+------+------+------+------+------+------+------|
  40. * | Ctrl |Brite | GUI | Alt |Lower | Space |Raise | Left | Down | Up |Right |
  41. * `-----------------------------------------------------------------------------------'
  42. */
  43. [_QWERTY] = LAYOUT_planck_grid(
  44. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
  45. KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
  46. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
  47. KC_LCTL, BACKLIT, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
  48. ),
  49. /* Lower
  50. * ,-----------------------------------------------------------------------------------.
  51. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
  52. * |------+------+------+------+------+-------------+------+------+------+------+------|
  53. * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
  54. * |------+------+------+------+------+------|------+------+------+------+------+------|
  55. * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Vol- | Vol+ | |
  56. * |------+------+------+------+------+------+------+------+------+------+------+------|
  57. * | | | | ALTGr| | | | Home |Pg Dn |Pg Up | End |
  58. * `-----------------------------------------------------------------------------------'
  59. */
  60. [_LOWER] = LAYOUT_planck_grid(
  61. KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
  62. KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
  63. _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_VOLD, KC_VOLU, _______,
  64. _______, _______, _______, KC_RALT, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
  65. ),
  66. /* Raise
  67. * ,-----------------------------------------------------------------------------------.
  68. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
  69. * |------+------+------+------+------+-------------+------+------+------+------+------|
  70. * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
  71. * |------+------+------+------+------+------|------+------+------+------+------+------|
  72. * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | Vol- | Vol+ | |
  73. * |------+------+------+------+------+------+------+------+------+------+------+------|
  74. * | | | | ALTGr| | | | Home |Pg Dn |Pg Up | End |
  75. * `-----------------------------------------------------------------------------------'
  76. */
  77. [_RAISE] = LAYOUT_planck_grid(
  78. KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
  79. KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
  80. _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_VOLD, KC_VOLU, _______,
  81. _______, _______, _______, KC_RALT, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
  82. ),
  83. /* Adjust (Lower + Raise)
  84. * ,-----------------------------------------------------------------------------------.
  85. * | | Reset| | | | | | | | | | Del |
  86. * |------+------+------+------+------+-------------+------+------+------+------+------|
  87. * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | |
  88. * |------+------+------+------+------+------|------+------+------+------+------+------|
  89. * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
  90. * |------+------+------+------+------+------+------+------+------+------+------+------|
  91. * | | | | | | | | | | | |
  92. * `-----------------------------------------------------------------------------------'
  93. */
  94. [_ADJUST] = LAYOUT_planck_grid(
  95. _______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
  96. _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______,
  97. _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
  98. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  99. )
  100. };
  101. #ifdef AUDIO_ENABLE
  102. float plover_song[][2] = SONG(PLOVER_SOUND);
  103. float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
  104. #endif
  105. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  106. switch (keycode) {
  107. case QWERTY:
  108. if (record->event.pressed) {
  109. print("mode just switched to qwerty and this is a huge string\n");
  110. set_single_persistent_default_layer(_QWERTY);
  111. }
  112. return false;
  113. case LOWER:
  114. if (record->event.pressed) {
  115. layer_on(_LOWER);
  116. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  117. } else {
  118. layer_off(_LOWER);
  119. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  120. }
  121. return false;
  122. case RAISE:
  123. if (record->event.pressed) {
  124. layer_on(_RAISE);
  125. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  126. } else {
  127. layer_off(_RAISE);
  128. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  129. }
  130. return false;
  131. case BACKLIT:
  132. if (record->event.pressed) {
  133. register_code(KC_RSFT);
  134. #ifdef BACKLIGHT_ENABLE
  135. backlight_step();
  136. #endif
  137. } else {
  138. unregister_code(KC_RSFT);
  139. }
  140. return false;
  141. }
  142. return true;
  143. }