#include <Filter.h>
|
| FilterClass (FilterType_t type, uint8_t order) |
| Creates a new filter class. More...
|
|
float | addWeigth (float coeff) |
| Adds a new weighting value. It is pushed on the array so latest value will be used for older data. More...
|
|
float | addValue (float value) |
| Pushes a new value for calculation. Until the buffer is filled up to filter order, only first valid values are used in calculation. More...
|
|
void | clear () |
| Resets state of the filter to an initial value. More...
|
|
| ~FilterClass () |
| Frees up dynamic memory. More...
|
|
|
float | aveFilter (float value) |
| Average filter calculation of next value. More...
|
|
int | divide (float *array, int start, int end) |
| Divide function to be used on Quick Sort. More...
|
|
void | quicksort (float *array, int start, int end) |
| Sorting function that uses QuickSort algorythm. More...
|
|
float | medianFilter (float value) |
| Median filter calculation of next value. More...
|
|
Definition at line 29 of file Filter.h.
◆ FilterClass()
FilterClass::FilterClass |
( |
FilterType_t |
type, |
|
|
uint8_t |
order |
|
) |
| |
Creates a new filter class.
- Parameters
-
type | Filter type from FilterType_t |
order | Filter order |
Definition at line 225 of file Filter.cpp.
◆ ~FilterClass()
FilterClass::~FilterClass |
( |
| ) |
|
Frees up dynamic memory.
Definition at line 137 of file Filter.cpp.
◆ addValue()
float FilterClass::addValue |
( |
float |
value | ) |
|
Pushes a new value for calculation. Until the buffer is filled up to filter order, only first valid values are used in calculation.
- Parameters
-
- Returns
- Weighted average value
Definition at line 12 of file Filter.cpp.
◆ addWeigth()
float FilterClass::addWeigth |
( |
float |
coeff | ) |
|
Adds a new weighting value. It is pushed on the array so latest value will be used for older data.
- Parameters
-
coeff | Next weighting coefficient |
- Returns
- Sum of all weighting values
Definition at line 25 of file Filter.cpp.
◆ aveFilter()
float FilterClass::aveFilter |
( |
float |
value | ) |
|
|
protected |
Average filter calculation of next value.
- Parameters
-
value | Next value to do calculation with |
- Returns
- Returns calculated average (weighted or unweighted)
Definition at line 43 of file Filter.cpp.
◆ clear()
void FilterClass::clear |
( |
| ) |
|
Resets state of the filter to an initial value.
Definition at line 128 of file Filter.cpp.
◆ divide()
int FilterClass::divide |
( |
float * |
array, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protected |
Divide function to be used on Quick Sort.
- Parameters
-
array | Input array |
start | Start index |
end | End index |
- Returns
- Returns new pivot position
Definition at line 91 of file Filter.cpp.
◆ medianFilter()
float FilterClass::medianFilter |
( |
float |
value | ) |
|
|
protected |
Median filter calculation of next value.
- Parameters
-
value | Next value to do calculation with |
- Returns
- Returns calculated median
Definition at line 157 of file Filter.cpp.
◆ quicksort()
void FilterClass::quicksort |
( |
float * |
array, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protected |
Sorting function that uses QuickSort algorythm.
- Parameters
-
array | Input array |
start | Start index |
end | End index |
Definition at line 143 of file Filter.cpp.
◆ _filterType
Filter type from FilterType_t.
Definition at line 31 of file Filter.h.
◆ _index
uint FilterClass::_index = 0 |
|
protected |
Used to point latest entered value while number of values less than order.
Definition at line 36 of file Filter.h.
◆ _order
uint8_t FilterClass::_order |
|
protected |
Filter order. Numbre of samples to store for calculations.
Definition at line 32 of file Filter.h.
◆ _orderedValues
float* FilterClass::_orderedValues |
|
protected |
Values ordered for median calculation.
Definition at line 34 of file Filter.h.
◆ _rawValues
float* FilterClass::_rawValues |
|
protected |
Raw values store.
Definition at line 33 of file Filter.h.
◆ _weightValues
float* FilterClass::_weightValues |
|
protected |
Weight values for average calculation. By default all them have value of 1 for arithmetic average.
Definition at line 35 of file Filter.h.
The documentation for this class was generated from the following files: