drashna.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #pragma once
  15. #include "quantum.h"
  16. #include "version.h"
  17. #include "eeprom.h"
  18. #include "wrappers.h"
  19. #include "process_records.h"
  20. #ifdef TAP_DANCE_ENABLE
  21. #include "tap_dances.h"
  22. #endif // TAP_DANCE_ENABLE
  23. #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
  24. #include "rgb_stuff.h"
  25. #endif
  26. /* Define layer names */
  27. enum userspace_layers {
  28. _QWERTY = 0,
  29. _NUMLOCK = 0,
  30. _COLEMAK,
  31. _DVORAK,
  32. _WORKMAN,
  33. _NORMAN,
  34. _MALTRON,
  35. _EUCALYN,
  36. _CARPLAX,
  37. _MODS, /* layer 8 */
  38. _GAMEPAD,
  39. _DIABLO,
  40. _MACROS,
  41. _MEDIA,
  42. _LOWER,
  43. _RAISE,
  44. _ADJUST,
  45. };
  46. /*
  47. define modifiers here, since MOD_* doesn't seem to work for these
  48. */
  49. #define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
  50. #define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
  51. #define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
  52. #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
  53. bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed);
  54. bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
  55. bool send_game_macro(const char *str, keyrecord_t *record, bool override);
  56. void matrix_init_keymap(void);
  57. void shutdown_keymap(void);
  58. void suspend_power_down_keymap(void);
  59. void suspend_wakeup_init_keymap(void);
  60. void matrix_scan_keymap(void);
  61. uint32_t layer_state_set_keymap (uint32_t state);
  62. uint32_t default_layer_state_set_keymap (uint32_t state);
  63. void led_set_keymap(uint8_t usb_led);
  64. void eeconfig_init_keymap(void);
  65. typedef union {
  66. uint32_t raw;
  67. struct {
  68. bool rgb_layer_change :1;
  69. bool is_overwatch :1;
  70. bool nuke_switch :1;
  71. uint8_t unicode_mod :4;
  72. bool swapped_numbers :1;
  73. };
  74. } userspace_config_t;
  75. extern userspace_config_t userspace_config;
  76. /*
  77. Custom Keycodes for Diablo 3 layer
  78. But since TD() doesn't work when tap dance is disabled
  79. We use custom codes here, so we can substitute the right stuff
  80. */
  81. #ifdef TAP_DANCE_ENABLE
  82. #define KC_D3_1 TD(TD_D3_1)
  83. #define KC_D3_2 TD(TD_D3_2)
  84. #define KC_D3_3 TD(TD_D3_3)
  85. #define KC_D3_4 TD(TD_D3_4)
  86. #else // TAP_DANCE_ENABLE
  87. #define KC_D3_1 KC_1
  88. #define KC_D3_2 KC_2
  89. #define KC_D3_3 KC_3
  90. #define KC_D3_4 KC_4
  91. #endif // TAP_DANCE_ENABLE