From 86214ec55bbd3558aba6e2f63e7a9cd9f2c945f4 Mon Sep 17 00:00:00 2001 From: Thomas Baart Date: Wed, 19 Dec 2018 22:33:19 +0100 Subject: [PATCH] Reordered the callback methods, shortened brief documentation --- tmk_core/common/action_util.c | 96 +++++++++++++++++------------------ tmk_core/common/action_util.h | 18 +++---- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index 996a56c2e4..8495ccb869 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c @@ -47,54 +47,6 @@ extern inline void add_key(uint8_t key); extern inline void del_key(uint8_t key); extern inline void clear_keys(void); -/** \brief Callback which is called when the one shot modifiers have been locked. - */ -__attribute__((weak)) -void oneshot_locked_mods_set_user(uint8_t mods) { } - -/** \brief Callback which is called when the locked one shot modifiers have been locked. - */ -__attribute__((weak)) -void oneshot_locked_mods_set_kb(uint8_t mods) { - oneshot_locked_mods_set_user(mods); -} - -/** \brief Callback which is called when the one shot modifiers have been locked. - */ -__attribute__((weak)) -void oneshot_locked_mods_cleared_user(void) { } - -/** \brief Callback which is called when the locked one shot modifiers have been locked. - */ -__attribute__((weak)) -void oneshot_locked_mods_cleared_kb(void) { - oneshot_locked_mods_cleared_user(); -} - -/** \brief Callback which is called when the one shot modifiers have been set. - */ -__attribute__((weak)) -void oneshot_mods_set_user(uint8_t mods) { } - -/** \brief Callback which is called when the one shot modifiers have been cleared. - */ -__attribute__((weak)) -void oneshot_mods_cleared_user(void) { } - -/** \brief Callback which is called when the one shot modifiers have been set. - */ -__attribute__((weak)) -void oneshot_mods_set_kb(uint8_t mods) { - oneshot_mods_set_user(mods); -} - -/** \brief Callback which is called when the one shot modifiers have been cleared. - */ -__attribute__((weak)) -void oneshot_mods_cleared_kb() { - oneshot_mods_cleared_user(); -} - #ifndef NO_ACTION_ONESHOT static int8_t oneshot_mods = 0; static int8_t oneshot_locked_mods = 0; @@ -339,6 +291,54 @@ uint8_t get_oneshot_mods(void) } #endif +/** \brief Called when the one shot modifiers have been locked. + */ +__attribute__((weak)) +void oneshot_locked_mods_set_user(uint8_t mods) { } + +/** \brief Called when the locked one shot modifiers have been locked. + */ +__attribute__((weak)) +void oneshot_locked_mods_set_kb(uint8_t mods) { + oneshot_locked_mods_set_user(mods); +} + +/** \brief Called when the one shot modifiers have been locked. + */ +__attribute__((weak)) +void oneshot_locked_mods_cleared_user(void) { } + +/** \brief Called when the locked one shot modifiers have been locked. + */ +__attribute__((weak)) +void oneshot_locked_mods_cleared_kb(void) { + oneshot_locked_mods_cleared_user(); +} + +/** \brief Called when the one shot modifiers have been set. + */ +__attribute__((weak)) +void oneshot_mods_set_user(uint8_t mods) { } + +/** \brief Called when the one shot modifiers have been set. + */ +__attribute__((weak)) +void oneshot_mods_set_kb(uint8_t mods) { + oneshot_mods_set_user(mods); +} + +/** \brief Called when the one shot modifiers have been cleared. + */ +__attribute__((weak)) +void oneshot_mods_cleared_user(void) { } + +/** \brief Called when the one shot modifiers have been cleared. + */ +__attribute__((weak)) +void oneshot_mods_cleared_kb() { + oneshot_mods_cleared_user(); +} + /** \brief inspect keyboard state * * FIXME: needs doc diff --git a/tmk_core/common/action_util.h b/tmk_core/common/action_util.h index c2f7f588e9..a55d51dc65 100644 --- a/tmk_core/common/action_util.h +++ b/tmk_core/common/action_util.h @@ -28,15 +28,6 @@ extern report_keyboard_t *keyboard_report; void send_keyboard_report(void); -void oneshot_locked_mods_set_user(uint8_t mods); -void oneshot_locked_mods_set_kb(uint8_t mods); -void oneshot_locked_mods_cleared_user(void); -void oneshot_locked_mods_cleared_kb(void); -void oneshot_mods_set_user(uint8_t mods); -void oneshot_mods_set_kb(uint8_t mods); -void oneshot_mods_cleared_user(void); -void oneshot_mods_cleared_kb(void); - /* key */ inline void add_key(uint8_t key) { add_key_to_report(keyboard_report, key); @@ -98,6 +89,15 @@ bool is_oneshot_layer_active(void); uint8_t get_oneshot_layer_state(void); bool has_oneshot_layer_timed_out(void); +void oneshot_locked_mods_set_user(uint8_t mods); +void oneshot_locked_mods_set_kb(uint8_t mods); +void oneshot_locked_mods_cleared_user(void); +void oneshot_locked_mods_cleared_kb(void); +void oneshot_mods_set_user(uint8_t mods); +void oneshot_mods_set_kb(uint8_t mods); +void oneshot_mods_cleared_user(void); +void oneshot_mods_cleared_kb(void); + /* inspect */ uint8_t has_anymod(void);