Libary for PM2.

Dependencies:   LSM9DS1 RangeFinder FastPWM

Dependents:   PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board ... more

AvgFilter.h

Committer:
pmic
Date:
2022-06-22
Revision:
32:bb074bb17d39
Parent:
27:fdb94d0b5d87

File content as of revision 32:bb074bb17d39:

#ifndef AVGFILTER_H_
#define AVGFILTER_H_

#include <mbed.h>

class AvgFilter
{
public:
    AvgFilter(){};
    AvgFilter(uint8_t _N);
    virtual ~AvgFilter();

    void setup(uint8_t _N);
    void reset(float _avg);
    void reset();
    float update(float _inp);

private:
    float m_avg;
    uint8_t m_N;
    uint8_t m_idx;
    float *m_ring_buffer;
};

#endif /* AVGFILTER_H_ */