Skip to content

Commit dd07363

Browse files
ArcaneNibbledlech
authored andcommitted
pbio/drv/sound/sound_ev3.c: Only turn on amplifier when sound is played
This prevents hearing a pop sound whenever the brick boots up. The amplifier stays on after any sound is played in order to prevent repeated popping noises.
1 parent ea811e1 commit dd07363

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/pbio/drv/sound/sound_ev3.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ void pbdrv_beep_start(uint32_t frequency, uint16_t sample_attenuator) {
4949
return;
5050
}
5151

52+
// Turn speaker amplifier on
53+
// We turn the amplifier on and leave it turned on, because otherwise
54+
// it will generate a popping sound each time it is enabled.
55+
pbdrv_gpio_out_high(&pin_sound_en);
56+
5257
// Clamp the frequency into the supported range
5358
if (frequency < 64) {
5459
frequency = 64;
@@ -132,10 +137,6 @@ void pbdrv_sound_init() {
132137

133138
// Configure IO pin mode
134139
pbdrv_gpio_alt(&pin_audio, SYSCFG_PINMUX3_PINMUX3_7_4_EPWM0B);
135-
// Turn speaker amplifier on
136-
// We turn the amplifier on and leave it turned on, because otherwise
137-
// it will generate a popping sound whenever it is enabled.
138-
pbdrv_gpio_out_high(&pin_sound_en);
139140
}
140141

141142
#endif // PBDRV_CONFIG_SOUND_EV3

0 commit comments

Comments
 (0)