drashna.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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_DRIVER_ENABLE)
  31. # include "oled_stuff.h"
  32. #endif
  33. #if defined(PIMORONI_TRACKBALL_ENABLE)
  34. # include "pimoroni_trackball.h"
  35. #endif
  36. /* Define layer names */
  37. enum userspace_layers {
  38. _QWERTY = 0,
  39. _NUMLOCK = 0,
  40. _COLEMAK,
  41. _DVORAK,
  42. _WORKMAN,
  43. _NORMAN,
  44. _MALTRON,
  45. _EUCALYN,
  46. _CARPLAX,
  47. _GAMEPAD,
  48. _DIABLO,
  49. _MACROS,
  50. _MEDIA,
  51. _LOWER,
  52. _RAISE,
  53. _ADJUST,
  54. };
  55. #define _MOUSE _MACROS
  56. bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
  57. bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
  58. void matrix_init_keymap(void);
  59. void matrix_init_secret(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. void matrix_scan_secret(void);
  65. layer_state_t layer_state_set_keymap(layer_state_t state);
  66. layer_state_t default_layer_state_set_keymap(layer_state_t state);
  67. void led_set_keymap(uint8_t usb_led);
  68. void eeconfig_init_keymap(void);
  69. bool hasAllBitsInMask(uint8_t value, uint8_t mask);
  70. // clang-format off
  71. typedef union {
  72. uint32_t raw;
  73. struct {
  74. bool rgb_layer_change :1;
  75. bool is_overwatch :1;
  76. bool nuke_switch :1;
  77. bool swapped_numbers :1;
  78. bool rgb_matrix_idle_anim :1;
  79. };
  80. } userspace_config_t;
  81. // clang-format on
  82. extern userspace_config_t userspace_config;
  83. /*
  84. Custom Keycodes for Diablo 3 layer
  85. But since TD() doesn't work when tap dance is disabled
  86. We use custom codes here, so we can substitute the right stuff
  87. */
  88. #ifdef TAP_DANCE_ENABLE
  89. # define KC_D3_1 TD(TD_D3_1)
  90. # define KC_D3_2 TD(TD_D3_2)
  91. # define KC_D3_3 TD(TD_D3_3)
  92. # define KC_D3_4 TD(TD_D3_4)
  93. #else // TAP_DANCE_ENABLE
  94. # define KC_D3_1 KC_1
  95. # define KC_D3_2 KC_2
  96. # define KC_D3_3 KC_3
  97. # define KC_D3_4 KC_4
  98. #endif // TAP_DANCE_ENABLE
  99. #if defined(DRASHNA_CUSTOM_TRANSPORT) && defined(POINTING_DEVICE_ENABLE)
  100. void master_mouse_send(int8_t x, int8_t y);
  101. #endif