uncrustify libraries/Filter/AverageFilter.h
This commit is contained in:
parent
10acadef62
commit
dbba304af8
@ -22,9 +22,10 @@
|
||||
template <class T, class U, uint8_t FILTER_SIZE>
|
||||
class AverageFilter : public FilterWithBuffer<T,FILTER_SIZE>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// constructor
|
||||
AverageFilter() : FilterWithBuffer<T,FILTER_SIZE>(), _num_samples(0) {};
|
||||
AverageFilter() : FilterWithBuffer<T,FILTER_SIZE>(), _num_samples(0) {
|
||||
};
|
||||
|
||||
// apply - Add a new raw value to the filter, retrieve the filtered result
|
||||
virtual T apply(T sample);
|
||||
@ -32,7 +33,7 @@ class AverageFilter : public FilterWithBuffer<T,FILTER_SIZE>
|
||||
// reset - clear the filter
|
||||
virtual void reset();
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t _num_samples; // the number of samples in the filter, maxes out at size of the filter
|
||||
};
|
||||
|
||||
@ -69,7 +70,7 @@ typedef AverageFilter<float,float,5> AverageFilterFloat_Size5;
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T, class U, uint8_t FILTER_SIZE>
|
||||
T AverageFilter<T,U,FILTER_SIZE>::apply(T sample)
|
||||
T AverageFilter<T,U,FILTER_SIZE>:: apply(T sample)
|
||||
{
|
||||
U result = 0;
|
||||
|
||||
@ -90,7 +91,7 @@ T AverageFilter<T,U,FILTER_SIZE>::apply(T sample)
|
||||
|
||||
// reset - clear all samples
|
||||
template <class T, class U, uint8_t FILTER_SIZE>
|
||||
void AverageFilter<T,U,FILTER_SIZE>::reset()
|
||||
void AverageFilter<T,U,FILTER_SIZE>:: reset()
|
||||
{
|
||||
// call parent's apply function to get the sample into the array
|
||||
FilterWithBuffer<T,FILTER_SIZE>::reset();
|
||||
|
Loading…
Reference in New Issue
Block a user