From 0d8b4d6fa6c7f51207dc4904b8468e163d2ef88b Mon Sep 17 00:00:00 2001 From: skullY Date: Sat, 29 Feb 2020 17:21:07 -0800 Subject: [PATCH] Ensure more _user functions will always run --- tmk_core/common/arm_atsam/suspend.c | 6 ++++-- tmk_core/common/avr/suspend.c | 7 +++++-- tmk_core/common/chibios/suspend.c | 6 ++++-- tmk_core/common/eeconfig.c | 3 +-- tmk_core/common/keyboard.c | 9 ++++++--- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/tmk_core/common/arm_atsam/suspend.c b/tmk_core/common/arm_atsam/suspend.c index d1077be4c2..6b55d54e62 100644 --- a/tmk_core/common/arm_atsam/suspend.c +++ b/tmk_core/common/arm_atsam/suspend.c @@ -20,7 +20,7 @@ __attribute__((weak)) void suspend_power_down_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); } +__attribute__((weak)) void suspend_power_down_kb(void) {} /** \brief Suspend power down * @@ -32,6 +32,7 @@ void suspend_power_down(void) { #endif suspend_power_down_kb(); + suspend_power_down_user(); } __attribute__((weak)) void matrix_power_up(void) {} @@ -56,7 +57,7 @@ __attribute__((weak)) void suspend_wakeup_init_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); } +__attribute__((weak)) void suspend_wakeup_init_kb(void) {} /** \brief run immediately after wakeup * @@ -74,4 +75,5 @@ void suspend_wakeup_init(void) { #endif suspend_wakeup_init_kb(); + suspend_wakeup_init_user(); } diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index c59c196880..c497c54286 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -71,7 +71,7 @@ __attribute__((weak)) void suspend_power_down_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); } +__attribute__((weak)) void suspend_power_down_kb(void) {} #ifndef NO_SUSPEND_POWER_DOWN /** \brief Power down MCU with watchdog timer @@ -132,6 +132,7 @@ static void power_down(uint8_t wdto) { } # endif suspend_power_down_kb(); + suspend_power_down_user(); // TODO: more power saving // See PicoPower application note @@ -156,6 +157,7 @@ static void power_down(uint8_t wdto) { */ void suspend_power_down(void) { suspend_power_down_kb(); + suspend_power_down_user(); #ifndef NO_SUSPEND_POWER_DOWN power_down(WDTO_15MS); @@ -184,7 +186,7 @@ __attribute__((weak)) void suspend_wakeup_init_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); } +__attribute__((weak)) void suspend_wakeup_init_kb(void) {} /** \brief run immediately after wakeup * * FIXME: needs doc @@ -209,6 +211,7 @@ void suspend_wakeup_init(void) { # endif #endif suspend_wakeup_init_kb(); + suspend_wakeup_init_user(); } #ifndef NO_SUSPEND_POWER_DOWN diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 5be1b76777..2d64937935 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -40,7 +40,7 @@ __attribute__((weak)) void suspend_power_down_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); } +__attribute__((weak)) void suspend_power_down_kb(void) {} /** \brief suspend power down * @@ -62,6 +62,7 @@ void suspend_power_down(void) { #endif suspend_power_down_kb(); + suspend_power_down_user(); // on AVR, this enables the watchdog for 15ms (max), and goes to // SLEEP_MODE_PWR_DOWN @@ -94,7 +95,7 @@ __attribute__((weak)) void suspend_wakeup_init_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); } +__attribute__((weak)) void suspend_wakeup_init_kb(void) {} /** \brief suspend wakeup condition * @@ -131,4 +132,5 @@ void suspend_wakeup_init(void) { # endif #endif suspend_wakeup_init_kb(); + suspend_wakeup_init_user(); } diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index fe56c57d11..00ca609370 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c @@ -25,8 +25,6 @@ __attribute__((weak)) void eeconfig_init_user(void) { __attribute__((weak)) void eeconfig_init_kb(void) { // Reset Keyboard EEPROM value to blank, rather than to a set value eeconfig_update_kb(0); - - eeconfig_init_user(); } /* @@ -66,6 +64,7 @@ void eeconfig_init_quantum(void) { #endif eeconfig_init_kb(); + eeconfig_init_user(); } /** \brief eeconfig initialization diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index cb4e7637fa..98dc261969 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -179,7 +179,7 @@ __attribute__((weak)) void keyboard_pre_init_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } +__attribute__((weak)) void keyboard_pre_init_kb(void) {} /** \brief keyboard_post_init_user * @@ -193,7 +193,7 @@ __attribute__((weak)) void keyboard_post_init_user() {} * FIXME: needs doc */ -__attribute__((weak)) void keyboard_post_init_kb(void) { keyboard_post_init_user(); } +__attribute__((weak)) void keyboard_post_init_kb(void) { } /** \brief keyboard_setup * @@ -205,6 +205,7 @@ void keyboard_setup(void) { #endif matrix_setup(); keyboard_pre_init_kb(); + keyboard_pre_init_user(); } /** \brief is_keyboard_master @@ -262,7 +263,9 @@ void keyboard_init(void) { keymap_config.nkro = 1; eeconfig_update_keymap(keymap_config.raw); #endif - keyboard_post_init_kb(); /* Always keep this last */ + /* Always keep these last. */ + keyboard_post_init_kb(); + keyboard_post_init_user(); } /** \brief Keyboard task: Do keyboard routine jobs