uncrustify libraries/Filter/DerivativeFilter.h

This commit is contained in:
uncrustify 2012-08-16 23:22:10 -07:00 committed by Pat Hickey
parent 973dcba9ab
commit 6bfccd13f8
1 changed files with 15 additions and 14 deletions

View File

@ -17,31 +17,32 @@
#include <Filter.h>
#include <FilterWithBuffer.h>
// 1st parameter <T> is the type of data being filtered.
// 1st parameter <T> is the type of data being filtered.
// 2nd parameter <FILTER_SIZE> is the number of elements in the filter
template <class T, uint8_t FILTER_SIZE>
class DerivativeFilter : public FilterWithBuffer<T,FILTER_SIZE>
{
public:
// constructor
DerivativeFilter() : FilterWithBuffer<T,FILTER_SIZE>() {};
public:
// constructor
DerivativeFilter() : FilterWithBuffer<T,FILTER_SIZE>() {
};
// update - Add a new raw value to the filter, but don't recalculate
virtual void update(T sample, uint32_t timestamp);
// update - Add a new raw value to the filter, but don't recalculate
virtual void update(T sample, uint32_t timestamp);
// return the derivative value
virtual float slope(void);
// return the derivative value
virtual float slope(void);
// reset - clear the filter
virtual void reset();
// reset - clear the filter
virtual void reset();
private:
bool _new_data;
float _last_slope;
private:
bool _new_data;
float _last_slope;
// microsecond timestamps for samples. This is needed
// to cope with non-uniform time spacing of the data
uint32_t _timestamps[FILTER_SIZE];
uint32_t _timestamps[FILTER_SIZE];
};
typedef DerivativeFilter<float,5> DerivativeFilterFloat_Size5;