Peter's keyboard firmware (QMK) https://qmk.fm/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

command.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. Copyright 2011 Jun Wako <wakojun@gmail.com>
  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. /* FIXME: Add doxygen comments for the behavioral defines in here. */
  16. /* TODO: Refactoring */
  17. typedef enum { ONESHOT, CONSOLE, MOUSEKEY } command_state_t;
  18. extern command_state_t command_state;
  19. /* This allows to extend commands. Return false when command is not processed. */
  20. bool command_extra(uint8_t code);
  21. bool command_console_extra(uint8_t code);
  22. #ifdef COMMAND_ENABLE
  23. uint8_t numkey2num(uint8_t code);
  24. bool command_proc(uint8_t code);
  25. #else
  26. #define command_proc(code) false
  27. #endif
  28. #ifndef IS_COMMAND
  29. #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
  30. #endif
  31. #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
  32. #define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
  33. #endif
  34. #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
  35. #define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
  36. #endif
  37. #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
  38. #define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
  39. #endif
  40. #ifndef MAGIC_KEY_HELP
  41. #define MAGIC_KEY_HELP H
  42. #endif
  43. #ifndef MAGIC_KEY_HELP_ALT
  44. #define MAGIC_KEY_HELP_ALT SLASH
  45. #endif
  46. #ifndef MAGIC_KEY_DEBUG
  47. #define MAGIC_KEY_DEBUG D
  48. #endif
  49. #ifndef MAGIC_KEY_DEBUG_MATRIX
  50. #define MAGIC_KEY_DEBUG_MATRIX X
  51. #endif
  52. #ifndef MAGIC_KEY_DEBUG_KBD
  53. #define MAGIC_KEY_DEBUG_KBD K
  54. #endif
  55. #ifndef MAGIC_KEY_DEBUG_MOUSE
  56. #define MAGIC_KEY_DEBUG_MOUSE M
  57. #endif
  58. #ifndef MAGIC_KEY_VERSION
  59. #define MAGIC_KEY_VERSION V
  60. #endif
  61. #ifndef MAGIC_KEY_STATUS
  62. #define MAGIC_KEY_STATUS S
  63. #endif
  64. #ifndef MAGIC_KEY_CONSOLE
  65. #define MAGIC_KEY_CONSOLE C
  66. #endif
  67. #ifndef MAGIC_KEY_LAYER0
  68. #define MAGIC_KEY_LAYER0 0
  69. #endif
  70. #ifndef MAGIC_KEY_LAYER0_ALT
  71. #define MAGIC_KEY_LAYER0_ALT GRAVE
  72. #endif
  73. #ifndef MAGIC_KEY_LAYER1
  74. #define MAGIC_KEY_LAYER1 1
  75. #endif
  76. #ifndef MAGIC_KEY_LAYER2
  77. #define MAGIC_KEY_LAYER2 2
  78. #endif
  79. #ifndef MAGIC_KEY_LAYER3
  80. #define MAGIC_KEY_LAYER3 3
  81. #endif
  82. #ifndef MAGIC_KEY_LAYER4
  83. #define MAGIC_KEY_LAYER4 4
  84. #endif
  85. #ifndef MAGIC_KEY_LAYER5
  86. #define MAGIC_KEY_LAYER5 5
  87. #endif
  88. #ifndef MAGIC_KEY_LAYER6
  89. #define MAGIC_KEY_LAYER6 6
  90. #endif
  91. #ifndef MAGIC_KEY_LAYER7
  92. #define MAGIC_KEY_LAYER7 7
  93. #endif
  94. #ifndef MAGIC_KEY_LAYER8
  95. #define MAGIC_KEY_LAYER8 8
  96. #endif
  97. #ifndef MAGIC_KEY_LAYER9
  98. #define MAGIC_KEY_LAYER9 9
  99. #endif
  100. #ifndef MAGIC_KEY_BOOTLOADER
  101. #define MAGIC_KEY_BOOTLOADER B
  102. #endif
  103. #ifndef MAGIC_KEY_BOOTLOADER_ALT
  104. #define MAGIC_KEY_BOOTLOADER_ALT ESC
  105. #endif
  106. #ifndef MAGIC_KEY_LOCK
  107. #define MAGIC_KEY_LOCK CAPS
  108. #endif
  109. #ifndef MAGIC_KEY_EEPROM
  110. #define MAGIC_KEY_EEPROM E
  111. #endif
  112. #ifndef MAGIC_KEY_EEPROM_CLEAR
  113. #define MAGIC_KEY_EEPROM_CLEAR BSPACE
  114. #endif
  115. #ifndef MAGIC_KEY_NKRO
  116. #define MAGIC_KEY_NKRO N
  117. #endif
  118. #ifndef MAGIC_KEY_SLEEP_LED
  119. #define MAGIC_KEY_SLEEP_LED Z
  120. #endif
  121. #define XMAGIC_KC(key) KC_ ## key
  122. #define MAGIC_KC(key) XMAGIC_KC(key)