Control Library by altb
Dependents: My_Libraries IndNav_QK3_T265
Diff: IIR_filter.h
- Revision:
- 15:c70cad2f4e64
- Parent:
- 14:9184aa9fdac7
--- a/IIR_filter.h Mon Oct 28 07:53:02 2019 +0000 +++ b/IIR_filter.h Thu Jan 16 09:12:50 2020 +0000 @@ -1,29 +1,36 @@ #ifndef IIR_FILTER_H_ #define IIR_FILTER_H_ + +#include "mbed.h" + class IIR_filter{ + public: - IIR_filter(){}; 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 *b, float *a, int nb, int na); + IIR_filter() {}; float operator()(float u){ - return filter((double)u); + return filter(u); } - virtual ~IIR_filter(); - void reset(float); - float filter(double); - void setup(float,float,float); + + virtual ~IIR_filter(); + + void setup(float T, float Ts, float K); + void reset(float val); + float filter(float input); + private: - unsigned int nb; - unsigned int na; - double *B; - double *A; - double *uk; - double *yk; - double K; + uint8_t nb; + uint8_t na; + float *B; + float *A; + float *uk; + float *yk; + float K; }; #endif \ No newline at end of file