📄 fir.c
字号:
/*************************************************************************************************
N is the length of the FIR filter (steps+1) FIR_coefficient[] is the coefficients of this filter,
it's type is int; unsigned int &FIR_data[] is the before data of this filter,also can change the
data; unsigned int NOW_data is the NOW data for this filter
*************************************************************************************************/
#include<avr/io.h>
long FIR_filter(int FIR_coefficient[],unsigned int *FIR_data,unsigned int NOW_data,int N)
{ long FIR_result=0;
N=N-1;
for(;N>0;N--)
{ FIR_result+=FIR_coefficient[N] * *(FIR_data+N);
*(FIR_data+N)=*(FIR_data+N-1);
}
*FIR_data=NOW_data;
FIR_result+=*FIR_data*FIR_coefficient[0];
return FIR_result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -