pvc_planck.c 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. // This is the canonical layout file for the Quantum project. If you want to add another keyboard,
  2. // this is the style you want to emulate.
  3. #include "planck.h"
  4. #include "print.h"
  5. #include "action_layer.h"
  6. #ifdef BACKLIGHT_ENABLE
  7. #include "backlight.h"
  8. #endif
  9. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  10. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  11. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  12. // entirely and just use numbers.
  13. #define _QW 0
  14. #define _CM 1
  15. #define _DV 2
  16. #define _LW 3
  17. #define _RS 4
  18. #define _FN 5
  19. #define XXXXXXX KC_NO
  20. #define _______ KC_TRNS
  21. #define ASFT(kc) LSFT(RSFT(kc))
  22. #define MG_B ASFT(KC_B)
  23. #define MG_H ASFT(KC_H)
  24. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  25. /* Qwerty
  26. * ,-----------------------------------------------------------------------------------.
  27. * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
  28. * |------+------+------+------+------+-------------+------+------+------+------+------|
  29. * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
  30. * |------+------+------+------+------+------|------+------+------+------+------+------|
  31. * | Shift| Z | X | C | V | B | N | M | , | . | Up |Enter |
  32. * |------+------+------+------+------+------+------+------+------+------+------+------|
  33. * | Ctrl | GUI | Alt | Del |Raise | Space |Lower | / | Left | Down |Right |
  34. * `-----------------------------------------------------------------------------------'
  35. */
  36. [_QW] = {
  37. {RESET, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
  38. {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
  39. {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT },
  40. {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, M(_LW), KC_SPC, KC_SPC, M(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT}
  41. },
  42. /* Colemak
  43. * ,-----------------------------------------------------------------------------------.
  44. * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
  45. * |------+------+------+------+------+-------------+------+------+------+------+------|
  46. * | Esc | A | R | S | T | D | H | N | E | I | O | " |
  47. * |------+------+------+------+------+------|------+------+------+------+------+------|
  48. * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
  49. * |------+------+------+------+------+------+------+------+------+------+------+------|
  50. * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right |
  51. * `-----------------------------------------------------------------------------------'
  52. */
  53. [_CM] = {
  54. {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
  55. {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
  56. {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
  57. {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
  58. },
  59. /* Dvorak
  60. * ,-----------------------------------------------------------------------------------.
  61. * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
  62. * |------+------+------+------+------+-------------+------+------+------+------+------|
  63. * | Esc | A | O | E | U | I | D | H | T | N | S | / |
  64. * |------+------+------+------+------+------|------+------+------+------+------+------|
  65. * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
  66. * |------+------+------+------+------+------+------+------+------+------+------+------|
  67. * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right |
  68. * `-----------------------------------------------------------------------------------'
  69. */
  70. [_DV] = {
  71. {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
  72. {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
  73. {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
  74. {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
  75. },
  76. /* Raise
  77. * ,-----------------------------------------------------------------------------------.
  78. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
  79. * |------+------+------+------+------+-------------+------+------+------+------+------|
  80. * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
  81. * |------+------+------+------+------+------|------+------+------+------+------+------|
  82. * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
  83. * |------+------+------+------+------+------+------+------+------+------+------+------|
  84. * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play |
  85. * `-----------------------------------------------------------------------------------'
  86. */
  87. [_RS] = {
  88. {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
  89. {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
  90. {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______},
  91. {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
  92. },
  93. /* Lower
  94. * ,-----------------------------------------------------------------------------------.
  95. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
  96. * |------+------+------+------+------+-------------+------+------+------+------+------|
  97. * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
  98. * |------+------+------+------+------+------|------+------+------+------+------+------|
  99. * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
  100. * |------+------+------+------+------+------+------+------+------+------+------+------|
  101. * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play |
  102. * `-----------------------------------------------------------------------------------'
  103. */
  104. [_LW] = {
  105. {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
  106. {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
  107. {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______},
  108. {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
  109. },
  110. /* Function
  111. * ,-----------------------------------------------------------------------------------.
  112. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
  113. * |------+------+------+------+------+-------------+------+------+------+------+------|
  114. * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
  115. * |------+------+------+------+------+------|------+------+------+------+------+------|
  116. * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
  117. * |------+------+------+------+------+------+------+------+------+------+------+------|
  118. * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play |
  119. * `-----------------------------------------------------------------------------------'
  120. */
  121. [_FN] = {
  122. {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
  123. {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
  124. {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
  125. {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
  126. }
  127. };
  128. const uint16_t PROGMEM fn_actions[] = {
  129. };
  130. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
  131. {
  132. // MACRODOWN only works in this function
  133. switch(id)
  134. {
  135. case _RS:
  136. if (record->event.pressed) {
  137. print("RS_DN");
  138. layer_on(_RS);
  139. update_tri_layer(_RS, _LW, _FN);
  140. } else {
  141. print("RS_UP");
  142. layer_off(_RS);
  143. update_tri_layer(_RS, _LW, _FN);
  144. phex(layer_state);
  145. }
  146. break;
  147. case _LW:
  148. if (record->event.pressed) {
  149. print("LW_DN");
  150. layer_on(_LW);
  151. update_tri_layer(_RS, _LW, _FN);
  152. } else {
  153. print("LW_UP");
  154. layer_off(_LW);
  155. update_tri_layer(_RS, _LW, _FN);
  156. }
  157. break;
  158. default:
  159. break;
  160. }
  161. return MACRO_NONE;
  162. };