diff options
Diffstat (limited to 'keyboards/adafruit/macropad/macropad.c')
-rw-r--r-- | keyboards/adafruit/macropad/macropad.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/keyboards/adafruit/macropad/macropad.c b/keyboards/adafruit/macropad/macropad.c index 5cffdc6c97..398d0bbdfd 100644 --- a/keyboards/adafruit/macropad/macropad.c +++ b/keyboards/adafruit/macropad/macropad.c @@ -41,6 +41,31 @@ led_config_t g_led_config = { { #endif +#ifdef AUDIO_ENABLE +void keyboard_pre_init_kb(void) { + // ensure pin is set and enabled pre-audio init + setPinOutput(SPEAKER_SHUTDOWN); + writePinHigh(SPEAKER_SHUTDOWN); + keyboard_pre_init_user(); +} + +void keyboard_post_init_kb(void) { + // set pin based on active status + writePin(SPEAKER_SHUTDOWN, audio_is_on()); + keyboard_post_init_user(); +} + +void audio_on_user(void) { + writePinHigh(SPEAKER_SHUTDOWN); +} + +void audio_off_user(void) { + // needs a delay or it runs right after play note. + wait_ms(200); + writePinLow(SPEAKER_SHUTDOWN); +} +#endif + #ifdef ENCODER_ENABLE bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; } |