diff options
author | Julian Oes <julian@oes.ch> | 2013-07-18 16:15:43 +0200 |
---|---|---|
committer | Julian Oes <julian@oes.ch> | 2013-07-18 16:15:43 +0200 |
commit | da152e148d471ded29857e29040f33c7356c9050 (patch) | |
tree | 543c579c679853134de09667241a78d93ed3d054 /src/drivers/lsm303d/iirFilter.h | |
parent | f4df4a4e081d9eaaa5dbeef013fa6320b0cea3f7 (diff) | |
download | px4-firmware-da152e148d471ded29857e29040f33c7356c9050.tar.gz px4-firmware-da152e148d471ded29857e29040f33c7356c9050.tar.bz2 px4-firmware-da152e148d471ded29857e29040f33c7356c9050.zip |
Added iirFilter to LSM303D
Diffstat (limited to 'src/drivers/lsm303d/iirFilter.h')
-rw-r--r-- | src/drivers/lsm303d/iirFilter.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/drivers/lsm303d/iirFilter.h b/src/drivers/lsm303d/iirFilter.h new file mode 100644 index 000000000..ab4223a8e --- /dev/null +++ b/src/drivers/lsm303d/iirFilter.h @@ -0,0 +1,59 @@ +#ifndef IIRFILTER__H__ +#define IIRFILTER__H__ + +__BEGIN_DECLS + +#define MAX_LENGTH 4 + +typedef struct FILTER_s +{ + float denData[MAX_LENGTH]; + float numData[MAX_LENGTH]; + int denLength; + int numLength; + float Ts; + float inpData[MAX_LENGTH]; + float outData[MAX_LENGTH]; + unsigned int inpCnt; +} FIL_T; + +typedef struct TF_ZPG_s +{ + int zerosLength; + double zerosData[MAX_LENGTH + 1]; + int polesLength; + double polesData[MAX_LENGTH + 1]; + double gain; + double Ts; +} TF_ZPG_t; + +typedef struct TF_POLY_s +{ + int numLength; + double numData[MAX_LENGTH]; + int denLength; + double denData[MAX_LENGTH]; + double Ts; +} TF_POLY_t; + +typedef struct TF_DIF_s +{ + int numInt; + int numDiff; + int lowpassLength; + int highpassLength; + double lowpassData[MAX_LENGTH]; + int highpassData[MAX_LENGTH]; + double gain; + double Ts; +} TF_DIF_t; + +__EXPORT int testFunction(void); + +__EXPORT float updateFilter(FIL_T *pFilt, float inp); + +__EXPORT int initFilter(const TF_DIF_t *pDifc, double Ts, FIL_T *pFilt); + +__END_DECLS + +#endif |