X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Faction_code.h;h=d836b7a8a39f29e75ae5febcb3cdd39aac3bb5b0;hb=29e9caa82bdfe898dd7fca82fcecf0cae2374859;hp=b15aaa0eb34afb952c4aa5fa517b9e18a48d0b8b;hpb=8655d4f4948b2deef7844503c8d690f23ac1a062;p=qmk_firmware.git diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index b15aaa0eb..d836b7a8a 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h @@ -17,10 +17,9 @@ along with this program. If not, see . #ifndef ACTION_CODE_H #define ACTION_CODE_H -/* Action codes - * ============ - * 16bit code: action_kind(4bit) + action_parameter(12bit) +/** \brief Action codes * + * 16bit code: action_kind(4bit) + action_parameter(12bit) * * Key Actions(00xx) * ----------------- @@ -38,7 +37,6 @@ along with this program. If not, see . * 001r|mods|0000 00xx (reserved) * 001r|mods| keycode Modifiers with Tap Key(Dual role) * - * * Other Keys(01xx) * ---------------- * ACT_USAGE(0100): TODO: Not needed? @@ -47,17 +45,14 @@ along with this program. If not, see . * 0100|10| usage(10) (reserved) * 0100|11| usage(10) (reserved) * - * * ACT_MOUSEKEY(0101): TODO: Merge these two actions to conserve space? * 0101|xxxx| keycode Mouse key * * ACT_SWAP_HANDS(0110): * 0110|xxxx| keycode Swap hands (keycode on tap, or options) * - * * 0111|xxxx xxxx xxxx (reserved) * - * * Layer Actions(10xx) * ------------------- * ACT_LAYER(1000): @@ -84,7 +79,6 @@ along with this program. If not, see . * 101E|LLLL|1111 xxxx Reserved (0xF5-FF) * ELLLL: layer 0-31(E: extra bit for layer 16-31) * - * * Extensions(11xx) * ---------------- * ACT_MACRO(1100): @@ -126,7 +120,7 @@ enum action_kind_id { }; -/* Action Code Struct +/** \brief Action Code Struct * * NOTE: * In avr-gcc bit field seems to be assigned from LSB(bit0) to MSB(bit15). @@ -186,7 +180,7 @@ typedef union { } func; struct action_swap { uint8_t code :8; - uint8_t opt :4; + uint8_t opt :4; uint8_t kind :4; } swap; } action_t; @@ -198,10 +192,9 @@ typedef union { #define ACTION(kind, param) ((kind)<<12 | (param)) -/* - * Key Actions - */ -/* Mod bits: 43210 +/** \brief Key Actions + * + * Mod bits: 43210 * bit 0 ||||+- Control * bit 1 |||+-- Shift * bit 2 ||+--- Alt @@ -230,8 +223,7 @@ enum mods_codes { #define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE) -/* - * Other Keys +/** \brief Other Keys */ enum usage_pages { PAGE_SYSTEM, @@ -243,21 +235,26 @@ enum usage_pages { -/* - * Layer Actions +/** \brief Layer Actions */ enum layer_param_on { ON_PRESS = 1, ON_RELEASE = 2, ON_BOTH = 3, }; + +/** \brief Layer Actions + */ enum layer_param_bit_op { OP_BIT_AND = 0, OP_BIT_OR = 1, OP_BIT_XOR = 2, OP_BIT_SET = 3, }; -enum layer_pram_tap_op { + +/** \brief Layer Actions + */ +enum layer_param_tap_op { OP_TAP_TOGGLE = 0xF0, OP_ON_OFF, OP_OFF_ON, @@ -296,15 +293,15 @@ enum layer_pram_tap_op { #define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0) -/* - * Extensions +/** \brief Extensions */ enum backlight_opt { BACKLIGHT_INCREASE = 0, BACKLIGHT_DECREASE = 1, BACKLIGHT_TOGGLE = 2, BACKLIGHT_STEP = 3, - BACKLIGHT_LEVEL = 4, + BACKLIGHT_ON = 4, + BACKLIGHT_OFF = 5, }; /* Macro */ @@ -316,7 +313,8 @@ enum backlight_opt { #define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE << 8) #define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE << 8) #define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8) -#define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | (level)) +#define ACTION_BACKLIGHT_ON() ACTION(ACT_BACKLIGHT, BACKLIGHT_ON << 8) +#define ACTION_BACKLIGHT_OFF() ACTION(ACT_BACKLIGHT, BACKLIGHT_OFF << 8) /* Command */ #define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (id)) /* Function */ @@ -327,7 +325,7 @@ enum function_opts { #define ACTION_FUNCTION_TAP(id) ACTION(ACT_FUNCTION, FUNC_TAP<<8 | (id)) #define ACTION_FUNCTION_OPT(id, opt) ACTION(ACT_FUNCTION, (opt)<<8 | (id)) /* OneHand Support */ -enum swap_hands_pram_tap_op { +enum swap_hands_param_tap_op { OP_SH_TOGGLE = 0xF0, OP_SH_TAP_TOGGLE, OP_SH_ON_OFF,