logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (16342B)


  1. /*
  2. Copyright 2020 Garret Gartner
  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. enum avenue_layers {
  16. _QWERTY,
  17. _LOWER,
  18. _RAISE,
  19. _FUNCTION
  20. };
  21. //Tap Dance Declarations:
  22. enum avenue_tapcodes {
  23. TD_RST,
  24. TD_DBQT,
  25. };
  26. void dance_rst_reset (tap_dance_state_t *state, void *user_data) { // *Line_Note.001
  27. if (state->count >= 2) {
  28. reset_keyboard();
  29. reset_tap_dance(state);
  30. }
  31. }
  32. //Tap Dance Functions:
  33. tap_dance_action_t tap_dance_actions[] = {
  34. [TD_RST] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, NULL, dance_rst_reset), // References "dance_rst_reset" (*Line_Note.001)
  35. [TD_DBQT] = ACTION_TAP_DANCE_DOUBLE (KC_QUOTE, KC_DQT)
  36. };
  37. // Keymap Customization:
  38. #define LOWR MO(_LOWER)
  39. #define RISE MO(_RAISE)
  40. #define FN MO(_FUNCTION)
  41. #define GUI KC_LGUI
  42. #define ALT KC_LALT
  43. #define SPACE KC_SPACE
  44. /*
  45. * ┌────┐
  46. * │ │ = "TRANSPARENT" KEY LOCATION
  47. * └────┘
  48. */
  49. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  50. /* _QWERTY (Base)
  51. *
  52. * ┌────┐ ┌────┐ ┌────┬────┬────┐
  53. * │MUTE│ │Esc │ │ \ │ - │ = │
  54. * └────┘ └────┘ └────┴────┴────┘
  55. * ┌────┐ ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐
  56. * │Home│ │Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │BkSp│
  57. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  58. * │PgUp│ │CAPS│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │
  59. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  60. * │PgDn│ │Shft│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │Entr│
  61. * ├────┤ ├────┼────┼────┼────┼────┼────┴────┼────┼────┼────┼────┼────┤
  62. * │End │ │CTL │GUI │ALT │FUNC│LOWR│ │ │RISE│Left│Down│ Up │Rght│
  63. * └────┘ └────┴────┴────┴────┴────┴─────────┴────┴────┴────┴────┴────┘
  64. */
  65. [_QWERTY] = LAYOUT_all(
  66. KC_MUTE, KC_ESC, KC_BSLS, KC_MINUS, KC_EQUAL,
  67. KC_HOME, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
  68. KC_PGUP, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
  69. KC_PGDN, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
  70. KC_END, KC_DEL, GUI, ALT, FN, LOWR, SPACE, SPACE, RISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT
  71. ),
  72. /* _LOWER (Media / Symbols / Punctuation)
  73. *
  74. * ┌────┐ ┌────┐ ┌────┬────┬────┐
  75. * │ // │ │PRNT│ │ [ │ ] │ ` │
  76. * └────┘ └────┘ └────┴────┴────┘
  77. * ┌────┐ ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐
  78. * │PLAY│ │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ │
  79. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  80. * │NEXT│ │ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ " │
  81. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  82. * │PREV│ │ │ │ │ │ │ │ │ │ │ │ │ │
  83. * ├────┤ ├────┼────┼────┼────┼────┼────┴────┼────┼────┼────┼────┼────┤
  84. * │STOP│ │ │ │ │ │ │ │ │ │ │ │ │ │
  85. * └────┘ └────┴────┴────┴────┴────┴─────────┴────┴────┴────┴────┴────┘
  86. */
  87. [_LOWER] = LAYOUT_all(
  88. _______, _______, KC_LBRC, KC_RBRC, KC_GRAVE,
  89. KC_MPLY, _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
  90. KC_MNXT, _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DQT,
  91. KC_MPRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  92. KC_MSTP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  93. ),
  94. /* _RAISE (Misc Modifiers / Extended Punctuation)
  95. *
  96. * ┌────┐ ┌────┐ ┌────┬────┬────┐
  97. * │PRNT│ │ │ │ { │ } │ ~ │
  98. * └────┘ └────┘ └────┴────┴────┘
  99. * ┌────┐ ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐
  100. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  101. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  102. * │ │ │CAPS│ │ │ │ │ │ │ │ │ │ │ │
  103. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  104. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  105. * ├────┤ ├────┼────┼────┼────┼────┼────┴────┼────┼────┼────┼────┼────┤
  106. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  107. * └────┘ └────┴────┴────┴────┴────┴─────────┴────┴────┴────┴────┴────┘
  108. */
  109. [_RAISE] = LAYOUT_all(
  110. KC_PSCR, _______, KC_LCBR, KC_RCBR, KC_TILD,
  111. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  112. _______, KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  113. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  114. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  115. ),
  116. /* _FUNCTION (F-Row / DFU Reset / RGB Toggle)
  117. *
  118. * ┌────┐ ┌────┐ ┌────┬────┬────┐
  119. * │RSET│ │RGB │ │F11 │F12 │F13 │
  120. * └────┘ └────┘ └────┴────┴────┘
  121. * ┌────┐ ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐
  122. * │ │ │ │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │F10 │ │
  123. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  124. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  125. * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  126. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  127. * ├────┤ ├────┼────┼────┼────┼────┼────┴────┼────┼────┼────┼────┼────┤
  128. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  129. * └────┘ └────┴────┴────┴────┴────┴─────────┴────┴────┴────┴────┴────┘
  130. */
  131. [_FUNCTION] = LAYOUT_all(
  132. TD(TD_RST), UG_TOGG, KC_F11, KC_F12, KC_F13,
  133. _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
  134. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  135. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  136. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  137. )
  138. };
  139. // KEYMAP TEMPLATE:
  140. //
  141. // /* <_LAYER>:
  142. // *
  143. // * ┌────┐ ┌────┐ ┌────┬────┬────┐
  144. // * │ │ │ │ │ │ │ │
  145. // * └────┘ └────┘ └────┴────┴────┘
  146. // * ┌────┐ ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐
  147. // * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  148. // * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  149. // * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  150. // * ├────┤ ├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
  151. // * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  152. // * ├────┤ ├────┼────┼────┼────┼────┼────┴────┼────┼────┼────┼────┼────┤
  153. // * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  154. // * └────┘ └────┴────┴────┴────┴────┴─────────┴────┴────┴────┴────┴────┘
  155. // */
  156. // [<LAYER>] = LAYOUT_all(
  157. // _______, _______, _______, _______, _______,
  158. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  159. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  160. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  161. // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  162. // )
  163. // Per-Key Tapping Term Definitions:
  164. uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
  165. switch (keycode) {
  166. case TD(TD_DBQT):
  167. return 235;
  168. default:
  169. return TAPPING_TERM;
  170. }
  171. }
  172. // Encoder Customization: (*Order-of-Keycode Specific)
  173. bool encoder_update_user(uint8_t index, bool clockwise) {
  174. if (index == 0) {
  175. if (clockwise) {
  176. tap_code(KC_VOLU);
  177. } else {
  178. tap_code(KC_VOLD);
  179. }
  180. }
  181. return true;
  182. }
  183. // RGB Indicator Customization: (100% stolen from Jetpacktuxedo)
  184. void keyboard_post_init_user(void) {
  185. #ifdef RGBLIGHT_ENABLE
  186. // Set up RGB effects on _only_ the first LED (index 0):
  187. rgblight_set_effect_range(0, 1);
  188. // Set LED effects to breathing mode in a "terminal-green" type color:
  189. rgblight_sethsv_noeeprom(50, 255, 100);
  190. rgblight_mode_noeeprom(RGBLIGHT_EFFECT_BREATHING + 2);
  191. // Init the second LED to a static color:
  192. rgblight_setrgb_at(225, 185, 0, 1);
  193. #endif // RGBLIGHT_ENABLE
  194. }
  195. // RGB Indicator Customization: (cont.)
  196. layer_state_t layer_state_set_user(layer_state_t state){
  197. #ifdef RGBLIGHT_ENABLE
  198. uint8_t led1r = 0;
  199. uint8_t led1g = 0;
  200. uint8_t led1b = 0;
  201. if (layer_state_cmp(state, 1)) {
  202. led1b = 255;
  203. }
  204. if (layer_state_cmp(state, 3)) {
  205. led1r = 200;
  206. }
  207. rgblight_setrgb_at(led1r, led1g, led1b, 1);
  208. #endif //RGBLIGHT_ENABLE
  209. return state;
  210. }