drashna.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include QMK_KEYBOARD_H
  5. #include "eeprom.h"
  6. #include "keyrecords/wrappers.h"
  7. #include "keyrecords/process_records.h"
  8. #include "callbacks.h"
  9. #ifdef TAP_DANCE_ENABLE
  10. # include "keyrecords/tap_dances.h"
  11. #endif // TAP_DANCE_ENABLE
  12. #if defined(RGBLIGHT_ENABLE)
  13. # include "rgb/rgb_stuff.h"
  14. #endif
  15. #if defined(RGB_MATRIX_ENABLE)
  16. # include "rgb/rgb_matrix_stuff.h"
  17. #endif
  18. #if defined(OLED_ENABLE)
  19. # include "oled/oled_stuff.h"
  20. #endif
  21. #ifdef SPLIT_KEYBOARD
  22. # include "split/transport_sync.h"
  23. #endif
  24. #ifdef POINTING_DEVICE_ENABLE
  25. # include "pointing/pointing.h"
  26. #endif
  27. #ifdef OS_DETECTION_ENABLE
  28. # include "os_detection.h"
  29. #endif
  30. /* Define layer names */
  31. enum userspace_layers {
  32. _QWERTY = 0,
  33. _NUMLOCK = 0,
  34. FIRST_DEFAULT_LAYER = 0,
  35. _COLEMAK_DH,
  36. _COLEMAK,
  37. _DVORAK,
  38. LAST_DEFAULT_LAYER = _DVORAK,
  39. _GAMEPAD,
  40. _DIABLO,
  41. _DIABLOII,
  42. _MOUSE,
  43. _MEDIA,
  44. _LOWER,
  45. _RAISE,
  46. _ADJUST,
  47. };
  48. #define _MACROS _MOUSE
  49. #define _DEFAULT_LAYER_1 FIRST_DEFAULT_LAYER
  50. #define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 1)
  51. #define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 2)
  52. #define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 3)
  53. #if LAST_DEFAULT_LAYER > (FIRST_DEFAULT_LAYER + 3)
  54. # define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 4)
  55. # define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 5)
  56. # define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 6)
  57. # define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 7)
  58. # if LAST_DEFAULT_LAYER > (FIRST_DEFAULT_LAYER + 7)
  59. # define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 8)
  60. # define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 9)
  61. # define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 10)
  62. # define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 11)
  63. # endif
  64. #endif
  65. #define DEFAULT_LAYER_1_HSV HSV_CYAN
  66. #define DEFAULT_LAYER_2_HSV HSV_CHARTREUSE
  67. #define DEFAULT_LAYER_3_HSV HSV_MAGENTA
  68. #define DEFAULT_LAYER_4_HSV HSV_GOLDENROD
  69. #define DEFAULT_LAYER_1_RGB RGB_CYAN
  70. #define DEFAULT_LAYER_2_RGB RGB_CHARTREUSE
  71. #define DEFAULT_LAYER_3_RGB RGB_MAGENTA
  72. #define DEFAULT_LAYER_4_RGB RGB_GOLDENROD
  73. bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
  74. bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
  75. bool hasAllBitsInMask(uint8_t value, uint8_t mask);
  76. void tap_code16_nomods(uint16_t kc);
  77. void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t default_state);
  78. // clang-format off
  79. typedef union {
  80. uint32_t raw;
  81. struct {
  82. bool rgb_layer_change :1;
  83. bool is_overwatch :1;
  84. bool nuke_switch :1;
  85. bool swapped_numbers :1;
  86. bool rgb_matrix_idle_anim :1;
  87. bool autocorrection :1;
  88. };
  89. } userspace_config_t;
  90. // clang-format on
  91. extern userspace_config_t userspace_config;