summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2023-11-26 03:59:18 -0800
committerGitHub <noreply@github.com>2023-11-26 22:59:18 +1100
commit3ef06aa732ce8063e11b2f983592529883f7ecbc (patch)
tree7fa143f938e711b6db1c2ed40c36298b8f7604c7 /users
parent4601f339e48b0116ca139dd06ce55ef0b9ed598f (diff)
Improve and Cleanup Shutdown callbacks (#21060)
Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
Diffstat (limited to 'users')
-rw-r--r--users/brandonschlack/brandonschlack.c3
-rw-r--r--users/curry/curry.c3
-rw-r--r--users/drashna/callbacks.c17
-rw-r--r--users/drashna/callbacks.h2
-rw-r--r--users/drashna/callbacks.md11
-rw-r--r--users/drashna/template.c13
-rw-r--r--users/jjerrell/jjerrell.c20
-rw-r--r--users/jjerrell/jjerrell.h12
-rw-r--r--users/kuchosauronad0/kuchosauronad0.c15
-rw-r--r--users/kuchosauronad0/kuchosauronad0.h2
-rw-r--r--users/spidey3/init.c5
11 files changed, 53 insertions, 50 deletions
diff --git a/users/brandonschlack/brandonschlack.c b/users/brandonschlack/brandonschlack.c
index 6a9c04a73d..bcf3ebcb80 100644
--- a/users/brandonschlack/brandonschlack.c
+++ b/users/brandonschlack/brandonschlack.c
@@ -68,7 +68,7 @@ void shutdown_keymap(void) {}
* If RGBs enabled,
* then set RGB color to Red
*/
-void shutdown_user (void) {
+bool shutdown_user(bool jump_to_bootloader) {
#ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
@@ -78,6 +78,7 @@ void shutdown_user (void) {
rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 );
#endif //RGB_MATRIX_ENABLE
shutdown_keymap();
+ return false;
}
__attribute__ ((weak))
diff --git a/users/curry/curry.c b/users/curry/curry.c
index f29b9c3ff7..aae7377a87 100644
--- a/users/curry/curry.c
+++ b/users/curry/curry.c
@@ -54,7 +54,7 @@ __attribute__((weak)) void shutdown_keymap(void) {}
void rgb_matrix_update_pwm_buffers(void);
// On RESET, set all RGB to red, shutdown the keymap.
-void shutdown_user(void) {
+bool shutdown_user(bool jump_to_bootloader) {
#if defined(RGBLIGHT_ENABLE)
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(1);
@@ -66,6 +66,7 @@ void shutdown_user(void) {
rgb_matrix_update_pwm_buffers();
#endif
shutdown_keymap();
+ return false;
}
__attribute__((weak)) void suspend_power_down_keymap(void) {}
diff --git a/users/drashna/callbacks.c b/users/drashna/callbacks.c
index cab7e5278f..2ace2ff9e6 100644
--- a/users/drashna/callbacks.c
+++ b/users/drashna/callbacks.c
@@ -73,8 +73,13 @@ void keyboard_post_init_user(void) {
void rgb_matrix_update_pwm_buffers(void);
#endif
-__attribute__((weak)) void shutdown_keymap(void) {}
-void shutdown_user(void) {
+__attribute__((weak)) bool shutdown_keymap(bool jump_to_bootloader) {
+ return true;
+}
+bool shutdown_user(bool jump_to_bootloader) {
+ if (!shutdown_keymap(jump_to_bootloader)) {
+ return false;
+ }
#ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(1);
@@ -87,8 +92,7 @@ void shutdown_user(void) {
#ifdef OLED_ENABLE
oled_off();
#endif
-
- shutdown_keymap();
+ return true;
}
__attribute__((weak)) void suspend_power_down_keymap(void) {}
@@ -268,11 +272,6 @@ void matrix_slave_scan_user(void) {
__attribute__((weak)) void housekeeping_task_keymap(void) {}
void housekeeping_task_user(void) {
- static bool has_ran_yet;
- if (!has_ran_yet) {
- has_ran_yet = true;
- startup_user();
- }
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
diff --git a/users/drashna/callbacks.h b/users/drashna/callbacks.h
index d3d260378d..77c0403f82 100644
--- a/users/drashna/callbacks.h
+++ b/users/drashna/callbacks.h
@@ -7,7 +7,7 @@
void keyboard_post_init_keymap(void);
void matrix_init_secret(void);
-void shutdown_keymap(void);
+bool shutdown_keymap(bool jump_to_bootloader);
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
void matrix_scan_keymap(void);
diff --git a/users/drashna/callbacks.md b/users/drashna/callbacks.md
index e23f7f6d86..8ef2707fc2 100644
--- a/users/drashna/callbacks.md
+++ b/users/drashna/callbacks.md
@@ -53,9 +53,14 @@ void suspend_wakeup_init_user(void) {
}
-__attribute__ ((weak)) void shutdown_keymap(void) {}
-void shutdown_user (void) {
- shutdown_keymap();
+__attribute__((weak)) bool shutdown_keymap(bool jump_to_bootloader) {
+ return true;
+}
+bool shutdown_user(bool jump_to_bootloader) {
+ if (!shutdown_keymap(jump_to_bootloader)) {
+ return false;
+ }
+ return true;
}
__attribute__ ((weak)) void eeconfig_init_keymap(void) {}
diff --git a/users/drashna/template.c b/users/drashna/template.c
index c032bd1ce3..300cdbc934 100644
--- a/users/drashna/template.c
+++ b/users/drashna/template.c
@@ -55,16 +55,3 @@ void suspend_wakeup_init_user(void) {
wait_ms(10);
#endif
}
-
-__attribute__((weak)) void startup_keymap(void) {}
-
-void startup_user(void) {
-#ifdef RGBLIGHT_ENABLE
- matrix_init_rgb();
-#endif // RGBLIGHT_ENABLE
- startup_keymap();
-}
-
-__attribute__((weak)) void shutdown_keymap(void) {}
-
-void shutdown_user(void) { shutdown_keymap(); }
diff --git a/users/jjerrell/jjerrell.c b/users/jjerrell/jjerrell.c
index 47aa9bc042..e061977ab6 100644
--- a/users/jjerrell/jjerrell.c
+++ b/users/jjerrell/jjerrell.c
@@ -1,18 +1,18 @@
/**
* Copyright (C) 2021 Jerrell, Jacob <@jjerrell>
- *
+ *
* This file is part of qmk_firmware.
- *
+ *
* qmk_firmware is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* qmk_firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with qmk_firmware. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -114,12 +114,16 @@ void startup_user(void)
startup_keymap();
}
-__attribute__((weak)) void shutdown_keymap(void) {}
-void shutdown_user(void)
-{
+__attribute__((weak)) bool shutdown_keymap(bool jump_to_bootloader) {
+ return true;
+}
+bool shutdown_user(bool jump_to_bootloader) {
+ if (!shutdown_keymap(jump_to_bootloader)) {
+ return false;
+ }
wait_ms(TAP_CODE_DELAY);
stop_all_notes();
- shutdown_keymap();
+ return true;
}
__attribute__((weak)) void music_on_keymap(void) {}
diff --git a/users/jjerrell/jjerrell.h b/users/jjerrell/jjerrell.h
index 92b95ccc01..a5488b28ab 100644
--- a/users/jjerrell/jjerrell.h
+++ b/users/jjerrell/jjerrell.h
@@ -1,18 +1,18 @@
/**
* Copyright (C) 2021 Jerrell, Jacob <@jjerrell>
- *
+ *
* This file is part of qmk_firmware.
- *
+ *
* qmk_firmware is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* qmk_firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with qmk_firmware. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -30,7 +30,7 @@
/************************* Userspace Layers *************************
* Keymaps can define additional layers by making the first case
- * equal to `LAYER_SAFE_RANGE`
+ * equal to `LAYER_SAFE_RANGE`
********************************************************************/
enum userspace_layers {
_WORKMAN,
@@ -49,5 +49,5 @@ void dip_switch_update_keymap(uint8_t index, bool active);
bool music_mask_keymap(uint16_t keycode);
layer_state_t default_layer_state_set_keymap(layer_state_t state);
void startup_keymap(void);
-void shutdown_keymap(void);
+bool shutdown_keymap(bool jump_to_bootloader);
void music_on_keymap(void);
diff --git a/users/kuchosauronad0/kuchosauronad0.c b/users/kuchosauronad0/kuchosauronad0.c
index 2c63eadfd1..3fc66d809b 100644
--- a/users/kuchosauronad0/kuchosauronad0.c
+++ b/users/kuchosauronad0/kuchosauronad0.c
@@ -62,11 +62,14 @@ void keyboard_post_init_user(void){
keyboard_post_init_keymap();
}
-__attribute__ ((weak))
-void shutdown_keymap(void) {}
-
-void shutdown_user (void) {
- #ifdef RGBLIGHT_ENABLE
+__attribute__((weak)) bool shutdown_keymap(bool jump_to_bootloader) {
+ return true;
+}
+bool shutdown_user(bool jump_to_bootloader) {
+ if (!shutdown_keymap(jump_to_bootloader)) {
+ return false;
+ }
+ #ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(1);
rgblight_setrgb(RGB_TEAL);
@@ -76,7 +79,7 @@ void shutdown_user (void) {
// rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 );
// while(timer_elapsed(timer_start) < 250) { wait_ms(1); }
#endif //RGB_MATRIX_ENABLE
- shutdown_keymap();
+ return true;
}
__attribute__ ((weak))
diff --git a/users/kuchosauronad0/kuchosauronad0.h b/users/kuchosauronad0/kuchosauronad0.h
index 5cbd517d67..244c3cbf55 100644
--- a/users/kuchosauronad0/kuchosauronad0.h
+++ b/users/kuchosauronad0/kuchosauronad0.h
@@ -61,7 +61,7 @@ bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed);
bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
bool send_game_macro(const char *str, keyrecord_t *record, bool override);
void matrix_init_keymap(void);
-void shutdown_keymap(void);
+bool shutdown_keymap(bool jump_to_bootloader);
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
void matrix_scan_keymap(void);
diff --git a/users/spidey3/init.c b/users/spidey3/init.c
index bd6ea5cac9..15789b3958 100644
--- a/users/spidey3/init.c
+++ b/users/spidey3/init.c
@@ -17,5 +17,8 @@ void eeconfig_init_user(void) {
}
#ifdef RGBLIGHT_ENABLE
-void shutdown_user(void) { shutdown_user_rgb(); }
+bool shutdown_user(bool jump_to_bootloader) {
+ shutdown_user_rgb();
+ return true;
+}
#endif