summaryrefslogtreecommitdiff
path: root/tmk_core/common/action_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/action_util.c')
-rw-r--r--tmk_core/common/action_util.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c
index fd0e4409f0..000503b082 100644
--- a/tmk_core/common/action_util.c
+++ b/tmk_core/common/action_util.c
@@ -290,6 +290,32 @@ void set_macro_mods(uint8_t mods) { macro_mods = mods; }
void clear_macro_mods(void) { macro_mods = 0; }
#ifndef NO_ACTION_ONESHOT
+/** \brief get oneshot mods
+ *
+ * FIXME: needs doc
+ */
+uint8_t get_oneshot_mods(void) { return oneshot_mods; }
+
+void add_oneshot_mods(uint8_t mods) {
+ if ((oneshot_mods & mods) != mods) {
+# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
+ oneshot_time = timer_read();
+# endif
+ oneshot_mods |= mods;
+ oneshot_mods_changed_kb(mods);
+ }
+}
+
+void del_oneshot_mods(uint8_t mods) {
+ if (oneshot_mods & mods) {
+ oneshot_mods &= ~mods;
+# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
+ oneshot_time = oneshot_mods ? timer_read() : 0;
+# endif
+ oneshot_mods_changed_kb(oneshot_mods);
+ }
+}
+
/** \brief set oneshot mods
*
* FIXME: needs doc
@@ -316,11 +342,6 @@ void clear_oneshot_mods(void) {
oneshot_mods_changed_kb(oneshot_mods);
}
}
-/** \brief get oneshot mods
- *
- * FIXME: needs doc
- */
-uint8_t get_oneshot_mods(void) { return oneshot_mods; }
#endif
/** \brief Called when the one shot modifiers have been changed.