Skip to content

Commit

Permalink
Enable highpass filter.
Browse files Browse the repository at this point in the history
Highpass filter is enabled in audio mode.
  • Loading branch information
CelliesProjects authored Oct 13, 2021
2 parents 5c6dff7 + e86ab8c commit 197226d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/WM8978.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ uint8_t WM8978::Init(void)
Write_Reg(48, 1 << 8); //R48设置,PGABOOSTR,右通道MIC获得20倍增益
Write_Reg(49, 1 << 1); //R49,TSDEN,开启过热保护
Write_Reg(10, 1 << 3); //R10,SOFTMUTE关闭,128x采样,最佳SNR
Write_Reg(14, 1 << 3); //R14,ADC 128x采样率
Write_Reg(14, 1 << 3 | 1 << 8); //R14,ADC 128x采样率 and enable high pass filter (3.7Hz cut-off)
return 0;
}

Expand Down Expand Up @@ -300,6 +300,16 @@ void WM8978::setNoise(uint8_t enable, uint8_t gain)
Write_Reg(35, regval); //R18,EQ1设置
}

void WM8978::setHPF(uint8_t enable)
{
uint16_t regval;

regval = WM8978::Read_Reg(14);
regval &= ~(1 << 8);
regval |= (enable << 8);
Write_Reg(14, regval); //R14,high pass filter
}


bool WM8978::begin() {
Wire.beginTransmission(WM8978_ADDR);
Expand Down
1 change: 1 addition & 0 deletions src/WM8978.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class WM8978
void setEQ5(uint8_t cfreq, uint8_t gain);
void setNoise(uint8_t enable, uint8_t gain);
void setALC(uint8_t enable, uint8_t maxgain, uint8_t mingain);
void setHPF(uint8_t enable);

private:
uint8_t Init(void);
Expand Down

0 comments on commit 197226d

Please sign in to comment.