From 3ef06aa732ce8063e11b2f983592529883f7ecbc Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 26 Nov 2023 03:59:18 -0800 Subject: [PATCH] Improve and Cleanup Shutdown callbacks (#21060) Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com> --- docs/custom_quantum_functions.md | 59 ++++++++++++++++ docs/feature_oled_driver.md | 18 +---- .../gherkin/keymaps/mjt/keymap.c | 35 +--------- .../charybdis/3x5/keymaps/bstiq/keymap.c | 12 ---- .../charybdis/3x5/keymaps/via/keymap.c | 12 ---- .../charybdis/3x6/keymaps/via/keymap.c | 12 ---- .../charybdis/4x6/keymaps/via/keymap.c | 12 ---- keyboards/bastardkb/charybdis/charybdis.c | 17 +++++ .../dilemma/3x5_2/keymaps/bstiq/keymap.c | 12 ---- .../dilemma/3x5_3/keymaps/bstiq/keymap.c | 3 +- keyboards/bastardkb/dilemma/dilemma.c | 17 +++++ keyboards/bemeier/bmek/bmek.c | 7 +- .../spin/keymaps/spidey3_pad/keymap.c | 4 +- keyboards/dumbpad/v0x/v0x.c | 6 +- .../dumbpad/v0x_dualencoder/v0x_dualencoder.c | 6 +- keyboards/dumbpad/v0x_right/v0x_right.c | 6 +- keyboards/dumbpad/v1x/v1x.c | 6 +- .../dumbpad/v1x_dualencoder/v1x_dualencoder.c | 6 +- keyboards/dumbpad/v1x_right/v1x_right.c | 6 +- keyboards/dumbpad/v3x/v3x.c | 6 +- keyboards/eco/keymaps/that_canadian/keymap.c | 38 ----------- .../hadron/ver2/keymaps/side_numpad/keymap.c | 33 --------- .../atreus50/keymaps/default/keymap.c | 48 ++----------- .../ortho5x13/keymaps/default/keymap.c | 49 ++----------- keyboards/helix/pico/keymaps/default/keymap.c | 30 -------- keyboards/helix/pico/keymaps/mtei/keymap.c | 33 --------- keyboards/helix/rev2/keymaps/default/keymap.c | 30 -------- keyboards/helix/rev2/keymaps/froggy/keymap.c | 30 -------- keyboards/helix/rev2/keymaps/yshrsmz/keymap.c | 30 -------- keyboards/matrix/abelx/abelx.c | 7 +- keyboards/matrix/m20add/m20add.c | 8 +-- keyboards/neopad/rev1/rev1.c | 6 +- keyboards/omkbd/ergodash/rev1/rev1.c | 32 --------- keyboards/planck/keymaps/altgr/common/init.h | 26 ------- keyboards/planck/keymaps/circuit/keymap.c | 38 +---------- keyboards/planck/keymaps/dbroqua/keymap.c | 38 ----------- .../planck/keymaps/dr_notsokind/keymap.c | 42 +----------- keyboards/planck/keymaps/emilyh/keymap.c | 38 ----------- .../planck/keymaps/experimental/keymap.c | 37 ---------- keyboards/planck/keymaps/gunp/keymap.c | 23 ------- .../keymaps/handwired_binaryplease/keymap.c | 37 ---------- keyboards/planck/keymaps/hiea/common/init.h | 26 ------- keyboards/planck/keymaps/hieax/common/init.h | 25 ------- keyboards/planck/keymaps/impossible/keymap.c | 40 ----------- keyboards/planck/keymaps/ishtob/keymap.c | 60 ++++------------ keyboards/planck/keymaps/jhenahan/keymap.c | 38 ----------- keyboards/planck/keymaps/lae3/keymap.c | 46 +------------ keyboards/planck/keymaps/mjt/keymap.c | 38 ----------- keyboards/planck/keymaps/mjtnumsym/keymap.c | 38 ----------- keyboards/planck/keymaps/originerd/keymap.c | 38 ----------- keyboards/planck/keymaps/premek/keymap.c | 38 ----------- .../planck/keymaps/roguepullrequest/keymap.c | 13 ++-- .../planck/keymaps/sdothum/common/init.h | 26 ------- keyboards/planck/keymaps/sgoodwin/keymap.c | 38 ----------- keyboards/planck/keymaps/smt/keymap.c | 38 ----------- .../planck/keymaps/that_canadian/keymap.c | 38 ----------- keyboards/planck/keymaps/vaire/keymap.c | 68 ++++++------------- .../keymaps/zach/zach_common_functions.c | 30 -------- keyboards/preonic/keymaps/0xdec/keymap.c | 27 -------- keyboards/preonic/keymaps/bucktooth/keymap.c | 44 ------------ keyboards/preonic/keymaps/jacwib/keymap.c | 46 ------------- keyboards/preonic/keymaps/nikchi/keymap.c | 44 ------------ keyboards/preonic/keymaps/smt/keymap.c | 44 ------------ .../preonic/keymaps/that_canadian/keymap.c | 44 ------------ .../keymaps/zach/zach_common_functions.c | 28 -------- .../community/numpad_5x6/bjohnson/keymap.c | 3 +- quantum/quantum.c | 21 ++++-- quantum/quantum.h | 4 +- users/brandonschlack/brandonschlack.c | 3 +- users/curry/curry.c | 3 +- users/drashna/callbacks.c | 17 +++-- users/drashna/callbacks.h | 2 +- users/drashna/callbacks.md | 11 ++- users/drashna/template.c | 13 ---- users/jjerrell/jjerrell.c | 20 +++--- users/jjerrell/jjerrell.h | 12 ++-- users/kuchosauronad0/kuchosauronad0.c | 15 ++-- users/kuchosauronad0/kuchosauronad0.h | 2 +- users/spidey3/init.c | 5 +- 79 files changed, 277 insertions(+), 1684 deletions(-) delete mode 100644 keyboards/omkbd/ergodash/rev1/rev1.c diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md index 5d63f3cfb7..7a7b6ee823 100644 --- a/docs/custom_quantum_functions.md +++ b/docs/custom_quantum_functions.md @@ -283,6 +283,65 @@ void suspend_wakeup_init_user(void) { * Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` * Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` + +# Keyboard Shutdown/Reboot Code + +This function gets called whenever the firmware is reset, whether it's a soft reset or reset to the bootloader. This is the spot to use for any sort of cleanup, as this happens right before the actual reset. And it can be useful for turning off different systems (such as RGB, onboard screens, etc). + +Additionally, it differentiates between the soft reset (eg, rebooting back into the firmware) or jumping to the bootloader. + +Certain tasks are performed during shutdown too. The keyboard is cleared, music and midi is stopped (if enabled), the shutdown chime is triggered (if audio is enabled), and haptic is stopped. + +If `jump_to_bootloader` is set to `true`, this indicates that the board will be entering the bootloader for a new firmware flash, whereas `false` indicates that this is happening for a soft reset and will load the firmware agaim immediately (such as when using `QK_REBOOT` or `QK_CLEAR_EEPROM`). + +As there is a keyboard and user level function, returning `false` for the user function will disable the keyboard level function, allowing for customization. + +?> Bootmagic does not trigger `shutdown_*()` as it happens before most of the initialization process. + +### Example `shutdown_kb()` Implementation + +```c +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } + + if (jump_to_bootloader) { + // red for bootloader + rgb_matrix_set_color_all(RGB_OFF); + } else { + // off for soft reset + rgb_matrix_set_color_all(RGB_GREEN); + } + // force flushing -- otherwise will never happen + rgb_matrix_update_pwm_buffers(); + return true; +} +``` + +### Example `shutdown_user()` Implementation + +```c +bool shutdown_user(bool jump_to_bootloader) { + if (jump_to_bootloader) { + // red for bootloader + rgb_matrix_set_color_all(RGB_RED); + } else { + // off for soft reset + rgb_matrix_set_color_all(RGB_OFF); + } + // force flushing -- otherwise will never happen + rgb_matrix_update_pwm_buffers(); + // false to not process kb level + return false; +} +``` + +### Keyboard shutdown/reboot Function Documentation + +* Keyboard/Revision: `bool shutdown_kb(bool jump_to_bootloader)` +* Keymap: `bool shutdown_user(bool jump_to_bootloader)` + # Deferred Execution :id=deferred-execution QMK has the ability to execute a callback after a specified period of time, rather than having to manually manage timers. To enable this functionality, set `DEFERRED_EXEC_ENABLE = yes` in rules.mk. diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md index 452f729e14..a8bcdf2db9 100644 --- a/docs/feature_oled_driver.md +++ b/docs/feature_oled_driver.md @@ -183,22 +183,8 @@ void oled_render_boot(bool bootloader) { oled_render_dirty(true); } -bool reboot = false; - -bool uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - - // Display a special message prior to rebooting... - if (keycode == QK_BOOT) { - reboot = true; - } - } - - return true; -} - -void shutdown_user(void) { - oled_render_boot(reboot); +bool shutdown_user(bool jump_to_bootloader) { + oled_render_boot(jump_to_bootloader); } ``` diff --git a/keyboards/40percentclub/gherkin/keymaps/mjt/keymap.c b/keyboards/40percentclub/gherkin/keymaps/mjt/keymap.c index 090fd1d296..3a5cef8fad 100644 --- a/keyboards/40percentclub/gherkin/keymaps/mjt/keymap.c +++ b/keyboards/40percentclub/gherkin/keymaps/mjt/keymap.c @@ -66,15 +66,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #ifdef AUDIO_ENABLE -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif void persistant_default_layer_set(uint16_t default_layer) { @@ -166,39 +163,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif +void matrix_scan_user(void) { } -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif - //Tap Dance Definitions tap_dance_action_t tap_dance_actions[] = { //Tap once for Esc, twice for Caps Lock diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/keymap.c index 8f02227c01..21e823575e 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/keymap.c +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/keymap.c @@ -210,15 +210,3 @@ layer_state_t layer_state_set_kb(layer_state_t state) { // Forward-declare this helper function since it is defined in rgb_matrix.c. void rgb_matrix_update_pwm_buffers(void); #endif - -void shutdown_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - rgblight_setrgb(RGB_RED); -#endif // RGBLIGHT_ENABLE -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all(RGB_RED); - rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE -} diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c index 4a91548090..5299444ad3 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c @@ -255,15 +255,3 @@ layer_state_t layer_state_set_user(layer_state_t state) { // rgb_matrix.c. void rgb_matrix_update_pwm_buffers(void); #endif - -void shutdown_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - rgblight_setrgb(RGB_RED); -#endif // RGBLIGHT_ENABLE -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all(RGB_RED); - rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE -} diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/3x6/keymaps/via/keymap.c index fd56cce25d..d78ce8b7ff 100644 --- a/keyboards/bastardkb/charybdis/3x6/keymaps/via/keymap.c +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/via/keymap.c @@ -134,15 +134,3 @@ layer_state_t layer_state_set_user(layer_state_t state) { // Forward-declare this helper function since it is defined in rgb_matrix.c. void rgb_matrix_update_pwm_buffers(void); #endif - -void shutdown_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(1); - rgblight_setrgb(RGB_RED); -#endif // RGBLIGHT_ENABLE -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all(RGB_RED); - rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE -} diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c index fb795829fd..a0657b02ec 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c @@ -157,15 +157,3 @@ layer_state_t layer_state_set_user(layer_state_t state) { // Forward-declare this helper function since it is defined in rgb_matrix.c. void rgb_matrix_update_pwm_buffers(void); #endif - -void shutdown_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(1); - rgblight_setrgb(RGB_RED); -#endif // RGBLIGHT_ENABLE -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all(RGB_RED); - rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE -} diff --git a/keyboards/bastardkb/charybdis/charybdis.c b/keyboards/bastardkb/charybdis/charybdis.c index c321af7aa9..c9f0e63172 100644 --- a/keyboards/bastardkb/charybdis/charybdis.c +++ b/keyboards/bastardkb/charybdis/charybdis.c @@ -382,3 +382,20 @@ void matrix_scan_kb(void) { matrix_scan_user(); } #endif // KEYBOARD_bastardkb_charybdis_3x5_blackpill || KEYBOARD_bastardkb_charybdis_4x6_blackpill + +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_setrgb(RGB_RED); +#endif // RGBLIGHT_ENABLE +#ifdef RGB_MATRIX_ENABLE + void rgb_matrix_update_pwm_buffers(void); + rgb_matrix_set_color_all(RGB_RED); + rgb_matrix_update_pwm_buffers(); +#endif // RGB_MATRIX_ENABLE + return true; +} diff --git a/keyboards/bastardkb/dilemma/3x5_2/keymaps/bstiq/keymap.c b/keyboards/bastardkb/dilemma/3x5_2/keymaps/bstiq/keymap.c index e8c0441d7b..5f22184928 100644 --- a/keyboards/bastardkb/dilemma/3x5_2/keymaps/bstiq/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_2/keymaps/bstiq/keymap.c @@ -210,15 +210,3 @@ layer_state_t layer_state_set_kb(layer_state_t state) { // Forward-declare this helper function since it is defined in rgb_matrix.c. void rgb_matrix_update_pwm_buffers(void); #endif - -void shutdown_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - rgblight_setrgb(RGB_RED); -#endif // RGBLIGHT_ENABLE -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all(RGB_RED); - rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE -} diff --git a/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/keymap.c b/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/keymap.c index 2c262521bc..b55d99b56b 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/keymap.c @@ -210,7 +210,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { void rgb_matrix_update_pwm_buffers(void); #endif -void shutdown_user(void) { +bool shutdown_user(bool jump_to_bootloader) { #ifdef RGBLIGHT_ENABLE rgblight_enable_noeeprom(); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); @@ -220,4 +220,5 @@ void shutdown_user(void) { rgb_matrix_set_color_all(RGB_RED); rgb_matrix_update_pwm_buffers(); #endif // RGB_MATRIX_ENABLE + return true; } diff --git a/keyboards/bastardkb/dilemma/dilemma.c b/keyboards/bastardkb/dilemma/dilemma.c index 5452f9e7f6..7c87fdcadd 100644 --- a/keyboards/bastardkb/dilemma/dilemma.c +++ b/keyboards/bastardkb/dilemma/dilemma.c @@ -343,3 +343,20 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } + +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_setrgb(RGB_RED); +#endif // RGBLIGHT_ENABLE +#ifdef RGB_MATRIX_ENABLE + void rgb_matrix_update_pwm_buffers(void); + rgb_matrix_set_color_all(RGB_RED); + rgb_matrix_update_pwm_buffers(); +#endif // RGB_MATRIX_ENABLE + return true; +} diff --git a/keyboards/bemeier/bmek/bmek.c b/keyboards/bemeier/bmek/bmek.c index eaae446d63..dd0372aaee 100755 --- a/keyboards/bemeier/bmek/bmek.c +++ b/keyboards/bemeier/bmek/bmek.c @@ -15,9 +15,12 @@ */ #include "quantum.h" -__attribute__((weak)) -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } #ifdef RGBLIGHT_ENABLE rgblight_setrgb(255, 0, 0); #endif + return true; } diff --git a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c index dd452dae1a..4acb0ee59b 100644 --- a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c +++ b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c @@ -147,11 +147,12 @@ void keyboard_post_init_user(void) { do_rgb_layers(layer_state, LAYER_BASE, LAYER_BASE_END); } -void shutdown_user(void) { +bool shutdown_user(bool jump_to_bootloader) { clear_rgb_layers(); rgblight_enable(); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); rgblight_sethsv_noeeprom(HSV_RED); + return false; } void spidey_glow(void) { @@ -218,4 +219,3 @@ void post_process_record_user(uint16_t keycode, keyrecord_t *record) { break; } } - diff --git a/keyboards/dumbpad/v0x/v0x.c b/keyboards/dumbpad/v0x/v0x.c index 6c89edaa11..d7e3841d76 100644 --- a/keyboards/dumbpad/v0x/v0x.c +++ b/keyboards/dumbpad/v0x/v0x.c @@ -22,10 +22,14 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c index 6c89edaa11..d7e3841d76 100644 --- a/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c +++ b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c @@ -22,10 +22,14 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/dumbpad/v0x_right/v0x_right.c b/keyboards/dumbpad/v0x_right/v0x_right.c index 6c89edaa11..d7e3841d76 100644 --- a/keyboards/dumbpad/v0x_right/v0x_right.c +++ b/keyboards/dumbpad/v0x_right/v0x_right.c @@ -22,10 +22,14 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/dumbpad/v1x/v1x.c b/keyboards/dumbpad/v1x/v1x.c index f1b1d66c7f..1022ad0605 100644 --- a/keyboards/dumbpad/v1x/v1x.c +++ b/keyboards/dumbpad/v1x/v1x.c @@ -23,11 +23,15 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); writePinLow(LED_02); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c b/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c index f1b1d66c7f..1022ad0605 100644 --- a/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c +++ b/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c @@ -23,11 +23,15 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); writePinLow(LED_02); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/dumbpad/v1x_right/v1x_right.c b/keyboards/dumbpad/v1x_right/v1x_right.c index f1b1d66c7f..1022ad0605 100644 --- a/keyboards/dumbpad/v1x_right/v1x_right.c +++ b/keyboards/dumbpad/v1x_right/v1x_right.c @@ -23,11 +23,15 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); writePinLow(LED_02); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/dumbpad/v3x/v3x.c b/keyboards/dumbpad/v3x/v3x.c index d0acca1947..89f13684f2 100644 --- a/keyboards/dumbpad/v3x/v3x.c +++ b/keyboards/dumbpad/v3x/v3x.c @@ -54,11 +54,15 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); writePinLow(LED_02); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/eco/keymaps/that_canadian/keymap.c b/keyboards/eco/keymaps/that_canadian/keymap.c index 0c8b53385d..edd88b184e 100644 --- a/keyboards/eco/keymaps/that_canadian/keymap.c +++ b/keyboards/eco/keymaps/that_canadian/keymap.c @@ -124,14 +124,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -174,36 +169,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c b/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c index f352b1c851..9cc621df2f 100644 --- a/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c +++ b/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c @@ -316,36 +316,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { -#ifdef AUDIO_ENABLE - startup_user(); -#endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{cc - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/handwired/atreus50/keymaps/default/keymap.c b/keyboards/handwired/atreus50/keymaps/default/keymap.c index cbcc5fc6f8..c9de095cf8 100644 --- a/keyboards/handwired/atreus50/keymaps/default/keymap.c +++ b/keyboards/handwired/atreus50/keymaps/default/keymap.c @@ -94,20 +94,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {NOTE_B5, 20}, - {NOTE_B6, 8}, - {NOTE_DS6, 20}, - {NOTE_B6, 8} -}; +// float tone_startup[][2] = { +// {NOTE_B5, 20}, +// {NOTE_B6, 8}, +// {NOTE_DS6, 20}, +// {NOTE_B6, 8} +// }; float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif void persistent_default_layer_set(uint16_t default_layer) { @@ -178,36 +175,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; }; - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/handwired/ortho5x13/keymaps/default/keymap.c b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c index ef975a215d..d725397199 100644 --- a/keyboards/handwired/ortho5x13/keymaps/default/keymap.c +++ b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c @@ -163,20 +163,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {NOTE_B5, 20}, - {NOTE_B6, 8}, - {NOTE_DS6, 20}, - {NOTE_B6, 8} -}; +// float tone_startup[][2] = { +// {NOTE_B5, 20}, +// {NOTE_B6, 8}, +// {NOTE_DS6, 20}, +// {NOTE_B6, 8} +// }; float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif void persistent_default_layer_set(uint16_t default_layer) { @@ -247,36 +243,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; }; - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/helix/pico/keymaps/default/keymap.c b/keyboards/helix/pico/keymaps/default/keymap.c index 101a54bda6..3ee620360d 100644 --- a/keyboards/helix/pico/keymaps/default/keymap.c +++ b/keyboards/helix/pico/keymaps/default/keymap.c @@ -173,7 +173,6 @@ float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif // define variables for reactive RGB @@ -329,36 +328,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_config.mode; #endif } - - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(50); // gets rid of tick -} - -void shutdown_user(void) -{ - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/helix/pico/keymaps/mtei/keymap.c b/keyboards/helix/pico/keymaps/mtei/keymap.c index 6a5f7d295a..9bf479df6f 100644 --- a/keyboards/helix/pico/keymaps/mtei/keymap.c +++ b/keyboards/helix/pico/keymaps/mtei/keymap.c @@ -237,7 +237,6 @@ float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif static int current_default_layer; @@ -334,35 +333,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(50); // gets rid of tick -} - -void shutdown_user(void) -{ - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/helix/rev2/keymaps/default/keymap.c b/keyboards/helix/rev2/keymaps/default/keymap.c index b777d35d45..f23ff07b4f 100644 --- a/keyboards/helix/rev2/keymaps/default/keymap.c +++ b/keyboards/helix/rev2/keymaps/default/keymap.c @@ -185,7 +185,6 @@ float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif // define variables for reactive RGB @@ -341,36 +340,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_get_mode(); #endif } - - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick -} - -void shutdown_user(void) -{ - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/helix/rev2/keymaps/froggy/keymap.c b/keyboards/helix/rev2/keymaps/froggy/keymap.c index dc047d3118..1680147157 100644 --- a/keyboards/helix/rev2/keymaps/froggy/keymap.c +++ b/keyboards/helix/rev2/keymaps/froggy/keymap.c @@ -181,7 +181,6 @@ float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif // define variables for reactive RGB @@ -440,41 +439,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { //keyboard start-up code. Runs once when the firmware starts up. void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_get_mode(); #endif } -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick -} - -void shutdown_user(void) -{ - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif - - //assign the right code to your layers for OLED display #define L_BASE 0 #define L_OPT 2 diff --git a/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c b/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c index 20fa181d77..6c060aadec 100644 --- a/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c +++ b/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c @@ -171,7 +171,6 @@ float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif // define variables for reactive RGB @@ -322,40 +321,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_get_mode(); #endif } - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick -} - -void shutdown_user(void) -{ - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif - #ifdef OLED_ENABLE oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (is_keyboard_master()) { diff --git a/keyboards/matrix/abelx/abelx.c b/keyboards/matrix/abelx/abelx.c index ea3e57aeaf..a05934238a 100644 --- a/keyboards/matrix/abelx/abelx.c +++ b/keyboards/matrix/abelx/abelx.c @@ -92,13 +92,8 @@ bool led_update_kb(led_t led_state) { } #define REBOOT_MAGIC 0x41544B42 -void shutdown_user(void) -{ - // set the magic number for resetting to the bootloader - *(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC; -} void bootloader_jump(void) { - shutdown_user(); + *(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC; NVIC_SystemReset(); } diff --git a/keyboards/matrix/m20add/m20add.c b/keyboards/matrix/m20add/m20add.c index cdcafb9779..ac483e8aab 100644 --- a/keyboards/matrix/m20add/m20add.c +++ b/keyboards/matrix/m20add/m20add.c @@ -54,13 +54,9 @@ bool led_update_kb(led_t led_state) { } #define REBOOT_MAGIC 0x41544B42 -void shutdown_user(void) -{ - // set the magic number for resetting to the bootloader - *(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC; -} void bootloader_jump(void) { - shutdown_user(); + // set the magic number for resetting to the bootloader + *(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC; NVIC_SystemReset(); } diff --git a/keyboards/neopad/rev1/rev1.c b/keyboards/neopad/rev1/rev1.c index 86e47c8932..c8216f4e70 100755 --- a/keyboards/neopad/rev1/rev1.c +++ b/keyboards/neopad/rev1/rev1.c @@ -22,10 +22,14 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void shutdown_user(void) { +bool shutdown_kb(bool jump_to_bootloader) { + if (!shutdown_user(jump_to_bootloader)) { + return false; + } // Shutdown LEDs writePinLow(LED_00); writePinLow(LED_01); + return true; } layer_state_t layer_state_set_kb(layer_state_t state) { diff --git a/keyboards/omkbd/ergodash/rev1/rev1.c b/keyboards/omkbd/ergodash/rev1/rev1.c deleted file mode 100644 index 35a313f6fd..0000000000 --- a/keyboards/omkbd/ergodash/rev1/rev1.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "quantum.h" - -#ifdef AUDIO_ENABLE - float tone_startup[][2] = SONG(STARTUP_SOUND); - float tone_goodbye[][2] = SONG(GOODBYE_SOUND); -#endif - -void matrix_init_kb(void) { - - #ifdef AUDIO_ENABLE - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); - #endif - - // // green led on - // DDRD |= (1<<5); - // PORTD &= ~(1<<5); - - // // orange led on - // DDRB |= (1<<0); - // PORTB &= ~(1<<0); - - matrix_init_user(); -}; - -void shutdown_user(void) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); - #endif -} diff --git a/keyboards/planck/keymaps/altgr/common/init.h b/keyboards/planck/keymaps/altgr/common/init.h index 6d0b4392fb..e6bb7101e9 100644 --- a/keyboards/planck/keymaps/altgr/common/init.h +++ b/keyboards/planck/keymaps/altgr/common/init.h @@ -6,9 +6,6 @@ void matrix_init_user(void) #ifdef STENO_ENABLE steno_set_mode(STENO_MODE_BOLT); // or STENO_MODE_GEMINI #endif -#ifdef AUDIO_ENABLE - startup_user(); -#endif } #ifdef AUDIO_ENABLE @@ -31,27 +28,4 @@ bool led_update_user(led_t led_state) return false; } #endif - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(song_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(song_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} #endif diff --git a/keyboards/planck/keymaps/circuit/keymap.c b/keyboards/planck/keymaps/circuit/keymap.c index d150905dc8..b7d2b121b9 100644 --- a/keyboards/planck/keymaps/circuit/keymap.c +++ b/keyboards/planck/keymaps/circuit/keymap.c @@ -131,7 +131,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL , _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_CAPS, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGUP, KC_ENT , - _______, _______, _______, KC_MUTE, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, KC_HOME, KC_PGDN, KC_END + _______, _______, _______, KC_MUTE, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, KC_HOME, KC_PGDN, KC_END ), /* FUNCTIONS @@ -155,11 +155,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -210,36 +207,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { -#ifdef AUDIO_ENABLE - startup_user(); -#endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/dbroqua/keymap.c b/keyboards/planck/keymaps/dbroqua/keymap.c index 95d0b85408..f7d1575dad 100644 --- a/keyboards/planck/keymaps/dbroqua/keymap.c +++ b/keyboards/planck/keymaps/dbroqua/keymap.c @@ -120,16 +120,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -183,36 +178,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/dr_notsokind/keymap.c b/keyboards/planck/keymaps/dr_notsokind/keymap.c index ffceef11cc..f4fb3e0074 100644 --- a/keyboards/planck/keymaps/dr_notsokind/keymap.c +++ b/keyboards/planck/keymaps/dr_notsokind/keymap.c @@ -127,7 +127,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_GRV , KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, KC_DEL , KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_LSFT, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, _______, KC_NUHS, KC_NUBS, XXXXXXX, KC_PGUP, KC_ENT, - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END ), /* LOWER @@ -145,7 +145,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL , KC_DEL , KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LSFT, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, S(KC_NUHS), S(KC_NUBS), XXXXXXX, KC_PGUP, KC_ENT , - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END ), /* MEDIA AND COMMANDS @@ -163,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, XXXXXXX, KC_WHOM, XXXXXXX, XXXXXXX, XXXXXXX, KC_AGAIN, XXXXXXX, KC_INS, XXXXXXX, KC_PSCR, XXXXXXX, XXXXXXX, XXXXXXX, KC_WSCH, XXXXXXX, KC_FIND, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DM_PLY1, DM_PLY2, KC_LSFT, XXXXXXX, XXXXXXX, KC_CALC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, ZOOM_OUT, ZOOM_IN, KC_MPRV, DM_RSTP, - ONESHOT, XXXXXXX, XXXXXXX, _______, KC_VOLD, KC_MUTE, KC_MUTE, KC_VOLU, ZOOM_NML, KC_MSTP, KC_MNXT, KC_MPLY + ONESHOT, XXXXXXX, XXXXXXX, _______, KC_VOLD, KC_MUTE, KC_MUTE, KC_VOLU, ZOOM_NML, KC_MSTP, KC_MNXT, KC_MPLY ), /* ONESHOT @@ -205,14 +205,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_numpad[][2] = SONG(NUM_LOCK_ON_SOUND); float tone_oneshot[][2] = SONG(TERMINAL_SOUND); float tone_dyn_macro_rec[][2] = SONG(SONIC_RING); float tone_dyn_macro_stop[][2] = SONG(COIN_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif void press_key(uint16_t key) { @@ -303,36 +300,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { -#ifdef AUDIO_ENABLE - startup_user(); -#endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/emilyh/keymap.c b/keyboards/planck/keymaps/emilyh/keymap.c index 17bbc98b7e..b226c1f6e7 100644 --- a/keyboards/planck/keymaps/emilyh/keymap.c +++ b/keyboards/planck/keymaps/emilyh/keymap.c @@ -164,16 +164,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -273,36 +268,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/experimental/keymap.c b/keyboards/planck/keymaps/experimental/keymap.c index 6d6752952b..deaf5afb4d 100644 --- a/keyboards/planck/keymaps/experimental/keymap.c +++ b/keyboards/planck/keymaps/experimental/keymap.c @@ -176,16 +176,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -339,38 +334,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif - void leader_end_user(void) { if (leader_sequence_one_key(KC_R)) { tap_random_base64(); diff --git a/keyboards/planck/keymaps/gunp/keymap.c b/keyboards/planck/keymaps/gunp/keymap.c index 7c2f6c0bd5..9fa05d593a 100644 --- a/keyboards/planck/keymaps/gunp/keymap.c +++ b/keyboards/planck/keymaps/gunp/keymap.c @@ -282,26 +282,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; } #endif - -#ifdef AUDIO_ENABLE - float tone_startup[][2] = SONG(STARTUP_SOUND); - float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - - float tone_ly_normal[][2] = SONG(QWERTY_SOUND); - float tone_ly_spacial[][2] = SONG(DVORAK_SOUND); - - float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); -#endif - -void startup_user(void) { -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_startup); -#endif -} - -void shutdown_user(void) { -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_goodbye); - stop_all_notes(); -#endif -} diff --git a/keyboards/planck/keymaps/handwired_binaryplease/keymap.c b/keyboards/planck/keymaps/handwired_binaryplease/keymap.c index 13917e516d..93e6f9b78e 100644 --- a/keyboards/planck/keymaps/handwired_binaryplease/keymap.c +++ b/keyboards/planck/keymaps/handwired_binaryplease/keymap.c @@ -163,15 +163,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #ifdef AUDIO_ENABLE -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -271,36 +267,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/hiea/common/init.h b/keyboards/planck/keymaps/hiea/common/init.h index 6d0b4392fb..e6bb7101e9 100644 --- a/keyboards/planck/keymaps/hiea/common/init.h +++ b/keyboards/planck/keymaps/hiea/common/init.h @@ -6,9 +6,6 @@ void matrix_init_user(void) #ifdef STENO_ENABLE steno_set_mode(STENO_MODE_BOLT); // or STENO_MODE_GEMINI #endif -#ifdef AUDIO_ENABLE - startup_user(); -#endif } #ifdef AUDIO_ENABLE @@ -31,27 +28,4 @@ bool led_update_user(led_t led_state) return false; } #endif - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(song_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(song_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} #endif diff --git a/keyboards/planck/keymaps/hieax/common/init.h b/keyboards/planck/keymaps/hieax/common/init.h index 6d0b4392fb..d009bd69a1 100644 --- a/keyboards/planck/keymaps/hieax/common/init.h +++ b/keyboards/planck/keymaps/hieax/common/init.h @@ -6,9 +6,6 @@ void matrix_init_user(void) #ifdef STENO_ENABLE steno_set_mode(STENO_MODE_BOLT); // or STENO_MODE_GEMINI #endif -#ifdef AUDIO_ENABLE - startup_user(); -#endif } #ifdef AUDIO_ENABLE @@ -32,26 +29,4 @@ bool led_update_user(led_t led_state) } #endif -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(song_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(song_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} #endif diff --git a/keyboards/planck/keymaps/impossible/keymap.c b/keyboards/planck/keymaps/impossible/keymap.c index 9145ad79aa..8aa3eb149f 100644 --- a/keyboards/planck/keymaps/impossible/keymap.c +++ b/keyboards/planck/keymaps/impossible/keymap.c @@ -140,16 +140,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - float tone_workman[][2] = SONG(QWERTY_SOUND); float tone_qwerty[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - #endif @@ -196,36 +189,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/ishtob/keymap.c b/keyboards/planck/keymaps/ishtob/keymap.c index 75c581de19..5ec3115830 100644 --- a/keyboards/planck/keymaps/ishtob/keymap.c +++ b/keyboards/planck/keymaps/ishtob/keymap.c @@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, LT_RAI(KC_MINS), KC_ESC, KC_CAPS, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, TG_NUMLAY, KC_APP, KC_DEL ), - + /* Colemak * ,-----------------------------------------------------------------------------------. * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, _________________COLEMAK_L3________________, _________________COLEMAK_R3________________, LT_RAI(KC_MINS), KC_ESC, KC_CAPS, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, TG_NUMLAY, KC_APP, KC_DEL ), - + /* Dvorak * ,-----------------------------------------------------------------------------------. * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | @@ -59,7 +59,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, _________________DVORAK_L3_________________, _________________DVORAK_R3_________________, LT_RAI(KC_MINS), KC_ESC, KC_CAPS, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, TG_NUMLAY, KC_APP, KC_DEL ), - + /* Lower * ,-----------------------------------------------------------------------------------. * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | @@ -77,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, __________________LONG_FUNC_RIGHT__________________,S(KC_NUHS),S(KC_NUBS),KC_LCBR, KC_RCBR, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), - + /* Raise * ,-----------------------------------------------------------------------------------. * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | * | \ | @@ -95,7 +95,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_LEFT, KC_DOWN, KC_RIGHT,KC_MUTE, KC_VOLD, KC_1, KC_2, KC_3, KC_UP, KC_SLSH, _______, _______, _______, _______, _______, _______, KC_SPC, KC_0, _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NUM ), - + /* Plover layer (http://opensteno.org) * ,-----------------------------------------------------------------------------------. * | # | # | # | # | # | # | # | # | # | # | # | # | @@ -107,14 +107,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Exit | | | A | O | | E | U | | | | * `-----------------------------------------------------------------------------------' */ - + [_PLOVER] = LAYOUT_ortho_4x12_wrapper( KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 , XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX ), - + /* FN layer on Esc key * ,-----------------------------------------------------------------------------------. * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | + | @@ -132,7 +132,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, __________________LONG_FUNC_RIGHT__________________,S(KC_NUHS),S(KC_NUBS),KC_LCBR, KC_RCBR, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), - + /* Num Layer * ,-----------------------------------------------------------------------------------. * | | Q | Up | 4 | | | 7 | 8 | 9 | - | + | Bksp | @@ -150,7 +150,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_Z, KC_X, KC_C, KC_V, XXXXXXX, KC_P1, KC_P2, KC_P3, KC_PDOT, KC_PSLS, _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, _______, _______, KC_NUM, KC_MPLY ), - + /* Mouse Layer (semi-col) * ,-----------------------------------------------------------------------------------. * | ACCL0| ACCL1| ACCL2|Email |Email2| Home | Wh_Up| WHL_L| M_Up | WHL_R|PASS| Meta | @@ -162,14 +162,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | BTN1 | | | | Citx | | * `-----------------------------------------------------------------------------------' */ - + [_MOUSECURSOR] = LAYOUT_ortho_4x12_wrapper( KC_ACL0, KC_ACL1, KC_ACL2, M_EMAIL,M_EMAIL2, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R, P_MPASS, P_META, _______, XXXXXXX, XXXXXXX, XXXXXXX, O_RTQ6H, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, O_DAYRN, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, P_CITRIX, O_AUTODC ), - + /* Adjust (Lower + Raise) * ,-----------------------------------------------------------------------------------. * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | Del | @@ -187,21 +187,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, AU_PREV, AU_NEXT, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, BL_DOWN,BL_UP, BL_STEP, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, CK_RST, CK_DOWN, CK_UP, CK_TOGG ) - + }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -307,38 +302,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { } void matrix_init_keymap(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ #ifdef RGB_MATRIX_ENABLE rgblight_mode(RGB_MATRIX_CYCLE_ALL); #endif //RGB_matrix - wait_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); } - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - wait_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif - diff --git a/keyboards/planck/keymaps/jhenahan/keymap.c b/keyboards/planck/keymaps/jhenahan/keymap.c index 21c489922d..c884e864ac 100644 --- a/keyboards/planck/keymaps/jhenahan/keymap.c +++ b/keyboards/planck/keymaps/jhenahan/keymap.c @@ -160,15 +160,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_workman[][2] = SONG(WORKMAN_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -268,36 +263,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/lae3/keymap.c b/keyboards/planck/keymaps/lae3/keymap.c index 7b6175d543..86c89a30a4 100644 --- a/keyboards/planck/keymaps/lae3/keymap.c +++ b/keyboards/planck/keymaps/lae3/keymap.c @@ -168,17 +168,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -#ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -#endif - -bool process_record_user(uint16_t keycode, keyrecord_t *record) -{ +bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case LOWER: if (record->event.pressed) { @@ -217,37 +207,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) } return true; } - -void matrix_init_user(void) -{ -#ifdef AUDIO_ENABLE - startup_user(); -#endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(100); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/mjt/keymap.c b/keyboards/planck/keymaps/mjt/keymap.c index e927627e1f..7ab0fff241 100644 --- a/keyboards/planck/keymaps/mjt/keymap.c +++ b/keyboards/planck/keymaps/mjt/keymap.c @@ -133,16 +133,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dyn_macro_rec[][2] = SONG(DVORAK_SOUND); float tone_dyn_macro_play[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif void persistant_default_layer_set(uint16_t default_layer) { @@ -239,36 +234,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/mjtnumsym/keymap.c b/keyboards/planck/keymaps/mjtnumsym/keymap.c index 3fa05ad178..4eaafb75d6 100644 --- a/keyboards/planck/keymaps/mjtnumsym/keymap.c +++ b/keyboards/planck/keymaps/mjtnumsym/keymap.c @@ -132,16 +132,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dyn_macro_rec[][2] = SONG(DVORAK_SOUND); float tone_dyn_macro_play[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif void persistant_default_layer_set(uint16_t default_layer) { @@ -238,36 +233,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/originerd/keymap.c b/keyboards/planck/keymaps/originerd/keymap.c index 85e5cd3b16..d7c9ffb6b5 100644 --- a/keyboards/planck/keymaps/originerd/keymap.c +++ b/keyboards/planck/keymaps/originerd/keymap.c @@ -101,12 +101,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_nerd[][2] = SONG(QWERTY_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -149,36 +144,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/premek/keymap.c b/keyboards/planck/keymaps/premek/keymap.c index 76d3cabfbc..839a53a6fc 100644 --- a/keyboards/planck/keymaps/premek/keymap.c +++ b/keyboards/planck/keymaps/premek/keymap.c @@ -76,16 +76,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -185,36 +180,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/roguepullrequest/keymap.c b/keyboards/planck/keymaps/roguepullrequest/keymap.c index 61221601e6..31cce52a5f 100644 --- a/keyboards/planck/keymaps/roguepullrequest/keymap.c +++ b/keyboards/planck/keymaps/roguepullrequest/keymap.c @@ -28,7 +28,7 @@ enum { RSHIFT, LSHIFT, TD_S, - SLASH + SLASH }; int cur_dance (tap_dance_state_t *state); @@ -116,10 +116,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TD(LSHIFT), KC_QUOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, TD(RSHIFT), TD(X_AT_FUN), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, ALT_TAB, KC_SPACE, KC_ENTER, MT(MOD_LCTL | MOD_LSFT, KC_LGUI), KC_PGUP, KC_PGDN, LT(_LOWER, KC_PLUS) ), - + [_UPPER] = LAYOUT_planck_grid( KC_GRAVE, KC_AMPR, KC_PERC, KC_NO, KC_NO, KC_EQL, KC_ASTR, KC_NO, KC_NO, KC_EXLM, KC_HASH, KC_TRNS, - KC_PLUS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLS, + KC_PLUS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS ), @@ -156,7 +156,7 @@ int cur_dance (tap_dance_state_t *state) { if (state->interrupted || !state->pressed)return TRIPLE_TAP; else return TRIPLE_HOLD; } - else return 8; // magic number that i dont believe works. + else return 8; // magic number that i dont believe works. } // instance of tap for the 'X' dance. @@ -251,4 +251,7 @@ tap_dance_action_t tap_dance_actions[] = { }; -void shutdown_user(void) { clear_keyboard(); } +bool shutdown_user(bool jump_to_bootloader) { + clear_keyboard(); + return true; +} diff --git a/keyboards/planck/keymaps/sdothum/common/init.h b/keyboards/planck/keymaps/sdothum/common/init.h index 6d0b4392fb..e6bb7101e9 100644 --- a/keyboards/planck/keymaps/sdothum/common/init.h +++ b/keyboards/planck/keymaps/sdothum/common/init.h @@ -6,9 +6,6 @@ void matrix_init_user(void) #ifdef STENO_ENABLE steno_set_mode(STENO_MODE_BOLT); // or STENO_MODE_GEMINI #endif -#ifdef AUDIO_ENABLE - startup_user(); -#endif } #ifdef AUDIO_ENABLE @@ -31,27 +28,4 @@ bool led_update_user(led_t led_state) return false; } #endif - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(song_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(song_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} #endif diff --git a/keyboards/planck/keymaps/sgoodwin/keymap.c b/keyboards/planck/keymaps/sgoodwin/keymap.c index e61cd4de68..fbfe793cb8 100644 --- a/keyboards/planck/keymaps/sgoodwin/keymap.c +++ b/keyboards/planck/keymaps/sgoodwin/keymap.c @@ -120,13 +120,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -189,36 +184,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/smt/keymap.c b/keyboards/planck/keymaps/smt/keymap.c index 6320e11fcf..7d558e4383 100644 --- a/keyboards/planck/keymaps/smt/keymap.c +++ b/keyboards/planck/keymaps/smt/keymap.c @@ -142,14 +142,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -221,36 +216,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/that_canadian/keymap.c b/keyboards/planck/keymaps/that_canadian/keymap.c index 9f3a415fa3..d7b8a6b356 100644 --- a/keyboards/planck/keymaps/that_canadian/keymap.c +++ b/keyboards/planck/keymaps/that_canadian/keymap.c @@ -123,14 +123,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -173,36 +168,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/vaire/keymap.c b/keyboards/planck/keymaps/vaire/keymap.c index f58486cda8..00b49e52d7 100644 --- a/keyboards/planck/keymaps/vaire/keymap.c +++ b/keyboards/planck/keymaps/vaire/keymap.c @@ -31,42 +31,42 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_planck_grid( - KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, SFT_T(KC_ENT), + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, SFT_T(KC_ENT), MO(1), KC_LCTL, KC_LALT, KC_LGUI, MO(2), LT(5,KC_ENT), LT(4,KC_SPC), MO(3), KC_SLSH, KC_LEFT, KC_DOWN, CTL_T(KC_RGHT)), LAYOUT_planck_grid( - KC_ESC, KC_NUM, LCTL(KC_SPC), KC_UP, LSFT(KC_SPC), KC_DLR, KC_EQL, KC_P7, KC_P8, KC_P9, KC_PPLS, LCTL(KC_BSPC), - KC_TAB, FIND, KC_LEFT, KC_DOWN, KC_RGHT, KC_PERC, KC_CIRC, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_BSLS, - KC_LSFT, UNDO, CUT, COPY, PASTE, EXCEL_HOME, KC_PSCR, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_LSFT, + KC_ESC, KC_NUM, LCTL(KC_SPC), KC_UP, LSFT(KC_SPC), KC_DLR, KC_EQL, KC_P7, KC_P8, KC_P9, KC_PPLS, LCTL(KC_BSPC), + KC_TAB, FIND, KC_LEFT, KC_DOWN, KC_RGHT, KC_PERC, KC_CIRC, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_BSLS, + KC_LSFT, UNDO, CUT, COPY, PASTE, EXCEL_HOME, KC_PSCR, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_LSFT, KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, TO(1), KC_ENT, KC_SPC, KC_PENT, KC_P0, KC_PDOT, KC_PAST, KC_LCTL), LAYOUT_planck_grid( - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, - KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LT, KC_GT, KC_LPRN, - KC_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_MPLY, KC_MNXT, KC_PGUP, SFT_T(KC_VOLU), + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, + KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LT, KC_GT, KC_LPRN, + KC_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_MPLY, KC_MNXT, KC_PGUP, SFT_T(KC_VOLU), TO(0), KC_LCTL, KC_LALT, KC_LGUI, KC_TRNS, KC_ENT, KC_SPC, MO(3), KC_PSCR, KC_MPRV, KC_PGDN, CTL_T(KC_VOLD)), LAYOUT_planck_grid( - KC_TILD, DESK_LEFT, WIN_LEFT, KC_F4, WIN_RIGHT, DESK_RIGHT, DOCS, SNAP_LEFT, SNAP_UP, SNAP_RIGHT, SNAP_DOWN, KC_DEL, - KC_CAPS, KC_QUOT, KC_LBRC, KC_LCBR, KC_LPRN, KC_BSLS, KC_SLSH, KC_RPRN, KC_RCBR, KC_RBRC, KC_DQUO, KC_QUOT, - KC_PWR, KC_SLEP, KC_WAKE, KC_HOME, BL_BRTG, BL_STEP, KC_TRNS, KC_CALC, KC_LT, KC_GT, KC_COLON, KC_LSFT, + KC_TILD, DESK_LEFT, WIN_LEFT, KC_F4, WIN_RIGHT, DESK_RIGHT, DOCS, SNAP_LEFT, SNAP_UP, SNAP_RIGHT, SNAP_DOWN, KC_DEL, + KC_CAPS, KC_QUOT, KC_LBRC, KC_LCBR, KC_LPRN, KC_BSLS, KC_SLSH, KC_RPRN, KC_RCBR, KC_RBRC, KC_DQUO, KC_QUOT, + KC_PWR, KC_SLEP, KC_WAKE, KC_HOME, BL_BRTG, BL_STEP, KC_TRNS, KC_CALC, KC_LT, KC_GT, KC_COLON, KC_LSFT, TO(0), KC_LCTL, KC_LALT, KC_LGUI, KC_LALT, KC_LCTL, KC_TRNS, KC_TRNS, AU_TOGG, MU_TOGG, MU_NEXT, LCTL(KC_RGHT)), LAYOUT_planck_grid( - TO(0), KC_LSCR, WIN_LEFT, KC_MS_WH_UP, WIN_RIGHT, KC_TRNS, KC_TRNS, KC_MS_BTN1, KC_MS_U, KC_MS_BTN2, KC_TRNS, KC_TRNS, - KC_TRNS, KC_INS, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_RIGHT, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, - QK_BOOT, KC_APP, KC_MS_ACCEL0, KC_MS_ACCEL0, KC_MS_ACCEL0, KC_TRNS, KC_TRNS, TO(0), TO(1), TO(2), TO(3), TO(4), + TO(0), KC_LSCR, WIN_LEFT, KC_MS_WH_UP, WIN_RIGHT, KC_TRNS, KC_TRNS, KC_MS_BTN1, KC_MS_U, KC_MS_BTN2, KC_TRNS, KC_TRNS, + KC_TRNS, KC_INS, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_RIGHT, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, + QK_BOOT, KC_APP, KC_MS_ACCEL0, KC_MS_ACCEL0, KC_MS_ACCEL0, KC_TRNS, KC_TRNS, TO(0), TO(1), TO(2), TO(3), TO(4), TO(0), KC_MENU, KC_TRNS, KC_TRNS, KC_LALT, KC_LCTL, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RCTL), LAYOUT_planck_grid( - KC_BSPC, KC_P, KC_O, KC_I, KC_U, KC_Y, KC_T, KC_R, KC_E, KC_W, KC_Q, KC_BSPC, - KC_TAB, KC_SCLN, KC_L, KC_K, KC_J, KC_H, KC_G, KC_F, KC_D, KC_S, KC_A, KC_QUOT, - KC_LSFT, KC_ENT, KC_DOT, KC_COMM, KC_M, KC_N, KC_B, KC_V, KC_C, KC_X, KC_Z, SFT_T(KC_ENT), + KC_BSPC, KC_P, KC_O, KC_I, KC_U, KC_Y, KC_T, KC_R, KC_E, KC_W, KC_Q, KC_BSPC, + KC_TAB, KC_SCLN, KC_L, KC_K, KC_J, KC_H, KC_G, KC_F, KC_D, KC_S, KC_A, KC_QUOT, + KC_LSFT, KC_ENT, KC_DOT, KC_COMM, KC_M, KC_N, KC_B, KC_V, KC_C, KC_X, KC_Z, SFT_T(KC_ENT), TO(0), KC_LCTL, KC_LALT, KC_LGUI, MO(2), KC_TRNS, KC_TRNS, MO(3), KC_SLSH, KC_LEFT, KC_DOWN, LCTL(KC_RGHT)), - - + + }; @@ -76,7 +76,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void matrix_init_user(void) { set_voice(default_voice); - startup_user(); println("Matrix Init"); } @@ -123,29 +122,4 @@ bool led_update_user(led_t led_state) old_led_state = led_state; return false; } - - -void startup_user(void) -{ - _delay_ms(30); // gets rid of tick - PLAY_SONG(tone_my_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_my_goodbye); - _delay_ms(3000); - stop_all_notes(); -} - -void audio_on_user(void) -{ - PLAY_SONG(tone_audio_on); -} - -void music_on_user(void) -{ - PLAY_SONG(tone_music_on); -} - -#endif /* AUDIO_ENABLE */ \ No newline at end of file +#endif /* AUDIO_ENABLE */ diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c index ae5f44e713..e17e31c7b5 100644 --- a/keyboards/planck/keymaps/zach/zach_common_functions.c +++ b/keyboards/planck/keymaps/zach/zach_common_functions.c @@ -52,8 +52,6 @@ enum my_keycodes{ #ifdef AUDIO_ENABLE #include "audio.h" -float tone_startup[][2] = SONG(STARTUP_SOUND); -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_swcole[][2] = SONG(QWERTY_SOUND); float tone_capslock_on[][2] = SONG(CAPS_LOCK_ON_SOUND); @@ -414,32 +412,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -void matrix_init_user(void){ // Run once at startup - #ifdef AUDIO_ENABLE - _delay_ms(50); // gets rid of tick - PLAY_SONG(tone_startup); - #endif -} - -#ifdef AUDIO_ENABLE -void play_goodbye_tone(void){ - PLAY_SONG(tone_goodbye); - _delay_ms(150); -} - -void shutdown_user(void){ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void){ // Run when the music layer is turned on - PLAY_SONG(tone_startup); -} - -void music_off_user(void){ // Run when music is turned off - PLAY_SONG(tone_goodbye); -} -#endif - #endif diff --git a/keyboards/preonic/keymaps/0xdec/keymap.c b/keyboards/preonic/keymaps/0xdec/keymap.c index fafa5c4460..fad47842a5 100644 --- a/keyboards/preonic/keymaps/0xdec/keymap.c +++ b/keyboards/preonic/keymaps/0xdec/keymap.c @@ -81,13 +81,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #ifdef AUDIO_ENABLE - -float tone_startup[][2] = { - {NOTE_B5, 20}, - {NOTE_B6, 8}, - {NOTE_DS6, 20}, - {NOTE_B6, 8} -}; float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_game[][2] = { {NOTE_E6, 10} ,{NOTE_E6, 10} ,{NOTE_REST, 10} ,{NOTE_E6, 10} , @@ -95,26 +88,6 @@ float tone_game[][2] = { {NOTE_G6, 10} ,{NOTE_REST, 30}, {NOTE_G5, 10} ,{NOTE_REST, 30} }; -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); - -void startup_user(void) { - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} -void shutdown_user(void) { - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) { - music_scale_user(); -} -void music_scale_user(void) { - PLAY_SONG(music_scale); -} - #endif diff --git a/keyboards/preonic/keymaps/bucktooth/keymap.c b/keyboards/preonic/keymaps/bucktooth/keymap.c index 593083f201..09602a1673 100644 --- a/keyboards/preonic/keymaps/bucktooth/keymap.c +++ b/keyboards/preonic/keymaps/bucktooth/keymap.c @@ -69,47 +69,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; - -#ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {NOTE_C5, 8}, - {NOTE_E6, 4}, - {NOTE_D6, 16}, - {NOTE_G6, 8} -}; - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); -#endif - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/preonic/keymaps/jacwib/keymap.c b/keyboards/preonic/keymaps/jacwib/keymap.c index 9de460c2a4..694c44b3c7 100644 --- a/keyboards/preonic/keymaps/jacwib/keymap.c +++ b/keyboards/preonic/keymaps/jacwib/keymap.c @@ -174,19 +174,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -#ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {NOTE_D5, 8}, - {NOTE_E6, 8}, - {NOTE_D6, 8}, - {NOTE_E5, 8} -}; - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); -#endif - void persistent_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); @@ -249,36 +236,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; }; - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/preonic/keymaps/nikchi/keymap.c b/keyboards/preonic/keymaps/nikchi/keymap.c index e14f8f0052..50589039b7 100644 --- a/keyboards/preonic/keymaps/nikchi/keymap.c +++ b/keyboards/preonic/keymaps/nikchi/keymap.c @@ -111,20 +111,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {NOTE_B5, 20}, - {NOTE_B6, 8}, - {NOTE_DS6, 20}, - {NOTE_B6, 8} -}; - float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif void persistent_default_layer_set(uint16_t default_layer) { @@ -177,36 +166,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; }; - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/preonic/keymaps/smt/keymap.c b/keyboards/preonic/keymaps/smt/keymap.c index 7dd9545261..22f6c39a92 100644 --- a/keyboards/preonic/keymaps/smt/keymap.c +++ b/keyboards/preonic/keymaps/smt/keymap.c @@ -158,20 +158,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {NOTE_B5, 20}, - {NOTE_B6, 8}, - {NOTE_DS6, 20}, - {NOTE_B6, 8} -}; - float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif void persistent_default_layer_set(uint16_t default_layer) { @@ -242,36 +231,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; }; - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/preonic/keymaps/that_canadian/keymap.c b/keyboards/preonic/keymaps/that_canadian/keymap.c index 8af796821c..18b2e046e8 100644 --- a/keyboards/preonic/keymaps/that_canadian/keymap.c +++ b/keyboards/preonic/keymaps/that_canadian/keymap.c @@ -135,20 +135,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {NOTE_B5, 20}, - {NOTE_B6, 8}, - {NOTE_DS6, 20}, - {NOTE_B6, 8} -}; - float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); - -float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif void persistant_default_layer_set(uint16_t default_layer) { @@ -201,36 +190,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; }; - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user(void) -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user(void) -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c index ae5f44e713..ba6c402526 100644 --- a/keyboards/preonic/keymaps/zach/zach_common_functions.c +++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c @@ -52,7 +52,6 @@ enum my_keycodes{ #ifdef AUDIO_ENABLE #include "audio.h" -float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_goodbye[][2] = SONG(GOODBYE_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_swcole[][2] = SONG(QWERTY_SOUND); @@ -414,32 +413,5 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -void matrix_init_user(void){ // Run once at startup - #ifdef AUDIO_ENABLE - _delay_ms(50); // gets rid of tick - PLAY_SONG(tone_startup); - #endif -} - -#ifdef AUDIO_ENABLE -void play_goodbye_tone(void){ - PLAY_SONG(tone_goodbye); - _delay_ms(150); -} - -void shutdown_user(void){ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void){ // Run when the music layer is turned on - PLAY_SONG(tone_startup); -} - -void music_off_user(void){ // Run when music is turned off - PLAY_SONG(tone_goodbye); -} -#endif #endif diff --git a/layouts/community/numpad_5x6/bjohnson/keymap.c b/layouts/community/numpad_5x6/bjohnson/keymap.c index 63b358f226..49713df2c3 100644 --- a/layouts/community/numpad_5x6/bjohnson/keymap.c +++ b/layouts/community/numpad_5x6/bjohnson/keymap.c @@ -44,10 +44,11 @@ bool led_update_user(led_t led_state) { return false; } -void shutdown_user (void) { +bool shutdown_user(bool jump_to_bootloader) { #ifdef RGBLIGHT_ENABLE rgblight_enable_noeeprom(); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); rgblight_setrgb(RGB_RED); #endif // RGBLIGHT_ENABLE + return false; } 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); 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 . */ @@ -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 . */ @@ -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