mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 12:46:41 +00:00
[Keyboard] Add audio support to Adafruit MacroPad RP2040 (#20353)
This commit is contained in:
parent
a5e68e5f74
commit
2c375e6478
@ -42,9 +42,14 @@
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP13
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
|
||||
|
||||
/* Audio (Unsupported for now)*/
|
||||
// #define AUDIO_PIN GP16
|
||||
// #define SPEAKER_SHUTDOWN GP14
|
||||
/* Audio */
|
||||
#define AUDIO_PIN GP16
|
||||
#define AUDIO_PWM_DRIVER PWMD0
|
||||
#define AUDIO_PWM_CHANNEL RP2040_PWM_CHANNEL_A
|
||||
#define AUDIO_INIT_DELAY
|
||||
#define AUDIO_CLICKY
|
||||
|
||||
#define SPEAKER_SHUTDOWN GP14
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
|
||||
|
@ -26,3 +26,6 @@
|
||||
|
||||
#undef SPI_SELECT_MODE
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
|
||||
|
||||
#undef HAL_USE_PWM
|
||||
#define HAL_USE_PWM TRUE
|
||||
|
@ -18,17 +18,25 @@
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_MUTE,
|
||||
LT(1,KC_MUTE),
|
||||
KC_ENT, KC_0, KC_BSPC,
|
||||
KC_7, KC_8, KC_9,
|
||||
KC_4, KC_5, KC_6,
|
||||
KC_1, KC_2, KC_3
|
||||
)
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
_______,
|
||||
CK_TOGG, AU_TOGG, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______
|
||||
),
|
||||
};
|
||||
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(_______, _______) },
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -111,4 +119,3 @@ bool oled_task_user(void) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_MUTE,
|
||||
LT(1,KC_MUTE),
|
||||
KC_ENT, KC_0, KC_BSPC,
|
||||
KC_7, KC_8, KC_9,
|
||||
KC_4, KC_5, KC_6,
|
||||
@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
_______,
|
||||
_______, _______, _______,
|
||||
CK_TOGG, AU_TOGG, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______
|
||||
@ -135,4 +135,3 @@ bool oled_task_user(void) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -20,3 +20,6 @@
|
||||
|
||||
#undef RP_SPI_USE_SPI1
|
||||
#define RP_SPI_USE_SPI1 TRUE
|
||||
|
||||
#undef RP_PWM_USE_PWM0
|
||||
#define RP_PWM_USE_PWM0 TRUE
|
||||
|
@ -9,8 +9,8 @@ COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
# AUDIO_DRIVER = pwm_software
|
||||
AUDIO_ENABLE = yes # Audio output
|
||||
AUDIO_DRIVER = pwm_hardware
|
||||
ENCODER_ENABLE = yes
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
RGB_MATRIX_DRIVER = WS2812
|
||||
|
Loading…
Reference in New Issue
Block a user