diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2016-08-23 09:38:05 +0300 |
|---|---|---|
| committer | Fred Sundvik <fsundvik@gmail.com> | 2016-08-23 09:38:05 +0300 |
| commit | 8f2af3c6bcd0e300483cb72bfe2816701a0e528d (patch) | |
| tree | cfa6d0a5d8ed7265d4367ddcc1d112923fb2d0ef /tmk_core/common/action_code.h | |
| parent | 8f16403179dde51af1826fbc9b65ce0e29fd33ad (diff) | |
| parent | fb4452c2f5a80720fd56306ea4fa7c61a5e8040d (diff) | |
| download | qmk_firmware-8f2af3c6bcd0e300483cb72bfe2816701a0e528d.tar.gz qmk_firmware-8f2af3c6bcd0e300483cb72bfe2816701a0e528d.zip | |
Merge branch 'master' into makefile_overhaul
Diffstat (limited to 'tmk_core/common/action_code.h')
| -rw-r--r-- | tmk_core/common/action_code.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index ca729aaec..33da35f35 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h | |||
| @@ -108,6 +108,8 @@ enum action_kind_id { | |||
| 108 | /* Other Keys */ | 108 | /* Other Keys */ |
| 109 | ACT_USAGE = 0b0100, | 109 | ACT_USAGE = 0b0100, |
| 110 | ACT_MOUSEKEY = 0b0101, | 110 | ACT_MOUSEKEY = 0b0101, |
| 111 | /* One-hand Support */ | ||
| 112 | ACT_SWAP_HANDS = 0b0110, | ||
| 111 | /* Layer Actions */ | 113 | /* Layer Actions */ |
| 112 | ACT_LAYER = 0b1000, | 114 | ACT_LAYER = 0b1000, |
| 113 | ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */ | 115 | ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */ |
| @@ -178,6 +180,11 @@ typedef union { | |||
| 178 | uint8_t opt :4; | 180 | uint8_t opt :4; |
| 179 | uint8_t kind :4; | 181 | uint8_t kind :4; |
| 180 | } func; | 182 | } func; |
| 183 | struct action_swap { | ||
| 184 | uint8_t code :8; | ||
| 185 | uint8_t opt :4; | ||
| 186 | uint8_t kind :4; | ||
| 187 | } swap; | ||
| 181 | } action_t; | 188 | } action_t; |
| 182 | 189 | ||
| 183 | 190 | ||
| @@ -295,6 +302,7 @@ enum backlight_opt { | |||
| 295 | BACKLIGHT_STEP = 3, | 302 | BACKLIGHT_STEP = 3, |
| 296 | BACKLIGHT_LEVEL = 4, | 303 | BACKLIGHT_LEVEL = 4, |
| 297 | }; | 304 | }; |
| 305 | |||
| 298 | /* Macro */ | 306 | /* Macro */ |
| 299 | #define ACTION_MACRO(id) ACTION(ACT_MACRO, (id)) | 307 | #define ACTION_MACRO(id) ACTION(ACT_MACRO, (id)) |
| 300 | #define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP<<8 | (id)) | 308 | #define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP<<8 | (id)) |
| @@ -306,7 +314,7 @@ enum backlight_opt { | |||
| 306 | #define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8) | 314 | #define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8) |
| 307 | #define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | (level)) | 315 | #define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | (level)) |
| 308 | /* Command */ | 316 | /* Command */ |
| 309 | #define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (addr)) | 317 | #define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (id)) |
| 310 | /* Function */ | 318 | /* Function */ |
| 311 | enum function_opts { | 319 | enum function_opts { |
| 312 | FUNC_TAP = 0x8, /* indciates function is tappable */ | 320 | FUNC_TAP = 0x8, /* indciates function is tappable */ |
| @@ -314,5 +322,23 @@ enum function_opts { | |||
| 314 | #define ACTION_FUNCTION(id) ACTION(ACT_FUNCTION, (id)) | 322 | #define ACTION_FUNCTION(id) ACTION(ACT_FUNCTION, (id)) |
| 315 | #define ACTION_FUNCTION_TAP(id) ACTION(ACT_FUNCTION, FUNC_TAP<<8 | (id)) | 323 | #define ACTION_FUNCTION_TAP(id) ACTION(ACT_FUNCTION, FUNC_TAP<<8 | (id)) |
| 316 | #define ACTION_FUNCTION_OPT(id, opt) ACTION(ACT_FUNCTION, (opt)<<8 | (id)) | 324 | #define ACTION_FUNCTION_OPT(id, opt) ACTION(ACT_FUNCTION, (opt)<<8 | (id)) |
| 325 | /* OneHand Support */ | ||
| 326 | enum swap_hands_pram_tap_op { | ||
| 327 | OP_SH_TOGGLE = 0xF0, | ||
| 328 | OP_SH_TAP_TOGGLE, | ||
| 329 | OP_SH_ON_OFF, | ||
| 330 | OP_SH_OFF_ON, | ||
| 331 | OP_SH_OFF, | ||
| 332 | OP_SH_ON, | ||
| 333 | }; | ||
| 334 | |||
| 335 | #define ACTION_SWAP_HANDS() ACTION_SWAP_HANDS_ON_OFF() | ||
| 336 | #define ACTION_SWAP_HANDS_TOGGLE() ACTION(ACT_SWAP_HANDS, OP_SH_TOGGLE) | ||
| 337 | #define ACTION_SWAP_HANDS_TAP_TOGGLE() ACTION(ACT_SWAP_HANDS, OP_SH_TAP_TOGGLE) | ||
| 338 | #define ACTION_SWAP_HANDS_TAP_KEY(key) ACTION(ACT_SWAP_HANDS, key) | ||
| 339 | #define ACTION_SWAP_HANDS_ON_OFF() ACTION(ACT_SWAP_HANDS, OP_SH_ON_OFF) | ||
| 340 | #define ACTION_SWAP_HANDS_OFF_ON() ACTION(ACT_SWAP_HANDS, OP_SH_OFF_ON) | ||
| 341 | #define ACTION_SWAP_HANDS_ON() ACTION(ACT_SWAP_HANDS, OP_SH_ON) | ||
| 342 | #define ACTION_SWAP_HANDS_OFF() ACTION(ACT_SWAP_HANDS, OP_SH_OFF) | ||
| 317 | 343 | ||
| 318 | #endif /* ACTION_CODE_H */ | 344 | #endif /* ACTION_CODE_H */ |
