drashna.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
  47. bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
  48. void matrix_init_keymap(void);
  49. void shutdown_keymap(void);
  50. void suspend_power_down_keymap(void);
  51. void suspend_wakeup_init_keymap(void);
  52. void matrix_scan_keymap(void);
  53. layer_state_t layer_state_set_keymap(layer_state_t state);
  54. layer_state_t default_layer_state_set_keymap(layer_state_t state);
  55. void led_set_keymap(uint8_t usb_led);
  56. void eeconfig_init_keymap(void);
  57. bool hasAllBitsInMask(uint8_t value, uint8_t mask);
  58. typedef union {
  59. uint32_t raw;
  60. struct {
  61. bool rgb_layer_change :1;
  62. bool is_overwatch :1;
  63. bool nuke_switch :1;
  64. uint8_t unicode_mod :4;
  65. bool swapped_numbers :1;
  66. bool rgb_matrix_idle_anim :1;
  67. };
  68. } userspace_config_t;
  69. extern userspace_config_t userspace_config;
  70. /*
  71. Custom Keycodes for Diablo 3 layer
  72. But since TD() doesn't work when tap dance is disabled
  73. We use custom codes here, so we can substitute the right stuff
  74. */
  75. #ifdef TAP_DANCE_ENABLE
  76. # define KC_D3_1 TD(TD_D3_1)
  77. # define KC_D3_2 TD(TD_D3_2)
  78. # define KC_D3_3 TD(TD_D3_3)
  79. # define KC_D3_4 TD(TD_D3_4)
  80. #else // TAP_DANCE_ENABLE
  81. # define KC_D3_1 KC_1
  82. # define KC_D3_2 KC_2
  83. # define KC_D3_3 KC_3
  84. # define KC_D3_4 KC_4
  85. #endif // TAP_DANCE_ENABLE