summaryrefslogtreecommitdiff
path: root/quantum/action_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/action_util.c')
-rw-r--r--quantum/action_util.c47
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);
46#ifndef NO_ACTION_ONESHOT 46#ifndef NO_ACTION_ONESHOT
47static uint8_t oneshot_mods = 0; 47static uint8_t oneshot_mods = 0;
48static uint8_t oneshot_locked_mods = 0; 48static uint8_t oneshot_locked_mods = 0;
49uint8_t get_oneshot_locked_mods(void) { 49/**
50 * @brief Retrieve current state of locked oneshot modifiers.
51 *
52 * @return Current state of the locked oneshot modifier keys as a bitmask.
53 */
54uint8_t get_oneshot_locked_mods(void) {
50 return oneshot_locked_mods; 55 return oneshot_locked_mods;
51} 56}
57/**
58 * Same as \ref get_oneshot_locked_mods but returns \ref mod_t for convenience.
59 */
60mod_t get_oneshot_locked_mod_state(void) {
61 return (mod_t)get_oneshot_locked_mods();
62}
52void add_oneshot_locked_mods(uint8_t mods) { 63void add_oneshot_locked_mods(uint8_t mods) {
53 if ((oneshot_locked_mods & mods) != mods) { 64 if ((oneshot_locked_mods & mods) != mods) {
54 oneshot_locked_mods |= mods; 65 oneshot_locked_mods |= mods;
@@ -326,13 +337,20 @@ void send_keyboard_report(void) {
326 send_6kro_report(); 337 send_6kro_report();
327} 338}
328 339
329/** \brief Get mods 340/**
341 * @brief Retrieve current state of modifiers.
330 * 342 *
331 * FIXME: needs doc 343 * @return Current state of the modifier keys as a bitmask.
332 */ 344 */
333uint8_t get_mods(void) { 345uint8_t get_mods(void) {
334 return real_mods; 346 return real_mods;
335} 347}
348/**
349 * Same as \ref get_mods but returns \ref mod_t for convenience.
350 */
351mod_t get_mod_state(void) {
352 return (mod_t)get_mods();
353}
336/** \brief add mods 354/** \brief add mods
337 * 355 *
338 * FIXME: needs doc 356 * FIXME: needs doc
@@ -362,13 +380,20 @@ void clear_mods(void) {
362 real_mods = 0; 380 real_mods = 0;
363} 381}
364 382
365/** \brief get weak mods 383/**
384 * @brief Retrieve current state of weak modifiers.
366 * 385 *
367 * FIXME: needs doc 386 * @return Current state of the weak modifier keys as a bitmask.
368 */ 387 */
369uint8_t get_weak_mods(void) { 388uint8_t get_weak_mods(void) {
370 return weak_mods; 389 return weak_mods;
371} 390}
391/**
392 * Same as \ref get_weak_mods but returns \ref mod_t for convenience.
393 */
394mod_t get_weak_mod_state(void) {
395 return (mod_t)get_weak_mods();
396}
372/** \brief add weak mods 397/** \brief add weak mods
373 * 398 *
374 * FIXME: needs doc 399 * FIXME: needs doc
@@ -423,14 +448,22 @@ void clear_suppressed_override_mods(void) {
423#endif 448#endif
424 449
425#ifndef NO_ACTION_ONESHOT 450#ifndef NO_ACTION_ONESHOT
426/** \brief get oneshot mods 451/**
452 * @brief Retrieve current state of oneshot modifiers.
427 * 453 *
428 * FIXME: needs doc 454 * @return Current state of the oneshot modifier keys as a bitmask.
429 */ 455 */
430uint8_t get_oneshot_mods(void) { 456uint8_t get_oneshot_mods(void) {
431 return oneshot_mods; 457 return oneshot_mods;
432} 458}
433 459
460/**
461 * Same as \ref get_oneshot_mods but returns \ref mod_t for convenience.
462 */
463mod_t get_oneshot_mod_state(void) {
464 return (mod_t)get_oneshot_mods();
465}
466
434void add_oneshot_mods(uint8_t mods) { 467void add_oneshot_mods(uint8_t mods) {
435 if ((oneshot_mods & mods) != mods) { 468 if ((oneshot_mods & mods) != mods) {
436# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) 469# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))