添加带通滤波器
This commit is contained in:
parent
3c75d5db9c
commit
279feb13a9
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,72 @@
|
|||
|
||||
|
||||
#include "FIR.h"
|
||||
|
||||
|
||||
////const int16_t pCoeffs[numTaps] = {
|
||||
//// 328, -27, -96, -175, -226, -219, -157, -71, -11,
|
||||
//// -21, -109, -231, -304, -232, 41, 492, 1002, 1379,
|
||||
//// 1423, 1009, 147, -981, -2064, -2748, -2758, -2001, -621,
|
||||
//// 1034, 2504, 3366, 3366, 2504, 1034, -621, -2001, -2758,
|
||||
//// -2748, -2064, -981, 147, 1009, 1423, 1379, 1002, 492,
|
||||
//// 41, -232, -304, -231, -109, -21, -11, -71, -157,
|
||||
//// -219, -226, -175, -96, -27, 328
|
||||
////};
|
||||
//
|
||||
//const int16_t pCoeffs[numTaps] = {
|
||||
// 1, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, -1,
|
||||
// -1, -1, 0, 2, 4, 5, 6, 4, 1, -4, -8, -11,
|
||||
// -11, -8, -2, 4, 10, 13, 13, 10, 4, -2, -8, -11,
|
||||
// -11, -8, -4, 1, 4, 6, 5, 4, 2, 0, -1, -1,
|
||||
// -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 1
|
||||
//};
|
||||
//
|
||||
//
|
||||
//arm_fir_instance_q15 bpf_s;
|
||||
//
|
||||
//int16_t pState[ADC_VAL_LEN+numTaps-1];
|
||||
//
|
||||
//void firFilterInit(void)
|
||||
//{
|
||||
// arm_fir_init_q15(&bpf_s,numTaps,pCoeffs,pState,ADC_VAL_LEN);
|
||||
//}
|
||||
//
|
||||
//void firBPFFilter(int16_t *rawValue,int16_t *outData,uint32_t len)
|
||||
//{
|
||||
// arm_fir_q15(&bpf_s,rawValue,outData,len);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
const float pCoeffs[numTaps] = {
|
||||
0.01000739448,-0.0008298238972,-0.002934818622,-0.005351484753,-0.006882067304,
|
||||
-0.006692492869,-0.004794952925,-0.002162534744,-0.000337747857,-0.0006400240236,
|
||||
-0.003314057132,-0.007060859352, -0.00928321667,-0.007090434898, 0.001251851092,
|
||||
0.01502577588, 0.03057955019, 0.04208169878, 0.04344128817, 0.03078254126,
|
||||
0.004476505332, -0.02993877046, -0.06297727674, -0.08384874463, -0.08415342867,
|
||||
-0.06107503176, -0.01894705743, 0.03154437244, 0.07641164213, 0.1027124152,
|
||||
0.1027124152, 0.07641164213, 0.03154437244, -0.01894705743, -0.06107503176,
|
||||
-0.08415342867, -0.08384874463, -0.06297727674, -0.02993877046, 0.004476505332,
|
||||
0.03078254126, 0.04344128817, 0.04208169878, 0.03057955019, 0.01502577588,
|
||||
0.001251851092,-0.007090434898, -0.00928321667,-0.007060859352,-0.003314057132,
|
||||
-0.0006400240236,-0.000337747857,-0.002162534744,-0.004794952925,-0.006692492869,
|
||||
-0.006882067304,-0.005351484753,-0.002934818622,-0.0008298238972, 0.01000739448
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
arm_fir_instance_f32 bpf_s;
|
||||
|
||||
float32_t pState[ADC_VAL_LEN+numTaps-1];
|
||||
|
||||
void firFilterInit(void)
|
||||
{
|
||||
arm_fir_init_f32(&bpf_s,numTaps,pCoeffs,pState,ADC_VAL_LEN);
|
||||
}
|
||||
|
||||
void firBPFFilter(float32_t *rawValue,float32_t *outData,uint32_t len)
|
||||
{
|
||||
arm_fir_f32(&bpf_s,rawValue,outData,len);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _FIR__H_
|
||||
#define _FIR__H_
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "math.h"
|
||||
#include "anemometer_dev.h"
|
||||
|
||||
|
||||
|
||||
#define numTaps 60
|
||||
//const float B[numTaps] = {
|
||||
// 0.01000739448,-0.0008298238972,-0.002934818622,-0.005351484753,-0.006882067304,
|
||||
// -0.006692492869,-0.004794952925,-0.002162534744,-0.000337747857,-0.0006400240236,
|
||||
// -0.003314057132,-0.007060859352, -0.00928321667,-0.007090434898, 0.001251851092,
|
||||
// 0.01502577588, 0.03057955019, 0.04208169878, 0.04344128817, 0.03078254126,
|
||||
// 0.004476505332, -0.02993877046, -0.06297727674, -0.08384874463, -0.08415342867,
|
||||
// -0.06107503176, -0.01894705743, 0.03154437244, 0.07641164213, 0.1027124152,
|
||||
// 0.1027124152, 0.07641164213, 0.03154437244, -0.01894705743, -0.06107503176,
|
||||
// -0.08415342867, -0.08384874463, -0.06297727674, -0.02993877046, 0.004476505332,
|
||||
// 0.03078254126, 0.04344128817, 0.04208169878, 0.03057955019, 0.01502577588,
|
||||
// 0.001251851092,-0.007090434898, -0.00928321667,-0.007060859352,-0.003314057132,
|
||||
// -0.0006400240236,-0.000337747857,-0.002162534744,-0.004794952925,-0.006692492869,
|
||||
// -0.006882067304,-0.005351484753,-0.002934818622,-0.0008298238972, 0.01000739448
|
||||
//};
|
||||
|
||||
|
||||
//const int BL = 60;
|
||||
|
||||
|
||||
|
||||
void firFilterInit(void);
|
||||
|
||||
void firBPFFilter(float32_t *rawValue,float32_t *outData,uint32_t len);
|
||||
|
||||
//void firBPFFilter(int16_t *rawValue,int16_t *outData,uint32_t len);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue