diff options
| author | Erez Zukerman <bulk@ezuk.org> | 2016-03-27 21:09:15 +0300 |
|---|---|---|
| committer | Erez Zukerman <bulk@ezuk.org> | 2016-03-27 21:09:15 +0300 |
| commit | 80eefb09ac5de95a6977702b4014d4b4d79a5d7d (patch) | |
| tree | 3c5176ee8dfdadd4429b709e8c2cabcaff84f063 /tmk_core/common/action_util.c | |
| parent | 16da54cfa037aad7575bae2fd12527ae7a0149b1 (diff) | |
| parent | b7a81f041906c3c978a314987e486536be0a58cd (diff) | |
| download | qmk_firmware-80eefb09ac5de95a6977702b4014d4b4d79a5d7d.tar.gz qmk_firmware-80eefb09ac5de95a6977702b4014d4b4d79a5d7d.zip | |
Merge pull request #188 from DidierLoiseau/issue-156
Fix #156: clear weak mods on every key press
Diffstat (limited to 'tmk_core/common/action_util.c')
| -rw-r--r-- | tmk_core/common/action_util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index f81877dd9..a2d6577b2 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c | |||
| @@ -29,6 +29,7 @@ static inline void del_key_bit(uint8_t code); | |||
| 29 | 29 | ||
| 30 | static uint8_t real_mods = 0; | 30 | static uint8_t real_mods = 0; |
| 31 | static uint8_t weak_mods = 0; | 31 | static uint8_t weak_mods = 0; |
| 32 | static uint8_t macro_mods = 0; | ||
| 32 | 33 | ||
| 33 | #ifdef USB_6KRO_ENABLE | 34 | #ifdef USB_6KRO_ENABLE |
| 34 | #define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) | 35 | #define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) |
| @@ -55,6 +56,7 @@ static int16_t oneshot_time = 0; | |||
| 55 | void send_keyboard_report(void) { | 56 | void send_keyboard_report(void) { |
| 56 | keyboard_report->mods = real_mods; | 57 | keyboard_report->mods = real_mods; |
| 57 | keyboard_report->mods |= weak_mods; | 58 | keyboard_report->mods |= weak_mods; |
| 59 | keyboard_report->mods |= macro_mods; | ||
| 58 | #ifndef NO_ACTION_ONESHOT | 60 | #ifndef NO_ACTION_ONESHOT |
| 59 | if (oneshot_mods) { | 61 | if (oneshot_mods) { |
| 60 | #if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) | 62 | #if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) |
| @@ -118,6 +120,13 @@ void del_weak_mods(uint8_t mods) { weak_mods &= ~mods; } | |||
| 118 | void set_weak_mods(uint8_t mods) { weak_mods = mods; } | 120 | void set_weak_mods(uint8_t mods) { weak_mods = mods; } |
| 119 | void clear_weak_mods(void) { weak_mods = 0; } | 121 | void clear_weak_mods(void) { weak_mods = 0; } |
| 120 | 122 | ||
| 123 | /* macro modifier */ | ||
| 124 | uint8_t get_macro_mods(void) { return macro_mods; } | ||
| 125 | void add_macro_mods(uint8_t mods) { macro_mods |= mods; } | ||
| 126 | void del_macro_mods(uint8_t mods) { macro_mods &= ~mods; } | ||
| 127 | void set_macro_mods(uint8_t mods) { macro_mods = mods; } | ||
| 128 | void clear_macro_mods(void) { macro_mods = 0; } | ||
| 129 | |||
| 121 | /* Oneshot modifier */ | 130 | /* Oneshot modifier */ |
| 122 | #ifndef NO_ACTION_ONESHOT | 131 | #ifndef NO_ACTION_ONESHOT |
| 123 | void set_oneshot_mods(uint8_t mods) | 132 | void set_oneshot_mods(uint8_t mods) |
