keymap.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*
  2. Copyright 2018 Jacob Jerrell jacob.jerrell@gmail.com @JacobJerrell
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. #include "bocaj.h"
  16. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  17. /* Hardware Workman - http://www.keyboard-layout-editor.com/#/gists/7a07cb982ec3597ba3e3d947554225f1
  18. .---------------------------------------------. .---------------------------------------------.
  19. | ESC | 1 | 2 | 3 | 4 | 5 | -> | ! - | 6 | 7 | 8 | 9 | 0 | = |
  20. !-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
  21. | DEL | Q | D | R | W | B | ( | ! ) | J | F | U | P | ; | \ |
  22. !-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
  23. | NUMS | A | S | H | T | G |-------! !-------! Y | N | E | O | I | ' |
  24. !-------+-----+-----+-----x-----x-----! HYP ! ! MEH !-----x-----x-----+-----+-----+-------!
  25. | SHIFT | Z | X | M | C | V | [ | ! ] | K | L | , | . | / | SHIFT |
  26. '-------+-----+-----+-----+-----+-------------' '-------------+-----+-----+-----+-----+-------'
  27. | GAME | NUM | LWR | UP | LFT | .---------------. .---------------. ! RGT | DWN | | | ADJ |
  28. '------------------------------' | APP | HOME | ! PGUP | ESC | '------------------------------'
  29. .-------+-------+-------! !-------+-------+-------.
  30. ! ! | END | ! PGDN | ! ENTER !
  31. ! SPACE ! BSPCE !-------! !-------! TAB ! / !
  32. | | | COPY | ! PASTE | | LOWER |
  33. '-----------------------' '-----------------------'
  34. */
  35. [_HWRKMN] = LAYOUT_ergodox_pretty_wrapper(
  36. KC_ESC, _______________________NUMBER_LEFT_______________________, JJ_ARRW, KC_MINUS,_______________________NUMBER_RIGHT______________________, KC_EQUAL,
  37. KC_DEL, _______________________HWORKMAN_L1_______________________, KC_LPRN, KC_RPRN, _______________________HWORKMAN_R1_______________________, KC_BSLS,
  38. KC_NUMS,_______________________HWORKMAN_L2_______________________, _______________________HWORKMAN_R2_______________________, KC_QUOTE,
  39. KC_LSFT,_______________________HWORKMAN_L3_______________________, HYP_LBK, MEH_RBK, _______________________HWORKMAN_R3_______________________, KC_RSFT,
  40. ___________________ERGODOX_BOTTOM_LEFT___________________, ___________________ERGODOX_BOTTOM_RIGHT__________________,
  41. ______________________ERGODOX_THUMBS_____________________
  42. ),
  43. /* Software Workman / QWERTY - http://www.keyboard-layout-editor.com/#/gists/b6c016a22a9d31381a276a603a42fe5f
  44. .---------------------------------------------. .---------------------------------------------.
  45. | ESC | 1 | 2 | 3 | 4 | 5 | -> | ! - | 6 | 7 | 8 | 9 | 0 | = |
  46. !-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
  47. | DEL | Q | W | E | R | T | ( | ! ) | Y | U | I | O | P | \ |
  48. !-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
  49. | NUMS | A | S | D | F | G |-------! !-------! H | J | K | L | ; | ' |
  50. !-------+-----+-----+-----x-----x-----! HYP ! ! MEH !-----x-----x-----+-----+-----+-------!
  51. | SHIFT | Z | X | C | V | B | [ | ! ] | N | M | , | . | / | SHIFT |
  52. '-------+-----+-----+-----+-----+-------------' '-------------+-----+-----+-----+-----+-------'
  53. | GAME | NUM | LWR | UP | LFT | .---------------. .---------------. ! RGT | DWN | | | ADJ |
  54. '------------------------------' | APP | HOME | ! PGUP | ESC | '------------------------------'
  55. .-------+-------+-------! !-------+-------+-------.
  56. ! ! | END | ! PGDN | ! ENTER !
  57. ! SPACE ! BSPCE !-------! !-------! TAB ! / !
  58. | | | COPY | ! PASTE | | LOWER |
  59. '-----------------------' '-----------------------'
  60. */
  61. [_SWRKMN] = LAYOUT_ergodox_pretty_wrapper(
  62. KC_ESC, _______________________NUMBER_LEFT_______________________, JJ_ARRW, KC_MINUS,_______________________NUMBER_RIGHT______________________, KC_EQUAL,
  63. KC_DEL, _______________________SWORKMAN_L1_______________________, KC_LPRN, KC_RPRN, _______________________SWORKMAN_R1_______________________, KC_BSLS,
  64. KC_NUMS,_______________________SWORKMAN_L2_______________________, _______________________SWORKMAN_R2_______________________, KC_QUOTE,
  65. KC_LSFT,_______________________SWORKMAN_L3_______________________, HYP_LBK, MEH_RBK, _______________________SWORKMAN_R3_______________________, KC_RSFT,
  66. ___________________ERGODOX_BOTTOM_LEFT___________________, ___________________ERGODOX_BOTTOM_RIGHT__________________,
  67. ______________________ERGODOX_THUMBS_____________________
  68. ),
  69. /* Lower - http://www.keyboard-layout-editor.com/#/gists/f1d745a88d1c48ab55e095efd9e7a43a
  70. .---------------------------------------------. .---------------------------------------------.
  71. | ESC | | | | | | -> | ! - | | | | | | = |
  72. !-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
  73. | DEL | ! | @ | # | $ | % | ( | ! ) | ^ | & | * | ( | ) | \ |
  74. !-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
  75. | ` | 1 | 2 | 3 | 4 | 5 |-------! !-------! 6 | 7 | 8 | 9 | 0 | ' |
  76. !-------+-----+-----+-----x-----x-----! HYP ! ! MEH !-----x-----x-----+-----+-----+-------!
  77. | SHIFT | | | | | | [ | ! ] | | | | | | SHIFT |
  78. '-------+-----+-----+-----+-----+-------------' '-------------+-----+-----+-----+-----+-------'
  79. | GAME | NUM | LWR | UP | LFT | .---------------. .---------------. ! RGT | DWN | | | ADJ |
  80. '------------------------------' | APP | HOME | ! PGUP | ESC | '------------------------------'
  81. .-------+-------+-------! !-------+-------+-------.
  82. ! ! | END | ! PGDN | ! ENTER !
  83. ! SPACE ! BSPCE !-------! !-------! TAB ! / !
  84. | | | COPY | ! PASTE | | LOWER |
  85. '-----------------------' '-----------------------'
  86. */
  87. [_LOWER] = LAYOUT_ergodox_pretty_wrapper(
  88. _______,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, _______, _______, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, _______,
  89. _______,_______________________SPECIAL_LEFT______________________, _______, _______, _______________________SPECIAL_RIGHT_____________________, _______,
  90. KC_GRV ,_______________________NUMBER_LEFT_______________________, _______________________NUMBER_RIGHT______________________, _______,
  91. _______,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, _______, _______, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, _______,
  92. _________________________________________________________, _________________________________________________________,
  93. ______________________ERGODOX_THUMBS_____________________
  94. ),
  95. /* Adjust - http://www.keyboard-layout-editor.com/#/gists/dedeae17b35a5d5f745a42aaea78f007
  96. .---------------------------------------------. .---------------------------------------------.
  97. | | | | | | | EPRM | ! EPRM | | | | | | |
  98. !-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
  99. | | | | | | | | ! | | | | | | |
  100. !-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
  101. | | 🔇 | 🔉 | 🔊 | LCK | |-------! !-------! | | | | | SWRKM |
  102. !-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
  103. | | | | | | | | ! | | | | | | HWRKM |
  104. '-------+-----+-----+-----+-----+-------------' '-------------+-----+-----+-----+-----+-------'
  105. | | | | | | .---------------. .---------------. ! | | | | |
  106. '------------------------------' | | | ! | | '------------------------------'
  107. .-------+-------+-------! !-------+-------+-------.
  108. ! ! | | ! | ! !
  109. ! ! !-------! !-------! ! !
  110. | | | | ! | | |
  111. '-----------------------' '-----------------------'
  112. */
  113. [_ADJUST] = LAYOUT_ergodox_pretty_wrapper(
  114. XXXXXXX,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, KC_EPRM, KC_EPRM, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX,
  115. XXXXXXX,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  116. XXXXXXX,KC__MUTE, KC__VOLDOWN, KC__VOLUP, MC_LOCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SWRK,
  117. XXXXXXX,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_HWRK,
  118. XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
  119. ______________________ERGODOX_THUMBS_____________________
  120. ),
  121. [_NUMS] = LAYOUT_ergodox_pretty_wrapper(
  122. XXXXXXX,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX, XXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX,
  123. XXXXXXX,XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_KP_7, KC_KP_8, KC_KP_9, KC_PAST, XXXXXXX,
  124. _______,XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, XXXXXXX, XXXXXXX, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, XXXXXXX,
  125. LM_SHFT,XXXXXXX, XXXXXXX, XXXXXXX, JJ_COPY, JJ_PSTE, XXXXXXX, XXXXXXX, XXXXXXX, KC_KP_1, KC_KP_2, KC_KP_3, KC_PMNS, XXXXXXX,
  126. XXXXXXX,_______,XXXXXXX,XXXXXXX,XXXXXXX, KC_KP_0, KC_PDOT, KC_COMM, KC_PEQL, XXXXXXX,
  127. _______, _______, _______,_______,
  128. _______, _______,
  129. KC_LALT,KC_LGUI,_______, _______,_______,_______
  130. ),
  131. [_NMOD] = LAYOUT_ergodox_pretty_wrapper(
  132. XXXXXXX,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX, XXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX,
  133. XXXXXXX,XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX,
  134. XXXXXXX,XXXXXXX, _______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX,
  135. LM_SHFT,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX,
  136. XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, _______, _______, _______, _______, XXXXXXX,
  137. XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,
  138. XXXXXXX, XXXXXXX,
  139. KC_LALT,KC_LGUI,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX
  140. ),
  141. // Diablo - http://www.keyboard-layout-editor.com/#/gists/28476e4237e77d4835ac8a9d7e5f9b2c
  142. [_DIABLO] = LAYOUT_ergodox_pretty_wrapper(
  143. KC_ESC , XXXXXXX , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  144. KC_TAB , KC_Q ,ALT_T(KC_S), KC_I , KC_F , KC_J ,KC_MINS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  145. KC_LOCK, KC_1 , KC_2 , KC_3 , KC_4 ,KC_DCLR , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  146. KC_LSFT, KC_D3_1 , KC_D3_2 , KC_D3_3 , KC_D3_4 , KC_T ,KC_MINS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  147. _______, XXXXXXX , XXXXXXX , XXXXXXX , KC_M , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
  148. XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,
  149. XXXXXXX, XXXXXXX,
  150. KC_BTN1,KC_BTN2,KC_ENTER, XXXXXXX,XXXXXXX,XXXXXXX
  151. )
  152. };
  153. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  154. uint8_t default_layer = 0;
  155. default_layer = eeconfig_read_default_layer();
  156. switch (keycode) {
  157. case KC_SWRK:
  158. if (!record->event.pressed) {
  159. set_single_persistent_default_layer(_SWRKMN);
  160. layer_move(default_layer);
  161. ergodox_blink_all_leds();
  162. ergodox_blink_all_leds();
  163. }
  164. return false;
  165. break;
  166. case KC_HWRK:
  167. if (!record->event.pressed) {
  168. set_single_persistent_default_layer(_HWRKMN);
  169. layer_move(default_layer);
  170. ergodox_blink_all_leds();
  171. ergodox_blink_all_leds();
  172. }
  173. return false;
  174. break;
  175. case KC_EPRM:
  176. if (!record->event.pressed) {
  177. ergodox_blink_all_leds();
  178. eeconfig_init();
  179. }
  180. return false;
  181. break;
  182. case MC_LOCK:
  183. if (!record->event.pressed) {
  184. layer_move(default_layer);
  185. SEND_STRING(SS_LCTRL(SS_LGUI("q")));
  186. }
  187. return false;
  188. break;
  189. }
  190. return true;
  191. }
  192. void matrix_init_keymap(void) {};
  193. void matrix_scan_keymap(void) {
  194. uint8_t layer = biton32(layer_state);
  195. ergodox_board_led_off();
  196. ergodox_right_led_1_off();
  197. ergodox_right_led_2_off();
  198. ergodox_right_led_3_off();
  199. switch (layer) {
  200. /*
  201. Lights are treated as binary here for easy identification.
  202. LED1 = 4; LED2 = 2; LED1 = 1
  203. This allows for up to 8 identified layers (default layers being no lights on)
  204. Which is way more than I should ever need
  205. */
  206. case _LOWER:
  207. ergodox_right_led_3_on();
  208. ergodox_right_led_3_set(10); // Default brightness is deadly in a dark room
  209. break;
  210. case _ADJUST:
  211. ergodox_right_led_2_on();
  212. ergodox_right_led_2_set(10);
  213. break;
  214. case _NUMS:
  215. ergodox_right_led_2_on();
  216. ergodox_right_led_2_set(10);
  217. ergodox_right_led_3_on();
  218. ergodox_right_led_3_set(10);
  219. break;
  220. case _NMOD:
  221. ergodox_right_led_1_on();
  222. ergodox_right_led_1_set(10);
  223. ergodox_right_led_2_on();
  224. ergodox_right_led_2_set(10);
  225. ergodox_right_led_3_on();
  226. ergodox_right_led_3_set(10);
  227. break;
  228. case _DIABLO:
  229. ergodox_right_led_1_on();
  230. ergodox_right_led_1_set(10);
  231. break;
  232. default:
  233. // none
  234. break;
  235. }
  236. /* #ifdef TAP_DANCE_ENABLE
  237. run_diablo_macro_check();
  238. #endif */
  239. };