drashna.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 QMK_KEYBOARD_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)
  24. # include "rgb_stuff.h"
  25. #endif
  26. #if defined(RGB_MATRIX_ENABLE)
  27. # include "rgb_matrix_stuff.h"
  28. #endif
  29. #if defined(OLED_DRIVER_ENABLE)
  30. # include "oled_stuff.h"
  31. #endif
  32. /* Define layer names */
  33. enum userspace_layers {
  34. _QWERTY = 0,
  35. _NUMLOCK = 0,
  36. _COLEMAK,
  37. _DVORAK,
  38. _WORKMAN,
  39. _NORMAN,
  40. _MALTRON,
  41. _EUCALYN,
  42. _CARPLAX,
  43. _MODS, /* layer 8 */
  44. _GAMEPAD,
  45. _DIABLO,
  46. _MACROS,
  47. _MEDIA,
  48. _LOWER,
  49. _RAISE,
  50. _ADJUST,
  51. };
  52. bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
  53. bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
  54. void matrix_init_keymap(void);
  55. void shutdown_keymap(void);
  56. void suspend_power_down_keymap(void);
  57. void suspend_wakeup_init_keymap(void);
  58. void matrix_scan_keymap(void);
  59. layer_state_t layer_state_set_keymap(layer_state_t state);
  60. layer_state_t default_layer_state_set_keymap(layer_state_t state);
  61. void led_set_keymap(uint8_t usb_led);
  62. void eeconfig_init_keymap(void);
  63. bool hasAllBitsInMask(uint8_t value, uint8_t mask);
  64. // clang-format off
  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. bool swapped_numbers :1;
  72. bool rgb_matrix_idle_anim :1;
  73. };
  74. } userspace_config_t;
  75. // clang-format on
  76. extern userspace_config_t userspace_config;
  77. /*
  78. Custom Keycodes for Diablo 3 layer
  79. But since TD() doesn't work when tap dance is disabled
  80. We use custom codes here, so we can substitute the right stuff
  81. */
  82. #ifdef TAP_DANCE_ENABLE
  83. # define KC_D3_1 TD(TD_D3_1)
  84. # define KC_D3_2 TD(TD_D3_2)
  85. # define KC_D3_3 TD(TD_D3_3)
  86. # define KC_D3_4 TD(TD_D3_4)
  87. #else // TAP_DANCE_ENABLE
  88. # define KC_D3_1 KC_1
  89. # define KC_D3_2 KC_2
  90. # define KC_D3_3 KC_3
  91. # define KC_D3_4 KC_4
  92. #endif // TAP_DANCE_ENABLE