📄 lowpassfilter.c
字号:
#include "LowPassFilter.h"
#define McBSP0_DRR2 (*(volatile unsigned int *)0x0020)
#define McBSP0_DRR1 (*(volatile unsigned int *)0x0021)
#define McBSP0_DXR2 (*(volatile unsigned int *)0x0022)
#define McBSP0_DXR1 (*(volatile unsigned int *)0x0023)
/***********************************************************************
** Function Routine
***********************************************************************/
void LowPassFilter(void)
{
/* mix microphone input with the carrier to shift frequency */
pMicPhIn = ((McBSP0_DRR1-130) << 0 )&0xFFFE;
//SInMx = ((long int)(MicPhIn * SCarrier) >> 16);
pSInMx = pMicPhIn;
//McBSP0_DXR1 = McBSP0_DRR1;
//McBSP0_DXR1 &= 0xFFFE;
/* filter the mixed signal with a 2nd order filter */
pSOutTemp1 = pSInMx*pb0;
pSOutTemp2 = pSInMxZ1*pb1;
pSOutTemp3 = pSInMxZ2*pb2;
pSOutTemp4 = pSOutZ1*pa1;
pSOutTemp5 = pSOutZ2*pa2;
pSOutTemp = pSOutTemp1 + pSOutTemp2 +pSOutTemp3 -
pSOutTemp4 - pSOutTemp5;
McBSP0_DXR1 = pSOutTemp >> 12; // scaled signal output
McBSP0_DXR1 &= 0xFFFE;
// update 1st and 2nd order delayed input& output
pSInMxZ2 = pSInMxZ1;
pSInMxZ1 = pSInMx;
pSOutZ2 = pSOutZ1;
pSOutZ1 = pSOutTemp>>16;
// output the secured voice to master AIC10 device in ISR
}
/***********************************************************************
** End of File -- LowPassFilter.c
***********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -