robobuggy / arduino / RadioBuggyMega / filter.h @ eb7af729
History | View | Annotate | Download (730 Bytes)
1 |
/**
|
---|---|
2 |
* @file filter.h
|
3 |
* @brief Filter to filter data from rc_available
|
4 |
*
|
5 |
* @author: Audrey Yeoh (ayeoh)
|
6 |
*
|
7 |
*/
|
8 |
|
9 |
#ifndef _FILTER_H_
|
10 |
#define _FILTER_H_
|
11 |
|
12 |
#ifdef __cplusplus
|
13 |
extern "C"{ |
14 |
#endif
|
15 |
|
16 |
//<<<<<<< Updated upstream
|
17 |
#define FILTER_LEN 10 // Averaging window size |
18 |
|
19 |
struct filter_state {
|
20 |
int prev_values[FILTER_LEN];
|
21 |
char started;
|
22 |
int pos; // next index to update |
23 |
}; |
24 |
|
25 |
|
26 |
void filter_init(struct filter_state *state); |
27 |
|
28 |
int filter_loop(struct filter_state *state, int val); // returns the int that has been filtered |
29 |
//=======
|
30 |
//// @param val The next raw reading
|
31 |
//// @returns The next filtered reading
|
32 |
//int filter(int new_raw_reading);
|
33 |
//
|
34 |
//>>>>>>> Stashed changes
|
35 |
|
36 |
|
37 |
#ifdef __cplusplus
|
38 |
} |
39 |
#endif
|
40 |
|
41 |
#endif
|
42 |
|
43 |
|