keymap.c 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #include "planck.h"
  2. #include "action_layer.h"
  3. #ifdef AUDIO_ENABLE
  4. #include "audio.h"
  5. #endif
  6. #include "eeconfig.h"
  7. extern keymap_config_t keymap_config;
  8. #define _BASE 0
  9. #define _MOVE 1
  10. #define _SYMB 2
  11. #define _MOUSE 3
  12. #define _FUNC 4
  13. #define ENDASH LALT(KC_MINS)
  14. #define POUND LALT(KC_3)
  15. #define H(X) LALT(LCTL(X))
  16. enum planck_keycodes {
  17. MOVE = SAFE_RANGE,
  18. SYMB,
  19. FUNC
  20. };
  21. // Fillers to make layering more clear
  22. #define _______ KC_TRNS
  23. #define XXXXXXX KC_NO
  24. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  25. /* BASE
  26. * ,-----------------------------------------------------------------------------------.
  27. * | Tab | Q | W | F | P | G | J | L | U | Y | ; | - |
  28. * |------+------+------+------+------+------+------+------+------+------+------+------|
  29. * | Bksp | A | R | S | T | D | H | N | E | I | O | " |
  30. * |------+------+------+------+------+------+------+------+------+------+------+------|
  31. * | Shift| Z | X | C | V | B | K | M | , | . | / | Shift|
  32. * |------+------+------+------+------+------+------+------+------+------+------+------|
  33. * | Func | Ctrl | Alt | Cmd | Symb | Enter| Space| Move | Cmd | Alt | Ctrl | Func |
  34. * `-----------------------------------------------------------------------------------'
  35. */
  36. [_BASE] = {
  37. {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
  38. {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
  39. {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
  40. {FUNC, KC_LCTL, KC_LALT, KC_LGUI, SYMB, KC_ENT, KC_SPC, MOVE, KC_RGUI, KC_RALT, KC_RCTL, FUNC }
  41. },
  42. /* MOVE
  43. * ,-----------------------------------------------------------------------------------.
  44. * | H(F7)| H(F8)| H(6) | H(5) | H(4) | H(F9)|H(F10)| Home | Up | End | H(A) | Esc |
  45. * |------+------+------+------+------+------+------+------+------+------+------+------|
  46. * | H(F3)| H(F4)| H(3) | H(2) | H(1) | H(F5)| H(F6)| Left | Down | Right| Caps | Del |
  47. * |------+------+------+------+------+------+------+------+------+------+------+------|
  48. * | | H(0) | H(9) | H(8) | H(7) | H(F1)| H(F2)| Pg Dn| Pg Up|H(F11)|H(F12)| |
  49. * |------+------+------+------+------+------+------+------+------+------+------+------|
  50. * | | | | | | | | | | | | |
  51. * `-----------------------------------------------------------------------------------'
  52. */
  53. [_MOVE] = {
  54. {H(KC_F7),H(KC_F8),H(KC_6), H(KC_5), H(KC_4), H(KC_F9),H(KC_F10),KC_HOME,KC_UP, KC_END, H(KC_A), KC_ESC },
  55. {H(KC_F3),H(KC_F4),H(KC_3), H(KC_2), H(KC_1), H(KC_F5),H(KC_F6),KC_LEFT, KC_DOWN, KC_RGHT, KC_CAPS, KC_DEL },
  56. {_______, H(KC_0), H(KC_9), H(KC_8), H(KC_7), H(KC_F1),H(KC_F2),KC_PGDN,KC_PGUP,H(KC_F11),H(KC_F12),_______},
  57. {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
  58. },
  59. /* SYMB
  60. * ,-----------------------------------------------------------------------------------.
  61. * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | – |
  62. * |------+------+------+------+------+------+------+------+------+------+------+------|
  63. * | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | £ |
  64. * |------+------+------+------+------+------+------+------+------+------+------+------|
  65. * | | ~ | ` | + | = | | | \ | [ | ] | { | } | |
  66. * |------+------+------+------+------+------+------+------+------+------+------+------|
  67. * | | | | | | | | | | | | |
  68. * `-----------------------------------------------------------------------------------'
  69. */
  70. [_SYMB] = {
  71. {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, ENDASH },
  72. {KC_DEL, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, POUND },
  73. {_______, KC_TILD, KC_GRV, KC_PLUS, KC_EQL, KC_PIPE, KC_BSLS, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, _______},
  74. {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
  75. },
  76. /* MOUSE
  77. * ,-----------------------------------------------------------------------------------.
  78. * | | | ACC-2| ACC-1| ACC-0| | | SW-L | M-U | SW-R | | |
  79. * |------+------+------+------+------+------+------+------+------+------+------+------|
  80. * | | | MB-3 | MB-2 | MB-1 | | | M-L | M-D | M-R | | |
  81. * |------+------+------+------+------+------+------+------+------+------+------+------|
  82. * | | | | | | | | SW-D | SW-U | | | |
  83. * |------+------+------+------+------+------+------+------+------+------+------+------|
  84. * | | | | | | | | | | | | |
  85. * `-----------------------------------------------------------------------------------'
  86. */
  87. [_MOUSE] = {
  88. {XXXXXXX, XXXXXXX, KC_ACL2, KC_ACL1, KC_ACL0, XXXXXXX, XXXXXXX, KC_WH_L, KC_MS_U, KC_WH_R, XXXXXXX, XXXXXXX},
  89. {XXXXXXX, XXXXXXX, KC_BTN3, KC_BTN2, KC_BTN1, XXXXXXX, XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, XXXXXXX, XXXXXXX},
  90. {_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_D, KC_WH_U, XXXXXXX, XXXXXXX, _______},
  91. {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
  92. },
  93. /* FUNC
  94. * ,-----------------------------------------------------------------------------------.
  95. * | Reset| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | Vol+ |
  96. * |------+------+------+------+------+------+------+------+------+------+------+------|
  97. * | | F11 | F12 | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | Vol- |
  98. * |------+------+------+------+------+------+------+------+------+------+------+------|
  99. * | | F21 | F22 | F23 | F24 | | | Power| | | | |
  100. * |------+------+------+------+------+------+------+------+------+------+------+------|
  101. * | | | | | Prev | Mute | Play | Next | | | | |
  102. * `-----------------------------------------------------------------------------------'
  103. */
  104. [_FUNC] = {
  105. {RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_VOLU},
  106. {XXXXXXX, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_VOLD},
  107. {_______, KC_F21, KC_F22, KC_F23, KC_F24, XXXXXXX, XXXXXXX, KC_POWER,XXXXXXX, XXXXXXX, XXXXXXX, _______},
  108. {_______, _______, _______, _______, KC_MPRV, KC_MUTE, KC_MPLY, KC_MNXT, _______, _______, _______, _______}
  109. }
  110. };
  111. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  112. switch (keycode) {
  113. case MOVE:
  114. if (record->event.pressed) {
  115. layer_on(_MOVE);
  116. update_tri_layer(_MOVE, _SYMB, _MOUSE);
  117. } else {
  118. layer_off(_MOVE);
  119. update_tri_layer(_MOVE, _SYMB, _MOUSE);
  120. }
  121. return false;
  122. break;
  123. case SYMB:
  124. if (record->event.pressed) {
  125. layer_on(_SYMB);
  126. update_tri_layer(_MOVE, _SYMB, _MOUSE);
  127. } else {
  128. layer_off(_SYMB);
  129. update_tri_layer(_MOVE, _SYMB, _MOUSE);
  130. }
  131. return false;
  132. break;
  133. case FUNC:
  134. if (record->event.pressed) {
  135. layer_on(_FUNC);
  136. } else {
  137. layer_off(_FUNC);
  138. }
  139. return false;
  140. break;
  141. }
  142. return true;
  143. }