diff options
| author | Drashna Jaelre <drashna@live.com> | 2023-12-21 19:38:59 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-21 19:38:59 -0800 |
| commit | 29f8fa35cf7a2cb1630f2afb76dcadd2a5e24e4b (patch) | |
| tree | 46c5b108c99651274ef50d72bc05cf160ed25fa3 /platforms | |
| parent | 9069c4540f11dc1d17d0f13920cb1cd2dc8aa9f7 (diff) | |
[Audio] Enable Complementary output for PWM Hardware driver (#22726)
Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'platforms')
| -rw-r--r-- | platforms/chibios/drivers/audio_pwm_hardware.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/platforms/chibios/drivers/audio_pwm_hardware.c b/platforms/chibios/drivers/audio_pwm_hardware.c index 40d891326f..21b5c6892c 100644 --- a/platforms/chibios/drivers/audio_pwm_hardware.c +++ b/platforms/chibios/drivers/audio_pwm_hardware.c | |||
| @@ -22,6 +22,12 @@ | |||
| 22 | # define AUDIO_PWM_COUNTER_FREQUENCY 100000 | 22 | # define AUDIO_PWM_COUNTER_FREQUENCY 100000 |
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| 25 | #ifndef AUDIO_PWM_COMPLEMENTARY_OUTPUT | ||
| 26 | # define AUDIO_PWM_OUTPUT_MODE PWM_OUTPUT_ACTIVE_HIGH | ||
| 27 | #else | ||
| 28 | # define AUDIO_PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH | ||
| 29 | #endif | ||
| 30 | |||
| 25 | extern bool playing_note; | 31 | extern bool playing_note; |
| 26 | extern bool playing_melody; | 32 | extern bool playing_melody; |
| 27 | extern uint8_t note_timbre; | 33 | extern uint8_t note_timbre; |
| @@ -29,7 +35,7 @@ extern uint8_t note_timbre; | |||
| 29 | static PWMConfig pwmCFG = {.frequency = AUDIO_PWM_COUNTER_FREQUENCY, /* PWM clock frequency */ | 35 | static PWMConfig pwmCFG = {.frequency = AUDIO_PWM_COUNTER_FREQUENCY, /* PWM clock frequency */ |
| 30 | .period = 2, | 36 | .period = 2, |
| 31 | .callback = NULL, | 37 | .callback = NULL, |
| 32 | .channels = {[(AUDIO_PWM_CHANNEL - 1)] = {.mode = PWM_OUTPUT_ACTIVE_HIGH, .callback = NULL}}}; | 38 | .channels = {[(AUDIO_PWM_CHANNEL - 1)] = {.mode = AUDIO_PWM_OUTPUT_MODE, .callback = NULL}}}; |
| 33 | 39 | ||
| 34 | static float channel_1_frequency = 0.0f; | 40 | static float channel_1_frequency = 0.0f; |
| 35 | 41 | ||
