5#include <AH/STL/algorithm>
6#include <AH/STL/cstdint>
7#include <AH/STL/type_traits>
31template <u
int8_t N,
class input_t = u
int16_t,
class sum_t = u
int32_t>
46 SMA(input_t initialValue) :
sum(N * (sum_t)initialValue) {
65 return AH::round_div<N>(
sum);
Simple Moving Average filter.
SMA(input_t initialValue)
Constructor (initial state is initialized to given value).
SMA()=default
Default constructor (initial state is initialized to all zeros).
input_t previousInputs[N]
input_t operator()(input_t input)
Update the internal state with the new input and return the new output .