mirror of https://github.com/ArduPilot/ardupilot
uncrustify libraries/Filter/FilterWithBuffer.h
This commit is contained in:
parent
dbba304af8
commit
c284fb144f
|
@ -22,7 +22,7 @@
|
|||
template <class T, uint8_t FILTER_SIZE>
|
||||
class FilterWithBuffer : public Filter<T>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// constructor
|
||||
FilterWithBuffer();
|
||||
|
||||
|
@ -33,9 +33,11 @@ class FilterWithBuffer : public Filter<T>
|
|||
virtual void reset();
|
||||
|
||||
// get filter size
|
||||
virtual uint8_t get_filter_size() { return FILTER_SIZE; };
|
||||
virtual uint8_t get_filter_size() {
|
||||
return FILTER_SIZE;
|
||||
};
|
||||
|
||||
protected:
|
||||
protected:
|
||||
T samples[FILTER_SIZE]; // buffer of samples
|
||||
uint8_t sample_index; // pointer to the next empty slot in the buffer
|
||||
};
|
||||
|
@ -79,7 +81,7 @@ FilterWithBuffer<T,FILTER_SIZE>::FilterWithBuffer() :
|
|||
|
||||
// reset - clear all samples from the buffer
|
||||
template <class T, uint8_t FILTER_SIZE>
|
||||
void FilterWithBuffer<T,FILTER_SIZE>::reset()
|
||||
void FilterWithBuffer<T,FILTER_SIZE>:: reset()
|
||||
{
|
||||
// call base class reset
|
||||
Filter<T>::reset();
|
||||
|
@ -95,7 +97,7 @@ void FilterWithBuffer<T,FILTER_SIZE>::reset()
|
|||
|
||||
// apply - take in a new raw sample, and return the filtered results
|
||||
template <class T, uint8_t FILTER_SIZE>
|
||||
T FilterWithBuffer<T,FILTER_SIZE>::apply(T sample)
|
||||
T FilterWithBuffer<T,FILTER_SIZE>:: apply(T sample)
|
||||
{
|
||||
// add sample to array
|
||||
samples[sample_index++] = sample;
|
||||
|
|
Loading…
Reference in New Issue