mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 21:22:05 +00:00
Relocate AUDIO_INIT_DELAY
implementation (#25491)
This commit is contained in:
parent
56ad3a5f43
commit
20555f9a33
@ -183,6 +183,25 @@ void audio_init(void) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void audio_task(void) {
|
||||||
|
#ifdef AUDIO_INIT_DELAY
|
||||||
|
// startup song potentially needs to be run a little bit
|
||||||
|
// after keyboard startup, or else they will not work correctly
|
||||||
|
// because of interaction with the USB device state, which
|
||||||
|
// may still be in flux...
|
||||||
|
static bool delayed_tasks_run = false;
|
||||||
|
static uint16_t delayed_task_timer = 0;
|
||||||
|
if (!delayed_tasks_run) {
|
||||||
|
if (!delayed_task_timer) {
|
||||||
|
delayed_task_timer = timer_read();
|
||||||
|
} else if (timer_elapsed(delayed_task_timer) > 300) {
|
||||||
|
audio_startup();
|
||||||
|
delayed_tasks_run = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void audio_startup(void) {
|
void audio_startup(void) {
|
||||||
if (audio_config.enable) {
|
if (audio_config.enable) {
|
||||||
PLAY_SONG(startup_song);
|
PLAY_SONG(startup_song);
|
||||||
|
@ -69,7 +69,11 @@ void eeconfig_update_audio_current(void);
|
|||||||
* @post audio system (and hardware) initialized and ready to play tones
|
* @post audio system (and hardware) initialized and ready to play tones
|
||||||
*/
|
*/
|
||||||
void audio_init(void);
|
void audio_init(void);
|
||||||
void audio_startup(void);
|
|
||||||
|
/**
|
||||||
|
* \brief Handle various subsystem background tasks.
|
||||||
|
*/
|
||||||
|
void audio_task(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief en-/disable audio output, save this choice to the eeprom
|
* @brief en-/disable audio output, save this choice to the eeprom
|
||||||
|
@ -648,24 +648,8 @@ void quantum_task(void) {
|
|||||||
if (!is_keyboard_master()) return;
|
if (!is_keyboard_master()) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AUDIO_ENABLE) && defined(AUDIO_INIT_DELAY)
|
#ifdef AUDIO_ENABLE
|
||||||
// There are some tasks that need to be run a little bit
|
audio_task();
|
||||||
// after keyboard startup, or else they will not work correctly
|
|
||||||
// because of interaction with the USB device state, which
|
|
||||||
// may still be in flux...
|
|
||||||
//
|
|
||||||
// At the moment the only feature that needs this is the
|
|
||||||
// startup song.
|
|
||||||
static bool delayed_tasks_run = false;
|
|
||||||
static uint16_t delayed_task_timer = 0;
|
|
||||||
if (!delayed_tasks_run) {
|
|
||||||
if (!delayed_task_timer) {
|
|
||||||
delayed_task_timer = timer_read();
|
|
||||||
} else if (timer_elapsed(delayed_task_timer) > 300) {
|
|
||||||
audio_startup();
|
|
||||||
delayed_tasks_run = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE)
|
#if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE)
|
||||||
|
Loading…
Reference in New Issue
Block a user