fusion-zauberstab/firmware/include/dc_cancelation.h
Thomas Schmid b3ce3e0169 dc_cancelation: implement as template class
Signed-off-by: Thomas Schmid <tom@lfence.de>
2022-06-19 12:54:17 +02:00

18 lines
271 B
C++

#pragma once
template<class T>
struct DcCancelation {
T x_n1;
T y_n1;
T R;
DcCancelation(T R) : R(R) {};
T update(T x) {
T y = x-this->x_n1 + this->R * this->y_n1;
this->x_n1 = x;
this->y_n1 = y;
return y;
};
};