Skip to content

Commit 92eaf0e

Browse files
authored
Merge pull request #948 from facchinm/pdm_dsfdm_gain_fix
PDM: fix setGain() for dfsdm
2 parents a77715f + 2bb5b88 commit 92eaf0e

File tree

1 file changed

+4
-1
lines changed
  • libraries/PDM/src/STM32H747_dfsdm

1 file changed

+4
-1
lines changed

libraries/PDM/src/STM32H747_dfsdm/audio.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,10 @@ int py_audio_init(size_t channels, uint32_t frequency)
391391

392392
void py_audio_gain_set(int gain_db)
393393
{
394-
attenuation = 8 - gain_db;
394+
attenuation = 8 - (gain_db / 3);
395+
if (attenuation < 0) {
396+
attenuation = 0;
397+
}
395398
}
396399

397400
void py_audio_deinit()

0 commit comments

Comments
 (0)