我在process()中使用这个函数进行fir,请问可以吗?我感觉效果不是很好,请问应该怎么做?
void Process_Data(void)
{
fir_fr16(sChannel0LeftIn, sChannel0LeftOut, 48, &stateL0);
fir_fr16(sChannel1LeftIn, sChannel1LeftOut, 48, &stateL1);
fir_fr16(sChannel0RightIn, sChannel0RightOut, 48, &stateR0);
fir_fr16(sChannel1RightIn, sChannel1RightOut, 48, &stateR1);
}
EX_INTERRUPT_HANDLER(Sport0_RX_ISR)
{
// confirm interrupt handling
*pDMA1_IRQ_STATUS = 0x0001;
// copy input data from dma input buffer into variables
sChannel0LeftIn = sRxBuffer1[INTERNAL_ADC_L0];
sChannel0RightIn = sRxBuffer1[INTERNAL_ADC_R0];
sChannel1LeftIn = sRxBuffer1[INTERNAL_ADC_L1];
sChannel1RightIn = sRxBuffer1[INTERNAL_ADC_R1];
// call function that contains user code
Process_Data();
// copy processed data from variables into dma output buffer
sTxBuffer1[INTERNAL_DAC_L0] = sChannel0LeftOut;
sTxBuffer1[INTERNAL_DAC_R0] = sChannel0RightOut;
sTxBuffer1[INTERNAL_DAC_L1] = sChannel1LeftOut;
sTxBuffer1[INTERNAL_DAC_R1] = sChannel1RightOut;
}
// FIR Filter Initialization
void Init_Filter(void)
{
int i;
for (i=0; i<TAPS; i++)
{
coef[i] = 0x02AB; // 1/48 in fract16 format
}
fir_init(stateL0, coef, delayL0, TAPS, 0);
fir_init(stateL1, coef, delayL1, TAPS, 0);
fir_init(stateR0, coef, delayR0, TAPS, 0);
fir_init(stateR1, coef, delayR1, TAPS, 0);
}