diff --git a/libraries/Filter/LowPassFilter2p.cpp b/libraries/Filter/LowPassFilter2p.cpp index 653c3a4a62..484f64e8b9 100644 --- a/libraries/Filter/LowPassFilter2p.cpp +++ b/libraries/Filter/LowPassFilter2p.cpp @@ -31,6 +31,11 @@ void DigitalBiquadFilter::reset() { _delay_element_1 = _delay_element_2 = T(); } +template +void DigitalBiquadFilter::reset(const T &value) { + _delay_element_1 = _delay_element_2 = value; +} + template void DigitalBiquadFilter::compute_params(float sample_freq, float cutoff_freq, biquad_params &ret) { ret.cutoff_freq = cutoff_freq; @@ -99,6 +104,11 @@ void LowPassFilter2p::reset(void) { return _filter.reset(); } +template +void LowPassFilter2p::reset(const T &value) { + return _filter.reset(value); +} + /* * Make an instances * Otherwise we have to move the constructor implementations to the header file :P diff --git a/libraries/Filter/LowPassFilter2p.h b/libraries/Filter/LowPassFilter2p.h index 65ed7c8ba4..fcc8d644da 100644 --- a/libraries/Filter/LowPassFilter2p.h +++ b/libraries/Filter/LowPassFilter2p.h @@ -39,6 +39,7 @@ public: T apply(const T &sample, const struct biquad_params ¶ms); void reset(); + void reset(const T &value); static void compute_params(float sample_freq, float cutoff_freq, biquad_params &ret); private: @@ -59,6 +60,7 @@ public: float get_sample_freq(void) const; T apply(const T &sample); void reset(void); + void reset(const T &value); protected: struct DigitalBiquadFilter::biquad_params _params;