Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LSM9DS1 RangeFinder FastPWM
Dependents: PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board ... more
AvgFilter.h@26:6c326a352f1b, 2022-05-05 (annotated)
- Committer:
- pmic
- Date:
- Thu May 05 09:13:43 2022 +0000
- Revision:
- 26:6c326a352f1b
- Parent:
- 24:f2614d8577a1
- Child:
- 27:fdb94d0b5d87
Adjusted AvgFilter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pmic | 24:f2614d8577a1 | 1 | #ifndef AVGFILTER_H_ |
pmic | 24:f2614d8577a1 | 2 | #define AVGFILTER_H_ |
pmic | 24:f2614d8577a1 | 3 | |
pmic | 24:f2614d8577a1 | 4 | #include <mbed.h> |
pmic | 24:f2614d8577a1 | 5 | |
pmic | 24:f2614d8577a1 | 6 | class AvgFilter |
pmic | 24:f2614d8577a1 | 7 | { |
pmic | 24:f2614d8577a1 | 8 | public: |
pmic | 24:f2614d8577a1 | 9 | AvgFilter(){}; |
pmic | 24:f2614d8577a1 | 10 | AvgFilter(uint8_t _N); |
pmic | 26:6c326a352f1b | 11 | virtual ~AvgFilter(); |
pmic | 24:f2614d8577a1 | 12 | |
pmic | 24:f2614d8577a1 | 13 | void setup(uint8_t _N); |
pmic | 24:f2614d8577a1 | 14 | void reset(); |
pmic | 24:f2614d8577a1 | 15 | float update(float _inp); |
pmic | 24:f2614d8577a1 | 16 | |
pmic | 24:f2614d8577a1 | 17 | private: |
pmic | 24:f2614d8577a1 | 18 | float m_avg; |
pmic | 24:f2614d8577a1 | 19 | uint8_t m_N; |
pmic | 24:f2614d8577a1 | 20 | uint8_t m_idx; |
pmic | 24:f2614d8577a1 | 21 | float *m_ring_buffer; |
pmic | 24:f2614d8577a1 | 22 | }; |
pmic | 24:f2614d8577a1 | 23 | |
pmic | 24:f2614d8577a1 | 24 | #endif /* AVGFILTER_H_ */ |