drashna.h 3.0 KB

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