command.h (3418B)
1 /* 2 Copyright 2011 Jun Wako <wakojun@gmail.com> 3 4 This program is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #pragma once 19 20 /* FIXME: Add doxygen comments for the behavioral defines in here. */ 21 22 /* TODO: Refactoring */ 23 typedef enum { ONESHOT, CONSOLE, MOUSEKEY } command_state_t; 24 extern command_state_t command_state; 25 26 /* This allows to extend commands. Return false when command is not processed. */ 27 bool command_extra(uint8_t code); 28 bool command_console_extra(uint8_t code); 29 30 #ifdef COMMAND_ENABLE 31 bool command_proc(uint8_t code); 32 #else 33 # define command_proc(code) false 34 #endif 35 36 #ifndef IS_COMMAND 37 # define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT) 38 #endif 39 40 #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS 41 # define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true 42 #endif 43 44 #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS 45 # define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true 46 #endif 47 48 #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM 49 # define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false 50 #endif 51 52 #ifndef MAGIC_KEY_HELP 53 # define MAGIC_KEY_HELP H 54 #endif 55 56 #ifndef MAGIC_KEY_HELP_ALT 57 # define MAGIC_KEY_HELP_ALT SLASH 58 #endif 59 60 #ifndef MAGIC_KEY_DEBUG 61 # define MAGIC_KEY_DEBUG D 62 #endif 63 64 #ifndef MAGIC_KEY_DEBUG_MATRIX 65 # define MAGIC_KEY_DEBUG_MATRIX X 66 #endif 67 68 #ifndef MAGIC_KEY_DEBUG_KBD 69 # define MAGIC_KEY_DEBUG_KBD K 70 #endif 71 72 #ifndef MAGIC_KEY_DEBUG_MOUSE 73 # define MAGIC_KEY_DEBUG_MOUSE M 74 #endif 75 76 #ifndef MAGIC_KEY_VERSION 77 # define MAGIC_KEY_VERSION V 78 #endif 79 80 #ifndef MAGIC_KEY_STATUS 81 # define MAGIC_KEY_STATUS S 82 #endif 83 84 #ifndef MAGIC_KEY_CONSOLE 85 # define MAGIC_KEY_CONSOLE C 86 #endif 87 88 #ifndef MAGIC_KEY_LAYER0 89 # define MAGIC_KEY_LAYER0 0 90 #endif 91 92 #ifndef MAGIC_KEY_LAYER0_ALT 93 # define MAGIC_KEY_LAYER0_ALT GRAVE 94 #endif 95 96 #ifndef MAGIC_KEY_LAYER1 97 # define MAGIC_KEY_LAYER1 1 98 #endif 99 100 #ifndef MAGIC_KEY_LAYER2 101 # define MAGIC_KEY_LAYER2 2 102 #endif 103 104 #ifndef MAGIC_KEY_LAYER3 105 # define MAGIC_KEY_LAYER3 3 106 #endif 107 108 #ifndef MAGIC_KEY_LAYER4 109 # define MAGIC_KEY_LAYER4 4 110 #endif 111 112 #ifndef MAGIC_KEY_LAYER5 113 # define MAGIC_KEY_LAYER5 5 114 #endif 115 116 #ifndef MAGIC_KEY_LAYER6 117 # define MAGIC_KEY_LAYER6 6 118 #endif 119 120 #ifndef MAGIC_KEY_LAYER7 121 # define MAGIC_KEY_LAYER7 7 122 #endif 123 124 #ifndef MAGIC_KEY_LAYER8 125 # define MAGIC_KEY_LAYER8 8 126 #endif 127 128 #ifndef MAGIC_KEY_LAYER9 129 # define MAGIC_KEY_LAYER9 9 130 #endif 131 132 #ifndef MAGIC_KEY_BOOTLOADER 133 # define MAGIC_KEY_BOOTLOADER B 134 #endif 135 136 #ifndef MAGIC_KEY_BOOTLOADER_ALT 137 # define MAGIC_KEY_BOOTLOADER_ALT ESC 138 #endif 139 140 #ifndef MAGIC_KEY_LOCK 141 # define MAGIC_KEY_LOCK CAPS 142 #endif 143 144 #ifndef MAGIC_KEY_EEPROM 145 # define MAGIC_KEY_EEPROM E 146 #endif 147 148 #ifndef MAGIC_KEY_EEPROM_CLEAR 149 # define MAGIC_KEY_EEPROM_CLEAR BACKSPACE 150 #endif 151 152 #ifndef MAGIC_KEY_NKRO 153 # define MAGIC_KEY_NKRO N 154 #endif 155 156 #ifndef MAGIC_KEY_SLEEP_LED 157 # define MAGIC_KEY_SLEEP_LED Z 158 159 #endif 160 161 #define XMAGIC_KC(key) KC_##key 162 #define MAGIC_KC(key) XMAGIC_KC(key)