blob: ac39cacd110e98295c085e66f3d29c86180d1ff5 [file] [log] [blame]
Brian Silverman59685152013-03-29 21:37:43 -07001#ifndef FRC971_INPUT_GYRO_BOARD_DATA_H_
2#define FRC971_INPUT_GYRO_BOARD_DATA_H_
3
4#include "aos/common/byteorder.h"
5
6namespace frc971 {
7
8// The struct that the gyro board sends out with all of the data in it.
9struct GyroBoardData {
10 int64_t gyro_angle;
11
12 int32_t right_drive;
13 int32_t left_drive;
14 int32_t shooter_angle;
15 int32_t shooter;
16 int32_t indexer;
17 int32_t wrist;
18
19 int32_t capture_top_rise;
20 int32_t capture_top_fall;
21 int32_t capture_bottom_fall_delay;
22 int32_t capture_wrist_rise;
23 int32_t capture_shooter_angle_rise;
24
25 int8_t top_rise_count;
26
27 int8_t top_fall_count;
28
29 int8_t bottom_rise_count;
30
31 int8_t bottom_fall_delay_count;
32 int8_t bottom_fall_count;
33
34 int8_t wrist_rise_count;
35
36 int8_t shooter_angle_rise_count;
37
38 union {
39 struct {
40 uint8_t wrist_hall_effect : 1;
41 uint8_t angle_adjust_bottom_hall_effect : 1;
42 uint8_t top_disc : 1;
43 uint8_t bottom_disc : 1;
44 };
45 uint32_t digitals;
46 };
47
48 void NetworkToHost() {
49 using ::aos::ntoh;
50
51 gyro_angle = ntoh(gyro_angle);
52
53 right_drive = ntoh(right_drive);
54 left_drive = ntoh(left_drive);
55 shooter_angle = ntoh(shooter_angle);
56 shooter = ntoh(shooter);
57 indexer = ntoh(indexer);
58 wrist = ntoh(wrist);
59
60 capture_top_rise = ntoh(capture_top_rise);
61 capture_top_fall = ntoh(capture_top_fall);
62 capture_bottom_fall_delay = ntoh(capture_bottom_fall_delay);
63 capture_wrist_rise = ntoh(capture_wrist_rise);
64 capture_shooter_angle_rise = ntoh(capture_shooter_angle_rise);
65
66 digitals = ntoh(digitals);
67 }
68} __attribute__((__packed__));
69
70} // namespace frc971
71
72#endif // FRC971_INPUT_GYRO_BOARD_DATA_H_