blob: 267308b8feae9f7e3dbd232a94dc218479a208c7 [file] [log] [blame]
brians0ab60bb2013-01-31 02:21:51 +00001#ifndef __ANALOG_H__
2#define __ANALOG_H__
3
Austin Schuh63d0e9b2013-03-27 04:43:14 +00004extern int64_t gyro_angle;
Brian Silverman6ad00b82013-03-27 19:02:38 -07005
6struct DataStruct {
Austin Schuh63d0e9b2013-03-27 04:43:14 +00007 int64_t gyro_angle;
8
9 int32_t right_drive;
10 int32_t left_drive;
11 int32_t shooter_angle;
12 int32_t shooter;
13 int32_t indexer;
14 int32_t wrist;
15
16 int32_t capture_top_rise;
17 int32_t capture_top_fall;
18 int32_t capture_bottom_fall_delay;
19 int32_t capture_wrist_rise;
20 int32_t capture_shooter_angle_rise;
21
22 int8_t top_rise_count;
23
24 int8_t top_fall_count;
25
26 int8_t bottom_rise_count;
27
28 int8_t bottom_fall_delay_count;
29 int8_t bottom_fall_count;
30
31 int8_t wrist_rise_count;
32
33 int8_t shooter_angle_rise_count;
Brian Silverman6ad00b82013-03-27 19:02:38 -070034} __attribute__((__packed__));
Austin Schuh63d0e9b2013-03-27 04:43:14 +000035void fillSensorPacket(struct DataStruct *packet);
36
Brian Silverman6ad00b82013-03-27 19:02:38 -070037void analog_init(void);
38int analog(int channel);
Austin Schuh63d0e9b2013-03-27 04:43:14 +000039
Brian Silverman6ad00b82013-03-27 19:02:38 -070040int digital(int channel);
41
42// Returns the current values of the inputs for the given encoder (as the low 2
43// bits).
44int encoder_bits(int channel);
brians0ab60bb2013-01-31 02:21:51 +000045void encoder_init(void);
Brian Silverman6ad00b82013-03-27 19:02:38 -070046int32_t encoder_val(int channel);
47
48int dip(int channel);
49#endif // __ANALOG_H__