[Keyboard] Add audio support to Adafruit MacroPad RP2040 (#20353)
This commit is contained in:
@ -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; }
|
||||
|
Reference in New Issue
Block a user