blob: 50038d5f204e12cf857e828147eb3e4473dd6ad8 [file] [log] [blame]
Brian Silverman95244d82013-12-14 12:15:46 -08001#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.
8void analog_init(void);
9
10static 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_