diff options
author | Thomas Baart <mail@thomasbaart.nl> | 2019-02-05 19:19:56 +0100 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-02-05 10:19:56 -0800 |
commit | 47051f506fd4888bbb55fa7981cb7b24827f3d1b (patch) | |
tree | 88628409bc9d63bfb0999be7f5b328ff5421b365 /tmk_core/common/action_util.h | |
parent | 7df9e584fa1ee31ab5bb35b1c7fa09845cba0a80 (diff) | |
download | qmk_firmware-47051f506fd4888bbb55fa7981cb7b24827f3d1b.tar.gz qmk_firmware-47051f506fd4888bbb55fa7981cb7b24827f3d1b.zip |
Add One Shot Key callbacks (#4697)
* Added callbacks to one shot modifier changes
* Altered signature of callback functions
* Reordered the callback methods, shortened brief documentation
* Added One Shot Modifier callback documentation
* First attempt at unit tests
* Revert "First attempt at unit tests"
This reverts commit 5ec21a782202c0d74cf21cb852bd319f0c8b4842.
* Simplified oneshot function implementations
* Made clear_oneshot_locked_mods to be conform action_util.h, adhering to the (void) signature
* Made used datatypes for oneshot mods consistently unsigned integers
* Corrected callback to call clear callback when clear_oneshot_locked_mods is invoked
* Simplified oneshot equals statements
* Corrected return type and signature of get and set oneshot locked mods
* Consolidated one shot callbacks, added initial layer callback version
* Fixed non-updating one shot layer variable after timeout or other clear, added code comments
* Added better one shot key docs
Diffstat (limited to 'tmk_core/common/action_util.h')
-rw-r--r-- | tmk_core/common/action_util.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tmk_core/common/action_util.h b/tmk_core/common/action_util.h index 345893151..d03f5682a 100644 --- a/tmk_core/common/action_util.h +++ b/tmk_core/common/action_util.h | |||
@@ -71,8 +71,8 @@ void oneshot_enable(void); | |||
71 | void oneshot_disable(void); | 71 | void oneshot_disable(void); |
72 | bool has_oneshot_mods_timed_out(void); | 72 | bool has_oneshot_mods_timed_out(void); |
73 | 73 | ||
74 | int8_t get_oneshot_locked_mods(void); | 74 | uint8_t get_oneshot_locked_mods(void); |
75 | void set_oneshot_locked_mods(int8_t mods); | 75 | void set_oneshot_locked_mods(uint8_t mods); |
76 | void clear_oneshot_locked_mods(void); | 76 | void clear_oneshot_locked_mods(void); |
77 | 77 | ||
78 | typedef enum { | 78 | typedef enum { |
@@ -89,6 +89,13 @@ bool is_oneshot_layer_active(void); | |||
89 | uint8_t get_oneshot_layer_state(void); | 89 | uint8_t get_oneshot_layer_state(void); |
90 | bool has_oneshot_layer_timed_out(void); | 90 | bool has_oneshot_layer_timed_out(void); |
91 | 91 | ||
92 | void oneshot_locked_mods_changed_user(uint8_t mods); | ||
93 | void oneshot_locked_mods_changed_kb(uint8_t mods); | ||
94 | void oneshot_mods_changed_user(uint8_t mods); | ||
95 | void oneshot_mods_changed_kb(uint8_t mods); | ||
96 | void oneshot_layer_changed_user(uint8_t layer); | ||
97 | void oneshot_layer_changed_kb(uint8_t layer); | ||
98 | |||
92 | /* inspect */ | 99 | /* inspect */ |
93 | uint8_t has_anymod(void); | 100 | uint8_t has_anymod(void); |
94 | 101 | ||