Cube_Mini_Template
Dependencies: mbed QEI MPU6050_2 BLE_API nRF51822 MCP4725 eMPL_MPU6050
Diff: IIR_filter.h
- Revision:
- 0:8e87cdf07037
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IIR_filter.h Fri Jan 31 17:59:21 2020 +0000 @@ -0,0 +1,36 @@ +#ifndef IIR_FILTER_H_ +#define IIR_FILTER_H_ + +#include "mbed.h" + +class IIR_filter{ + + public: + + IIR_filter(float T, float Ts); + IIR_filter(float T, float Ts, float K); + IIR_filter(float w0, float D, float Ts, float K); + IIR_filter(float *b, float *a, int nb, int na); + IIR_filter() {}; + + float operator()(float u){ + return filter(u); + } + + virtual ~IIR_filter(); + + void setup(float T, float Ts, float K); + void reset(float val); + float filter(float input); + + private: + + uint8_t nb; + uint8_t na; + float *B; + float *A; + float *uk; + float *yk; + float K; +}; +#endif \ No newline at end of file