Brian Silverman | 95244d8 | 2013-12-14 12:15:46 -0800 | [diff] [blame] | 1 | #ifndef CAPE_ANALOG_H_ |
2 | #define CAPE_ANALOG_H_ | ||||
3 | |||||
4 | #include <stdint.h> | ||||
5 | |||||
6 | // Starts up constantly reading analog values and storing them in an array to | ||||
7 | // be retrieved by analog_get. | ||||
8 | void analog_init(void); | ||||
9 | |||||
10 | static inline uint16_t analog_get(int num) { | ||||
11 | if (num < 0 || num > 7) return 0xFFFF; | ||||
12 | |||||
13 | extern uint16_t analog_readings[8] __attribute__((aligned(8))); | ||||
14 | return analog_readings[num]; | ||||
15 | } | ||||
16 | |||||
17 | #endif // CAPE_ANALOG_H_ |