diff options
Diffstat (limited to 'quantum/action_util.c')
-rw-r--r-- | quantum/action_util.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/quantum/action_util.c b/quantum/action_util.c index e821e113ef..0996ff908e 100644 --- a/quantum/action_util.c +++ b/quantum/action_util.c @@ -46,9 +46,20 @@ extern inline void clear_keys(void); #ifndef NO_ACTION_ONESHOT static uint8_t oneshot_mods = 0; static uint8_t oneshot_locked_mods = 0; -uint8_t get_oneshot_locked_mods(void) { +/** + * @brief Retrieve current state of locked oneshot modifiers. + * + * @return Current state of the locked oneshot modifier keys as a bitmask. + */ +uint8_t get_oneshot_locked_mods(void) { return oneshot_locked_mods; } +/** + * Same as \ref get_oneshot_locked_mods but returns \ref mod_t for convenience. + */ +mod_t get_oneshot_locked_mod_state(void) { + return (mod_t)get_oneshot_locked_mods(); +} void add_oneshot_locked_mods(uint8_t mods) { if ((oneshot_locked_mods & mods) != mods) { oneshot_locked_mods |= mods; @@ -326,13 +337,20 @@ void send_keyboard_report(void) { send_6kro_report(); } -/** \brief Get mods +/** + * @brief Retrieve current state of modifiers. * - * FIXME: needs doc + * @return Current state of the modifier keys as a bitmask. */ uint8_t get_mods(void) { return real_mods; } +/** + * Same as \ref get_mods but returns \ref mod_t for convenience. + */ +mod_t get_mod_state(void) { + return (mod_t)get_mods(); +} /** \brief add mods * * FIXME: needs doc @@ -362,13 +380,20 @@ void clear_mods(void) { real_mods = 0; } -/** \brief get weak mods +/** + * @brief Retrieve current state of weak modifiers. * - * FIXME: needs doc + * @return Current state of the weak modifier keys as a bitmask. */ uint8_t get_weak_mods(void) { return weak_mods; } +/** + * Same as \ref get_weak_mods but returns \ref mod_t for convenience. + */ +mod_t get_weak_mod_state(void) { + return (mod_t)get_weak_mods(); +} /** \brief add weak mods * * FIXME: needs doc @@ -423,14 +448,22 @@ void clear_suppressed_override_mods(void) { #endif #ifndef NO_ACTION_ONESHOT -/** \brief get oneshot mods +/** + * @brief Retrieve current state of oneshot modifiers. * - * FIXME: needs doc + * @return Current state of the oneshot modifier keys as a bitmask. */ uint8_t get_oneshot_mods(void) { return oneshot_mods; } +/** + * Same as \ref get_oneshot_mods but returns \ref mod_t for convenience. + */ +mod_t get_oneshot_mod_state(void) { + return (mod_t)get_oneshot_mods(); +} + void add_oneshot_mods(uint8_t mods) { if ((oneshot_mods & mods) != mods) { # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) |