summaryrefslogtreecommitdiff
path: root/platforms/chibios/drivers/audio_dac_basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/chibios/drivers/audio_dac_basic.c')
-rw-r--r--platforms/chibios/drivers/audio_dac_basic.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/platforms/chibios/drivers/audio_dac_basic.c b/platforms/chibios/drivers/audio_dac_basic.c
index fac6513506..64439a1e3c 100644
--- a/platforms/chibios/drivers/audio_dac_basic.c
+++ b/platforms/chibios/drivers/audio_dac_basic.c
@@ -115,13 +115,15 @@ void channel_1_set_frequency(float freq) {
channel_1_frequency = freq;
channel_1_stop();
- if (freq <= 0.0) // a pause/rest has freq=0
+ if (freq <= 0.0) // a pause/rest has freq=0
return;
gpt6cfg1.frequency = 2 * freq * AUDIO_DAC_BUFFER_SIZE;
channel_1_start();
}
-float channel_1_get_frequency(void) { return channel_1_frequency; }
+float channel_1_get_frequency(void) {
+ return channel_1_frequency;
+}
void channel_2_start(void) {
gptStart(&GPTD7, &gpt7cfg1);
@@ -140,13 +142,15 @@ void channel_2_set_frequency(float freq) {
channel_2_frequency = freq;
channel_2_stop();
- if (freq <= 0.0) // a pause/rest has freq=0
+ if (freq <= 0.0) // a pause/rest has freq=0
return;
gpt7cfg1.frequency = 2 * freq * AUDIO_DAC_BUFFER_SIZE;
channel_2_start();
}
-float channel_2_get_frequency(void) { return channel_2_frequency; }
+float channel_2_get_frequency(void) {
+ return channel_2_frequency;
+}
static void gpt_audio_state_cb(GPTDriver *gptp) {
if (audio_update_state()) {
@@ -155,8 +159,8 @@ static void gpt_audio_state_cb(GPTDriver *gptp) {
channel_1_set_frequency(audio_get_processed_frequency(0));
channel_2_set_frequency(audio_get_processed_frequency(0));
-#else // two separate audio outputs/speakers
- // primary speaker on A4, optional secondary on A5
+#else // two separate audio outputs/speakers
+ // primary speaker on A4, optional secondary on A5
if (AUDIO_PIN == A4) {
channel_1_set_frequency(audio_get_processed_frequency(0));
if (AUDIO_PIN_ALT == A5) {