Project

General

Profile

Revision 0c80370b

ID0c80370b0079003faff138131a7f8eca80a9f6e2
Parent 6b9a71b0
Child e6c4b5e0

Added by Matthew Sebek about 10 years ago

Added struct filter_state, so we can filter multiple signals

View differences:

arduino/RadioBuggyMega/filter.h
13 13
extern "C"{
14 14
#endif
15 15

  
16
#define FILTER_LEN 5 // Averaging window size
16 17

  
17
int filter(int val); // returns the int that has been filtered
18
struct filter_state {
19
    int prev_values[FILTER_LEN];
20
    char started;
21
    int pos; // next index to update
22
};
23

  
24

  
25
void filter_init(struct filter_state *state);
26

  
27
int filter_loop(struct filter_state *state, int val); // returns the int that has been filtered
18 28

  
19 29

  
20 30
#ifdef __cplusplus
......
23 33

  
24 34
#endif
25 35

  
26

  
36

  

Also available in: Unified diff