diff options
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/common/action_util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index a57c8bf66..2b3c00cba 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c | |||
@@ -27,6 +27,10 @@ extern keymap_config_t keymap_config; | |||
27 | static uint8_t real_mods = 0; | 27 | static uint8_t real_mods = 0; |
28 | static uint8_t weak_mods = 0; | 28 | static uint8_t weak_mods = 0; |
29 | static uint8_t macro_mods = 0; | 29 | static uint8_t macro_mods = 0; |
30 | #ifdef KEY_OVERRIDE_ENABLE | ||
31 | static uint8_t weak_override_mods = 0; | ||
32 | static uint8_t suppressed_mods = 0; | ||
33 | #endif | ||
30 | 34 | ||
31 | #ifdef USB_6KRO_ENABLE | 35 | #ifdef USB_6KRO_ENABLE |
32 | # define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) | 36 | # define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) |
@@ -229,6 +233,7 @@ void send_keyboard_report(void) { | |||
229 | keyboard_report->mods = real_mods; | 233 | keyboard_report->mods = real_mods; |
230 | keyboard_report->mods |= weak_mods; | 234 | keyboard_report->mods |= weak_mods; |
231 | keyboard_report->mods |= macro_mods; | 235 | keyboard_report->mods |= macro_mods; |
236 | |||
232 | #ifndef NO_ACTION_ONESHOT | 237 | #ifndef NO_ACTION_ONESHOT |
233 | if (oneshot_mods) { | 238 | if (oneshot_mods) { |
234 | # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) | 239 | # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) |
@@ -244,6 +249,13 @@ void send_keyboard_report(void) { | |||
244 | } | 249 | } |
245 | 250 | ||
246 | #endif | 251 | #endif |
252 | |||
253 | #ifdef KEY_OVERRIDE_ENABLE | ||
254 | // These need to be last to be able to properly control key overrides | ||
255 | keyboard_report->mods &= ~suppressed_mods; | ||
256 | keyboard_report->mods |= weak_override_mods; | ||
257 | #endif | ||
258 | |||
247 | host_keyboard_send(keyboard_report); | 259 | host_keyboard_send(keyboard_report); |
248 | } | 260 | } |
249 | 261 | ||
@@ -299,6 +311,22 @@ void set_weak_mods(uint8_t mods) { weak_mods = mods; } | |||
299 | */ | 311 | */ |
300 | void clear_weak_mods(void) { weak_mods = 0; } | 312 | void clear_weak_mods(void) { weak_mods = 0; } |
301 | 313 | ||
314 | #ifdef KEY_OVERRIDE_ENABLE | ||
315 | /** \brief set weak mods used by key overrides. DO not call this manually | ||
316 | */ | ||
317 | void set_weak_override_mods(uint8_t mods) { weak_override_mods = mods; } | ||
318 | /** \brief clear weak mods used by key overrides. DO not call this manually | ||
319 | */ | ||
320 | void clear_weak_override_mods(void) { weak_override_mods = 0; } | ||
321 | |||
322 | /** \brief set suppressed mods used by key overrides. DO not call this manually | ||
323 | */ | ||
324 | void set_suppressed_override_mods(uint8_t mods) { suppressed_mods = mods; } | ||
325 | /** \brief clear suppressed mods used by key overrides. DO not call this manually | ||
326 | */ | ||
327 | void clear_suppressed_override_mods(void) { suppressed_mods = 0; } | ||
328 | #endif | ||
329 | |||
302 | /* macro modifier */ | 330 | /* macro modifier */ |
303 | /** \brief get macro mods | 331 | /** \brief get macro mods |
304 | * | 332 | * |