diff options
author | Joshua Diamond <josh@windowoffire.com> | 2021-01-31 17:25:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 09:25:55 +1100 |
commit | ae4ee7553abfaa2149fcea04c3cbee20f3b8c7a5 (patch) | |
tree | 8baafbc7332a9ed95e5ff35de3f9ed5f21826f4f /quantum/quantum.c | |
parent | db11a2a1fd7a7ff9c458e8ec9e963a61a1192bf3 (diff) | |
download | qmk_firmware-ae4ee7553abfaa2149fcea04c3cbee20f3b8c7a5.tar.gz qmk_firmware-ae4ee7553abfaa2149fcea04c3cbee20f3b8c7a5.zip |
Stop sounds when suspended (#11553)
* fix stopping audio on suspend vs. startup sound
* trim firmware size
* fix stuck audio on startup (ARM)
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r-- | quantum/quantum.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index 22aa52838..5e0cde8a2 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -656,6 +656,26 @@ void matrix_init_quantum() { | |||
656 | } | 656 | } |
657 | 657 | ||
658 | void matrix_scan_quantum() { | 658 | void matrix_scan_quantum() { |
659 | #if defined(AUDIO_ENABLE) | ||
660 | // There are some tasks that need to be run a little bit | ||
661 | // after keyboard startup, or else they will not work correctly | ||
662 | // because of interaction with the USB device state, which | ||
663 | // may still be in flux... | ||
664 | // | ||
665 | // At the moment the only feature that needs this is the | ||
666 | // startup song. | ||
667 | static bool delayed_tasks_run = false; | ||
668 | static uint16_t delayed_task_timer = 0; | ||
669 | if (!delayed_tasks_run) { | ||
670 | if (!delayed_task_timer) { | ||
671 | delayed_task_timer = timer_read(); | ||
672 | } else if (timer_elapsed(delayed_task_timer) > 300) { | ||
673 | audio_startup(); | ||
674 | delayed_tasks_run = true; | ||
675 | } | ||
676 | } | ||
677 | #endif | ||
678 | |||
659 | #if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE) | 679 | #if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE) |
660 | matrix_scan_music(); | 680 | matrix_scan_music(); |
661 | #endif | 681 | #endif |