75 #define FILTER_BUFFER_SIZE 10
84 void (*min_callback)(int16_t);
85 void (*max_callback)(int16_t);
86 int16_t (*filter)(int16_t *values, uint16_t index ,uint16_t size, int16_t Last_Value);
177 int16_t
MovingAvgFilter(int16_t *values, uint16_t index, uint16_t size, int16_t Last_Value);
189 void Filter_SetFilter(
filter_t * f_ptr, int16_t(*new_filter)(int16_t *values, uint16_t index, uint16_t size, int16_t last_value));
void Filter_Update(int16_t raw_value, filter_t *f_ptr)
computes the new value after going through the transfer function and inputs it into filter buffer arr...
Definition: filter.c:52
uint32_t scale
Definition: filter.h:80
int16_t min
Definition: filter.h:82
uint16_t index
Definition: filter.h:88
void Filter_SetFilter(filter_t *f_ptr, int16_t(*new_filter)(int16_t *values, uint16_t index, uint16_t size, int16_t last_value))
Method that allows user to pass a function to a pointer a different type of filter (i...
Definition: filter.c:161
int16_t max
Definition: filter.h:83
void Filter_SetMax(filter_t *f_ptr, int16_t threshold, void(*callback)(int16_t))
Filter_SetMin will set the MAX value in the filter to the threshold specified. Calls the callback fun...
Definition: filter.c:122
int16_t Filter_Get(filter_t *f_ptr)
Filter_Get will retrieve the current value from the filter instance.
Definition: filter.c:96
int16_t value
Definition: filter.h:89
uint16_t shift
Definition: filter.h:81
int16_t MovingAvgFilter(int16_t *values, uint16_t index, uint16_t size, int16_t Last_Value)
Moving Average filter - Default filter that adds the previous X values and divides by number of value...
Definition: filter.c:137
void Filter_SetMin(filter_t *f_ptr, int16_t threshold, void(*callback)(int16_t))
Filter_SetMin will set the MIN value in the filter to the threshold specified. Calls the callback fun...
Definition: filter.c:107
int16_t offset
Definition: filter.h:79
#define FILTER_BUFFER_SIZE
Definition: filter.h:75
void Filter_Init(filter_t *f_ptr, int16_t offset, float scale)
Initializes all struct variables and calculates the shift based on scale input for linear transfer fu...
Definition: filter.c:13