diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/quantum.c | 21 | ||||
-rw-r--r-- | quantum/quantum.h | 4 |
2 files changed, 16 insertions, 9 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index 86c6768729..6639dc2291 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -172,7 +172,7 @@ __attribute__((weak)) void post_process_record_kb(uint16_t keycode, keyrecord_t __attribute__((weak)) void post_process_record_user(uint16_t keycode, keyrecord_t *record) {} -void shutdown_quantum(void) { +void shutdown_quantum(bool jump_to_bootloader) { clear_keyboard(); #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) process_midi_all_notes_off(); @@ -183,12 +183,12 @@ void shutdown_quantum(void) { # endif uint16_t timer_start = timer_read(); PLAY_SONG(goodbye_song); - shutdown_user(); + shutdown_kb(jump_to_bootloader); while (timer_elapsed(timer_start) < 250) wait_ms(1); stop_all_notes(); #else - shutdown_user(); + shutdown_kb(jump_to_bootloader); wait_ms(250); #endif #ifdef HAPTIC_ENABLE @@ -197,12 +197,12 @@ void shutdown_quantum(void) { } void reset_keyboard(void) { - shutdown_quantum(); + shutdown_quantum(true); bootloader_jump(); } void soft_reset_keyboard(void) { - shutdown_quantum(); + shutdown_quantum(false); mcu_reset(); } @@ -491,9 +491,16 @@ void set_single_persistent_default_layer(uint8_t default_layer) { // Override these functions in your keymap file to play different tunes on // different events such as startup and bootloader jump -__attribute__((weak)) void startup_user(void) {} +__attribute__((weak)) bool shutdown_user(bool jump_to_bootloader) { + return true; +} -__attribute__((weak)) void shutdown_user(void) {} +__attribute__((weak)) bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } + return true; +} void suspend_power_down_quantum(void) { suspend_power_down_kb(); diff --git a/quantum/quantum.h b/quantum/quantum.h index e41542e4af..996e93a12f 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -255,8 +255,8 @@ void post_process_record_user(uint16_t keycode, keyrecord_t *record); void reset_keyboard(void); void soft_reset_keyboard(void); -void startup_user(void); -void shutdown_user(void); +bool shutdown_kb(bool jump_to_bootloader); +bool shutdown_user(bool jump_to_bootloader); void register_code16(uint16_t code); void unregister_code16(uint16_t code); |