keymap.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* Copyright 2022 Daniel Weeks (@xanimos)
  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. #include QMK_KEYBOARD_H
  17. #include <print.h>
  18. #include <string.h>
  19. #define MILLISECONDS_IN_SECOND 1000
  20. // These are just to make it neater to use builtin HSV values in the keymap
  21. #define RED {HSV_RED}
  22. #define CORAL {HSV_CORAL}
  23. #define ORANGE {HSV_ORANGE}
  24. #define GOLDEN {HSV_GOLDENROD}
  25. #define GOLD {HSV_GOLD}
  26. #define YELLOW {HSV_YELLOW}
  27. #define CHART {HSV_CHARTREUSE}
  28. #define GREEN {HSV_GREEN}
  29. #define SPRING {HSV_SPRINGGREEN}
  30. #define TURQ {HSV_TURQUOISE}
  31. #define TEAL {HSV_TEAL}
  32. #define CYAN {HSV_CYAN}
  33. #define AZURE {HSV_AZURE}
  34. #define BLUE {HSV_BLUE}
  35. #define PURPLE {HSV_PURPLE}
  36. #define MAGENT {HSV_MAGENTA}
  37. #define PINK {HSV_PINK}
  38. //========================================================== CONFIGURABLE DEFAULTS ==========================================================
  39. #define RGB_DEFAULT_TIME_OUT 30
  40. #define RGB_FAST_MODE_TIME_OUT 3
  41. #define RGB_TIME_OUT_MAX 600
  42. #define RGB_TIME_OUT_MIN 10
  43. #define RGB_TIME_OUT_STEP 10
  44. extern rgb_config_t rgb_matrix_config;
  45. bool disable_layer_color;
  46. bool rgb_enabled_flag; // Current LED state flag. If false then LED is off.
  47. bool rgb_time_out_enable; // Idle LED toggle enable. If false then LED will not turn off after idle timeout.
  48. bool rgb_time_out_fast_mode_enabled; // Enable flag for RGB timeout fast mode
  49. bool rgb_time_out_user_value; // This holds the toggle value set by user with ROUT_TG. It's necessary as RGB_TOG changes timeout enable.
  50. uint16_t rgb_time_out_seconds; // Idle LED timeout value, in seconds not milliseconds
  51. uint16_t rgb_time_out_saved_seconds; // The saved user config for RGB timeout period
  52. led_flags_t rgb_time_out_saved_flag; // Store LED flag before timeout so it can be restored when LED is turned on again.
  53. enum layout_names {
  54. _KL=0, // Keys Layout: The main keyboard layout that has all the characters
  55. _FL, // Function Layout: The function key activated layout with default functions and some added ones
  56. _GL, // GIT Layout: GIT shortcuts and macros
  57. _NUMPAD, // Numpad Layout: Adds a numpad to the keys
  58. };
  59. // Tap Dance keycodes
  60. enum td_keycodes {
  61. TD_FN_SWITCH = 0
  62. };
  63. // Define a type containing as many tapdance states as you need
  64. typedef enum {
  65. TD_NONE,
  66. TD_UNKNOWN,
  67. TD_SINGLE_HOLD,
  68. TD_DOUBLE_HOLD
  69. } td_state_t;
  70. typedef struct {
  71. bool is_press_action;
  72. td_state_t state;
  73. } td_tap_t;
  74. // Declare your tapdance functions:
  75. // Function to determine the current tapdance state
  76. td_state_t cur_dance(tap_dance_state_t *state);
  77. // `finished` and `reset` functions for each tapdance keycode
  78. void fn_tap_finished(tap_dance_state_t *state, void *user_data);
  79. void fn_tap_reset(tap_dance_state_t *state, void *user_data);
  80. enum ctrl_keycodes {
  81. MD_BOOT = SAFE_RANGE, // Restart into bootloader after hold timeout
  82. ROUT_TG, // Timeout Toggle. Toggle idle LED time out on or off
  83. ROUT_VI, // Timeout Value Increase. Increase idle time out before LED disabled
  84. ROUT_VD, // Timeout Value Decrease. Decrease idle time out before LED disabled
  85. ROUT_FM, // RGB timeout fast mode toggle
  86. TOG_NPD, // Toggle Numpad On/Off
  87. COPY_ALL, // Copy all text using ctrl(a+c)
  88. };
  89. enum string_macro_keycodes {
  90. // The start of this enum should always be equal to end of ctrl_keycodes + 1
  91. G_INIT = COPY_ALL + 1, // git init
  92. G_CLONE, // git clone
  93. G_ADD, // git add
  94. G_DIFF, // git diff
  95. G_RESET, // git reset --soft
  96. G_BRANH, // git branch list
  97. G_CHECK, // git checkout
  98. G_REMTE, // git remote add
  99. G_FETCH, // git fetch
  100. G_PULL, // git pull
  101. G_PUPST, // git pull upstream
  102. G_PUSH, // git push
  103. G_PSORG, // git push -u origin
  104. G_PSFWL, // git push --force-with-lease
  105. G_COMM, // git commit
  106. G_COMSG, // git commit -m ": [TFS-]"
  107. G_STAT, // git status
  108. G_LOG, // git log
  109. };