drashna.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /*
  2. Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
  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. #ifndef USERSPACE
  15. #define USERSPACE
  16. #include "quantum.h"
  17. // Define layer names
  18. #define _QWERTY 0
  19. #define _NUMLOCK 0
  20. #define _COLEMAK 1
  21. #define _DVORAK 2
  22. #define _WORKMAN 3
  23. #define _MODS 4
  24. //#define _MISC 5
  25. #define _NAV 6
  26. #define _COVECUBE 7
  27. #define _SYMB 8
  28. #define _GAMEPAD 9
  29. #define _DIABLO 10
  30. #define _MOUS 11
  31. #define _MACROS 12
  32. #define _MEDIA 13
  33. #define _LOWER 14
  34. #define _RAISE 15
  35. #define _ADJUST 16
  36. //define modifiers
  37. #define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
  38. #define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
  39. #define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
  40. #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
  41. #ifndef RGBLIGHT_ANIMATIONS // add "EXTRA_FLADS=-DDRASHNA_SETRGB" to enable this ... but don't
  42. #define rgblight_set_blue rgblight_setrgb (0x00, 0x00, 0xFF);
  43. #define rgblight_set_red rgblight_setrgb (0xFF, 0x00, 0x00);
  44. #define rgblight_set_green rgblight_setrgb (0x00, 0xFF, 0x00);
  45. #define rgblight_set_orange rgblight_setrgb (0xFF, 0x80, 0x00);
  46. #define rgblight_set_teal rgblight_setrgb (0x00, 0xFF, 0xFF);
  47. #define rgblight_set_magenta rgblight_setrgb (0xFF, 0x00, 0xFF);
  48. #define rgblight_set_yellow rgblight_setrgb (0xFF, 0xFF, 0x00);
  49. #define rgblight_set_purple rgblight_setrgb (0x7A, 0x00, 0xFF);
  50. #define rgblight_set_white rgblight_setrgb (0xFF, 0xFF, 0xFF);
  51. #else
  52. #define rgblight_set_white rgblight_sethsv (0, 0x00, 255);
  53. #define rgblight_set_red rgblight_sethsv (0, 255, 255);
  54. #define rgblight_set_coral rgblight_sethsv (16, 176, 255);
  55. #define rgblight_set_orange rgblight_sethsv (39, 255, 255);
  56. #define rgblight_set_goldenrod rgblight_sethsv (43, 218, 218);
  57. #define rgblight_set_gold rgblight_sethsv (51, 255, 255);
  58. #define rgblight_set_yellow rgblight_sethsv (60, 255, 255);
  59. #define rgblight_set_chartreuse rgblight_sethsv (90, 255, 255);
  60. #define rgblight_set_green rgblight_sethsv (120, 255, 255);
  61. #define rgblight_set_springgreen rgblight_sethsv (150, 255, 255);
  62. #define rgblight_set_turquoise rgblight_sethsv (174, 90, 112);
  63. #define rgblight_set_teal rgblight_sethsv (180, 255, 128);
  64. #define rgblight_set_cyan rgblight_sethsv (180, 255, 255);
  65. #define rgblight_set_azure rgblight_sethsv (186, 102, 255);
  66. #define rgblight_set_blue rgblight_sethsv (240, 255, 255);
  67. #define rgblight_set_purple rgblight_sethsv (270, 255, 255);
  68. #define rgblight_set_magenta rgblight_sethsv (300, 255, 255);
  69. #define rgblight_set_pink rgblight_sethsv (330, 128, 255);
  70. //#define rgblight_set_ rgblight_sethsv (0, 255, 255);
  71. #endif // DRASHNA_SETRGB
  72. extern bool is_overwatch;
  73. extern bool rgb_layer_change;
  74. enum userspace_custom_keycodes {
  75. EPRM = SAFE_RANGE, // can always be here
  76. VRSN,
  77. KC_QWERTY,
  78. KC_COLEMAK,
  79. KC_DVORAK,
  80. KC_WORKMAN,
  81. LOWER,
  82. RAISE,
  83. ADJUST,
  84. KC_DIABLO_CLEAR,
  85. KC_OVERWATCH,
  86. KC_SALT,
  87. KC_MORESALT,
  88. KC_SALTHARD,
  89. KC_GOODGAME,
  90. KC_SYMM,
  91. KC_JUSTGAME,
  92. KC_GLHF,
  93. KC_TORB,
  94. KC_AIM,
  95. KC_C9,
  96. KC_GGEZ,
  97. KC_MAKE,
  98. KC_RESET,
  99. KC_RGB_T,
  100. KC_SECRET_1,
  101. KC_SECRET_2,
  102. KC_SECRET_3,
  103. KC_SECRET_4,
  104. KC_SECRET_5,
  105. KC_FXCL,
  106. NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
  107. };
  108. #ifdef TAP_DANCE_ENABLE
  109. enum {
  110. TD_D3_1 = 0,
  111. TD_D3_2,
  112. TD_D3_3,
  113. TD_D3_4
  114. };
  115. #endif // TAP_DANCE_ENABLE
  116. // Custom Keycodes for Diablo 3 layer
  117. // But since TD() doesn't work when tapdance is disabled
  118. // We use custom codes here, so we can substituet the right stuff
  119. #ifdef TAP_DANCE_ENABLE
  120. #define KC_D3_1 TD(TD_D3_1)
  121. #define KC_D3_2 TD(TD_D3_2)
  122. #define KC_D3_3 TD(TD_D3_3)
  123. #define KC_D3_4 TD(TD_D3_4)
  124. #else // TAP_DANCE_ENABLE
  125. #define KC_D3_1 KC_1
  126. #define KC_D3_2 KC_2
  127. #define KC_D3_3 KC_3
  128. #define KC_D3_4 KC_4
  129. #endif // TAP_DANCE_ENABLE
  130. // OSM keycodes, to keep things clean and easy to change
  131. #define KC_MLSF OSM(MOD_LSFT)
  132. #define KC_MRSF OSM(MOD_RSFT)
  133. #define ONESHOT_TIMEOUT 3000
  134. #define QMK_KEYS_PER_SCAN 8
  135. #ifdef RGBLIGHT_ENABLE
  136. #define RGBLIGHT_SLEEP
  137. #endif // RGBLIGHT_ENABLE
  138. // this makes it possible to do rolling combos (zx) with keys that
  139. // convert to other keys on hold (z becomes ctrl when you hold it,
  140. // and when this option isn't enabled, z rapidly followed by x
  141. // actually sends Ctrl-x. That's bad.)
  142. #define IGNORE_MOD_TAP_INTERRUPT
  143. // Disable action_get_macro and fn_actions, since we don't use these
  144. // and it saves on space in the firmware.
  145. #define NO_ACTION_MACRO
  146. #define NO_ACTION_FUNCTION
  147. // If we're still using the official Faux Clicky feature, substituet codes
  148. // so that we don't have any unused/blank keys.
  149. #ifdef FAUXCLICKY_ENABLE
  150. #define AUD_ON FC_ON
  151. #define AUD_OFF FC_OFF
  152. #else // FAUXCLICKY_ENABLE
  153. #define AUD_ON AU_ON
  154. #define AUD_OFF AU_OFF
  155. #endif // FAUXCLICKY_ENABLE
  156. // Since our quirky block definitions are basically a list of comma separated
  157. // arguments, we need a wrapper in order for these definitions to be
  158. // expanded before being used as arguments to the LAYOUT_xxx macro.
  159. #define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)
  160. #define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__)
  161. #define KEYMAP_wrapper(...) KEYMAP(__VA_ARGS__)
  162. // Blocks for each of the four major keyboard layouts
  163. // Organized so we can quickly adapt and modify all of them
  164. // at once, rather than for each keyboard, one at a time.
  165. // And this allows wor much cleaner blocks in the keymaps.
  166. // For instance Tap/Hold for Control on all of the layouts
  167. // NOTE: These are all the same length. If you do a search/replace
  168. // then you need to add/remove underscores to keep the
  169. // lengths consistent.
  170. #define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
  171. #define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
  172. #define _________________QWERTY_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B
  173. #define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
  174. #define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN
  175. #define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
  176. #define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G
  177. #define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D
  178. #define _________________COLEMAK_L3________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B
  179. #define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
  180. #define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O
  181. #define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
  182. #define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y
  183. #define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I
  184. #define _________________DVORAK_L3_________________ CTL_T(KC_SCLN),KC_Q, KC_J, KC_K, KC_X
  185. #define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L
  186. #define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S
  187. #define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z)
  188. #define _________________WORKMAN_L1________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y
  189. #define _________________WORKMAN_L2________________ KC_A, KC_O, KC_E, KC_U, KC_I
  190. #define _________________WORKMAN_L3________________ CTL_T(KC_SCLN),KC_Q, KC_J, KC_K, KC_X
  191. #define _________________WORKMAN_R1________________ KC_F, KC_G, KC_C, KC_R, KC_L
  192. #define _________________WORKMAN_R2________________ KC_D, KC_H, KC_T, KC_N, KC_S
  193. #define _________________WORKMAN_R3________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z)
  194. // Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN),
  195. // this allows us to quickly modify the bottom row for all of the layouts
  196. // so we don't have to alter it 4 times and hope that we haven't missed
  197. // anything
  198. #define ___________ERGODOX_BOTTOM_LEFT_____________ KC_QUOT, KC_MEH, KC_LBRC, KC_RBRC
  199. #define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
  200. #endif