21template <
typename TypeInput,
typename TypeM
id, u
int16_t SIZE>
32template <
typename TypeInput,
typename TypeM
id, u
int16_t SIZE>
35 buffer[index] = sample;
36 index = (index + 1) % SIZE;
47template <
typename TypeInput,
typename TypeM
id, u
int16_t SIZE>
51 for (uint16_t i = 0; i < SIZE; ++i)
55 return static_cast<TypeInput
>(sum /
static_cast<TypeMid
>(SIZE));
68template <
typename TypeInput,
typename TypeM
id, u
int8_t OLD_RATIO, u
int8_t NEW_RATIO>
80template <
typename TypeInput,
typename TypeM
id, u
int8_t OLD_RATIO, u
int8_t NEW_RATIO>
83 last_out =
static_cast<TypeMid
>(last_out * OLD_RATIO + sample * NEW_RATIO + (OLD_RATIO + NEW_RATIO) / 2) / (OLD_RATIO + NEW_RATIO);
94template <
typename TypeInput,
typename TypeM
id, u
int8_t OLD_RATIO, u
int8_t NEW_RATIO>
Declaration of signal processing functions.
void addSample(TypeInput sample) override
Adds a new sample to the AverageFilter. Stores the sample in the circular buffer and updates the inde...
TypeInput getFiltered() const override
Retrieves the filtered value from the AverageFilter. Computes the average of the samples in the circu...
AverageFilter()
Constructor for AverageFilter. Initializes the circular buffer to zero.
void addSample(TypeInput sample) override
Adds a new sample to the ExponentialFilter. Updates the filtered value using the exponential moving a...
ExponentialFilter()
Constructor for ExponentialFilter. Initializes the last output value to zero.
TypeInput getFiltered() const override
Retrieves the filtered value from the ExponentialFilter.