Improve and Cleanup Shutdown callbacks (#21060)
Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
This commit is contained in:
parent
4601f339e4
commit
3ef06aa732
79 changed files with 277 additions and 1684 deletions
|
@ -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))
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue