[Keyboard] Add audio support to Adafruit MacroPad RP2040 (#20353)
This commit is contained in:
parent
a5e68e5f74
commit
2c375e6478
7 changed files with 53 additions and 11 deletions
|
@ -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; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue