Improve and Cleanup Shutdown callbacks (#21060)

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
This commit is contained in:
Drashna Jaelre 2023-11-26 03:59:18 -08:00 committed by GitHub
parent 4601f339e4
commit 3ef06aa732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 277 additions and 1684 deletions

View File

@ -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.

View File

@ -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);
}
```

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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;
}

View File

@ -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
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()) {

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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) {

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -192,16 +192,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
@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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();

View File

@ -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);

View File

@ -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))

View File

@ -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) {}

View File

@ -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

View File

@ -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);

View File

@ -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) {}

View File

@ -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(); }

View File

@ -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) {}

View File

@ -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);

View File

@ -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))

View File

@ -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);

View File

@ -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