diff options
| author | Drashna Jaelre <drashna@live.com> | 2024-03-06 03:02:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-06 22:02:37 +1100 |
| commit | 83e6ddbbb4c8e715bfe419c4d7fc0ae305ea5bd5 (patch) | |
| tree | 28fd4e4bbbb83fc41e3800c5b95369592c6e9942 /platforms/chibios | |
| parent | 045e5c9729f22a8ab8a3f22fe9c0e6b51d1940fe (diff) | |
[Audio] Add support for audio shutdown pin (#22731)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'platforms/chibios')
| -rw-r--r-- | platforms/chibios/drivers/audio_dac_additive.c | 6 | ||||
| -rw-r--r-- | platforms/chibios/drivers/audio_dac_basic.c | 6 | ||||
| -rw-r--r-- | platforms/chibios/drivers/audio_pwm_hardware.c | 6 | ||||
| -rw-r--r-- | platforms/chibios/drivers/audio_pwm_software.c | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/platforms/chibios/drivers/audio_dac_additive.c b/platforms/chibios/drivers/audio_dac_additive.c index d6fde42b68..8e29053301 100644 --- a/platforms/chibios/drivers/audio_dac_additive.c +++ b/platforms/chibios/drivers/audio_dac_additive.c | |||
| @@ -303,7 +303,7 @@ static const DACConfig dac_conf = {.init = AUDIO_DAC_OFF_VALUE, .datamode = DAC_ | |||
| 303 | */ | 303 | */ |
| 304 | static const DACConversionGroup dac_conv_cfg = {.num_channels = 1U, .end_cb = dac_end, .error_cb = dac_error, .trigger = DAC_TRG(0b000)}; | 304 | static const DACConversionGroup dac_conv_cfg = {.num_channels = 1U, .end_cb = dac_end, .error_cb = dac_error, .trigger = DAC_TRG(0b000)}; |
| 305 | 305 | ||
| 306 | void audio_driver_initialize(void) { | 306 | void audio_driver_initialize_impl(void) { |
| 307 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { | 307 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { |
| 308 | palSetLineMode(A4, PAL_MODE_INPUT_ANALOG); | 308 | palSetLineMode(A4, PAL_MODE_INPUT_ANALOG); |
| 309 | dacStart(&DACD1, &dac_conf); | 309 | dacStart(&DACD1, &dac_conf); |
| @@ -350,11 +350,11 @@ void audio_driver_initialize(void) { | |||
| 350 | gptStart(&GPTD6, &gpt6cfg1); | 350 | gptStart(&GPTD6, &gpt6cfg1); |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | void audio_driver_stop(void) { | 353 | void audio_driver_stop_impl(void) { |
| 354 | state = OUTPUT_SHOULD_STOP; | 354 | state = OUTPUT_SHOULD_STOP; |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | void audio_driver_start(void) { | 357 | void audio_driver_start_impl(void) { |
| 358 | gptStartContinuous(&GPTD6, 2U); | 358 | gptStartContinuous(&GPTD6, 2U); |
| 359 | 359 | ||
| 360 | for (uint8_t i = 0; i < AUDIO_MAX_SIMULTANEOUS_TONES; i++) { | 360 | for (uint8_t i = 0; i < AUDIO_MAX_SIMULTANEOUS_TONES; i++) { |
diff --git a/platforms/chibios/drivers/audio_dac_basic.c b/platforms/chibios/drivers/audio_dac_basic.c index 9a3f3fea1f..99b938e610 100644 --- a/platforms/chibios/drivers/audio_dac_basic.c +++ b/platforms/chibios/drivers/audio_dac_basic.c | |||
| @@ -190,7 +190,7 @@ static void gpt_audio_state_cb(GPTDriver *gptp) { | |||
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | void audio_driver_initialize(void) { | 193 | void audio_driver_initialize_impl(void) { |
| 194 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { | 194 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { |
| 195 | palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_ANALOG); | 195 | palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_ANALOG); |
| 196 | dacStart(&DACD1, &dac_conf_ch1); | 196 | dacStart(&DACD1, &dac_conf_ch1); |
| @@ -223,7 +223,7 @@ void audio_driver_initialize(void) { | |||
| 223 | gptStart(&AUDIO_STATE_TIMER, &gptStateUpdateCfg); | 223 | gptStart(&AUDIO_STATE_TIMER, &gptStateUpdateCfg); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | void audio_driver_stop(void) { | 226 | void audio_driver_stop_impl(void) { |
| 227 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { | 227 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { |
| 228 | gptStopTimer(&GPTD6); | 228 | gptStopTimer(&GPTD6); |
| 229 | 229 | ||
| @@ -241,7 +241,7 @@ void audio_driver_stop(void) { | |||
| 241 | gptStopTimer(&AUDIO_STATE_TIMER); | 241 | gptStopTimer(&AUDIO_STATE_TIMER); |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | void audio_driver_start(void) { | 244 | void audio_driver_start_impl(void) { |
| 245 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { | 245 | if ((AUDIO_PIN == A4) || (AUDIO_PIN_ALT == A4)) { |
| 246 | dacStartConversion(&DACD1, &dac_conv_grp_ch1, (dacsample_t *)dac_buffer_1, AUDIO_DAC_BUFFER_SIZE); | 246 | dacStartConversion(&DACD1, &dac_conv_grp_ch1, (dacsample_t *)dac_buffer_1, AUDIO_DAC_BUFFER_SIZE); |
| 247 | } | 247 | } |
diff --git a/platforms/chibios/drivers/audio_pwm_hardware.c b/platforms/chibios/drivers/audio_pwm_hardware.c index 21b5c6892c..1ba7ec13bc 100644 --- a/platforms/chibios/drivers/audio_pwm_hardware.c +++ b/platforms/chibios/drivers/audio_pwm_hardware.c | |||
| @@ -87,7 +87,7 @@ static void audio_callback(virtual_timer_t *vtp, void *p) { | |||
| 87 | chSysUnlockFromISR(); | 87 | chSysUnlockFromISR(); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | void audio_driver_initialize(void) { | 90 | void audio_driver_initialize_impl(void) { |
| 91 | pwmStart(&AUDIO_PWM_DRIVER, &pwmCFG); | 91 | pwmStart(&AUDIO_PWM_DRIVER, &pwmCFG); |
| 92 | 92 | ||
| 93 | // connect the AUDIO_PIN to the PWM hardware | 93 | // connect the AUDIO_PIN to the PWM hardware |
| @@ -100,7 +100,7 @@ void audio_driver_initialize(void) { | |||
| 100 | chVTObjectInit(&audio_vt); | 100 | chVTObjectInit(&audio_vt); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void audio_driver_start(void) { | 103 | void audio_driver_start_impl(void) { |
| 104 | channel_1_stop(); | 104 | channel_1_stop(); |
| 105 | channel_1_start(); | 105 | channel_1_start(); |
| 106 | 106 | ||
| @@ -115,7 +115,7 @@ void audio_driver_start(void) { | |||
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | void audio_driver_stop(void) { | 118 | void audio_driver_stop_impl(void) { |
| 119 | channel_1_stop(); | 119 | channel_1_stop(); |
| 120 | chVTReset(&audio_vt); | 120 | chVTReset(&audio_vt); |
| 121 | } | 121 | } |
diff --git a/platforms/chibios/drivers/audio_pwm_software.c b/platforms/chibios/drivers/audio_pwm_software.c index 663a9eca16..f48323900b 100644 --- a/platforms/chibios/drivers/audio_pwm_software.c +++ b/platforms/chibios/drivers/audio_pwm_software.c | |||
| @@ -121,7 +121,7 @@ GPTConfig gptCFG = { | |||
| 121 | .callback = gpt_callback, | 121 | .callback = gpt_callback, |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | void audio_driver_initialize(void) { | 124 | void audio_driver_initialize_impl(void) { |
| 125 | pwmStart(&AUDIO_PWM_DRIVER, &pwmCFG); | 125 | pwmStart(&AUDIO_PWM_DRIVER, &pwmCFG); |
| 126 | 126 | ||
| 127 | palSetLineMode(AUDIO_PIN, PAL_MODE_OUTPUT_PUSHPULL); | 127 | palSetLineMode(AUDIO_PIN, PAL_MODE_OUTPUT_PUSHPULL); |
| @@ -138,7 +138,7 @@ void audio_driver_initialize(void) { | |||
| 138 | gptStart(&AUDIO_STATE_TIMER, &gptCFG); | 138 | gptStart(&AUDIO_STATE_TIMER, &gptCFG); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | void audio_driver_start(void) { | 141 | void audio_driver_start_impl(void) { |
| 142 | channel_1_stop(); | 142 | channel_1_stop(); |
| 143 | channel_1_start(); | 143 | channel_1_start(); |
| 144 | 144 | ||
| @@ -147,7 +147,7 @@ void audio_driver_start(void) { | |||
| 147 | } | 147 | } |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | void audio_driver_stop(void) { | 150 | void audio_driver_stop_impl(void) { |
| 151 | channel_1_stop(); | 151 | channel_1_stop(); |
| 152 | gptStopTimer(&AUDIO_STATE_TIMER); | 152 | gptStopTimer(&AUDIO_STATE_TIMER); |
| 153 | } | 153 | } |
