avr-fw-modules/core/src/fp1616_smoother.c

12 lines
310 B
C
Executable File

#include <fixpoint/fp1616.h>
fp1616_t fp1616_smoother(struct _fp1616_smoother *smoother,fp1616_t sample) {
smoother->sum = fp1616_add(smoother->sum,sample);
smoother->value = fp1616_mul(smoother->sum,smoother->k);
smoother->sum = fp1616_sub(smoother->sum,smoother->value);
return smoother->value;
};