Closed h3ndrik closed 3 years ago
Hi @h3ndrik Thanks for your time and effort.
Could you explain the code to me?
yes: you can find more details in the datasheet under "Selectable High Pass Filter". It has 2 modes: audio and application mode. This is about audio mode.
In audio mode the high pass filter removes any frequencies below 3.7 Hz. Effectively removing any DC offset. To enable this, you need to set HPFEN=1 (and HPFAPP=0). HPFEN is bit 8 of R14
The code
I tried to write it similar to the existing functions.
Motivation: I got a board with an elecret microphone. I had problems and noticed the captured waveform has quite a noticable offset. The high pass filter fixes this.
As frequences at below 3.7 Hz are inaudible, you might as well turn the HPF on by default, for example when writing to R14 the Init function:
Write_Reg(14, 1 << 3 | 1 << 8); //R14,ADC 128x采样率 and high pass filter
I get it. The one-complement operator was a new one for me.
As frequences at below 3.7 Hz are inaudible, you might as well turn the HPF on by default, for example when writing to R14 the Init function: Write_Reg(14, 1 << 3 | 1 << 8); //R14,ADC 128x采样率 and high pass filter
If you could add that to this PR please.
alright. i've added that to the init function. thank you.
Merged. @h3ndrik Thanks!
great. could you please also add a new tag / release a new version, so this will become available on platformio etc? thanks!
Version 1.0.4 is just released and should be picked up by the arduino library bot within 24-48 hours.
adds a function to write to the enable bit of the high pass filter. this is required for some microphone hardware.