-
Notifications
You must be signed in to change notification settings - Fork 1
/
filter.hpp
38 lines (27 loc) · 838 Bytes
/
filter.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef EXP_FILTER_HPP_
#define EXP_FILTER_HPP_
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
namespace infineon
{
class ExponentialFilter
{
public:
ExponentialFilter();
ExponentialFilter(float y);
ExponentialFilter(float y, uint16_t t);
void setFilter(float y, uint16_t t);
void setTau(uint16_t t);
void setToNewValue(float y);
void input(float x);
float output();
uint16_t pow2(uint16_t p);
private:
uint16_t tau; /**< Time constant >**/
float y; /**< Output value >**/
float y_last; /**< Last output value >**/
float x; /**< Input value>**/
};
} /**< end namespace infineon >**/
#endif /**< FILTER_HPP_ >**/