drashna.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. *
  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. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include QMK_KEYBOARD_H
  18. #include "eeprom.h"
  19. #include "wrappers.h"
  20. #include "process_records.h"
  21. #ifdef TAP_DANCE_ENABLE
  22. # include "tap_dances.h"
  23. #endif // TAP_DANCE_ENABLE
  24. #if defined(RGBLIGHT_ENABLE)
  25. # include "rgb_stuff.h"
  26. #endif
  27. #if defined(RGB_MATRIX_ENABLE)
  28. # include "rgb_matrix_stuff.h"
  29. #endif
  30. #if defined(OLED_ENABLE)
  31. # include "oled_stuff.h"
  32. #endif
  33. #if defined(PIMORONI_TRACKBALL_ENABLE)
  34. # include "drivers/sensors/pimoroni_trackball.h"
  35. #endif
  36. #ifdef SPLIT_KEYBOARD
  37. # include "transport_sync.h"
  38. #endif
  39. /* Define layer names */
  40. enum userspace_layers {
  41. _QWERTY = 0,
  42. _NUMLOCK = 0,
  43. FIRST_DEFAULT_LAYER = 0,
  44. _COLEMAK_DH,
  45. _COLEMAK,
  46. _DVORAK,
  47. LAST_DEFAULT_LAYER = _DVORAK,
  48. _GAMEPAD,
  49. _DIABLO,
  50. _MOUSE,
  51. _MEDIA,
  52. _LOWER,
  53. _RAISE,
  54. _ADJUST,
  55. };
  56. #define _MACROS _MOUSE
  57. #define _DEFAULT_LAYER_1 FIRST_DEFAULT_LAYER
  58. #define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 1)
  59. #define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 2)
  60. #define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 3)
  61. #if LAST_DEFAULT_LAYER > (FIRST_DEFAULT_LAYER + 3)
  62. # define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 4)
  63. # define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 5)
  64. # define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 6)
  65. # define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 7)
  66. # if LAST_DEFAULT_LAYER > (FIRST_DEFAULT_LAYER + 7)
  67. # define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 8)
  68. # define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 9)
  69. # define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 10)
  70. # define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 11)
  71. # endif
  72. #endif
  73. #define DEFAULT_LAYER_1_HSV HSV_CYAN
  74. #define DEFAULT_LAYER_2_HSV HSV_CHARTREUSE
  75. #define DEFAULT_LAYER_3_HSV HSV_MAGENTA
  76. #define DEFAULT_LAYER_4_HSV HSV_GOLDENROD
  77. #define DEFAULT_LAYER_1_RGB RGB_CYAN
  78. #define DEFAULT_LAYER_2_RGB RGB_CHARTREUSE
  79. #define DEFAULT_LAYER_3_RGB RGB_MAGENTA
  80. #define DEFAULT_LAYER_4_RGB RGB_GOLDENROD
  81. bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
  82. bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
  83. void matrix_init_keymap(void);
  84. void matrix_init_secret(void);
  85. void shutdown_keymap(void);
  86. void suspend_power_down_keymap(void);
  87. void suspend_wakeup_init_keymap(void);
  88. void matrix_scan_keymap(void);
  89. void matrix_scan_secret(void);
  90. layer_state_t layer_state_set_keymap(layer_state_t state);
  91. layer_state_t default_layer_state_set_keymap(layer_state_t state);
  92. void led_set_keymap(uint8_t usb_led);
  93. void eeconfig_init_keymap(void);
  94. bool hasAllBitsInMask(uint8_t value, uint8_t mask);
  95. #ifdef SPLIT_KEYBOARD
  96. void matrix_slave_scan_keymap(void);
  97. #endif
  98. // clang-format off
  99. typedef union {
  100. uint32_t raw;
  101. struct {
  102. bool rgb_layer_change :1;
  103. bool is_overwatch :1;
  104. bool nuke_switch :1;
  105. bool swapped_numbers :1;
  106. bool rgb_matrix_idle_anim :1;
  107. };
  108. } userspace_config_t;
  109. // clang-format on
  110. extern userspace_config_t userspace_config;
  111. /*
  112. Custom Keycodes for Diablo 3 layer
  113. But since TD() doesn't work when tap dance is disabled
  114. We use custom codes here, so we can substitute the right stuff
  115. */
  116. #ifdef TAP_DANCE_ENABLE
  117. # define KC_D3_1 TD(TD_D3_1)
  118. # define KC_D3_2 TD(TD_D3_2)
  119. # define KC_D3_3 TD(TD_D3_3)
  120. # define KC_D3_4 TD(TD_D3_4)
  121. #else // TAP_DANCE_ENABLE
  122. # define KC_D3_1 KC_1
  123. # define KC_D3_2 KC_2
  124. # define KC_D3_3 KC_3
  125. # define KC_D3_4 KC_4
  126. #endif // TAP_DANCE_ENABLE