blob: 3650e965500c8bf65c359a25dd3c4a97b224c728 [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
Brian Silverman59685152013-03-29 21:37:43 -070012 int32_t left_drive;
Brian Silverman98701db2013-04-10 16:37:52 -070013 int32_t right_drive;
Brian Silverman59685152013-03-29 21:37:43 -070014 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
Austin Schuhe9f09792013-03-30 10:05:45 +000025 uint8_t top_rise_count;
Brian Silverman59685152013-03-29 21:37:43 -070026
Austin Schuhe9f09792013-03-30 10:05:45 +000027 uint8_t top_fall_count;
Brian Silverman59685152013-03-29 21:37:43 -070028
Austin Schuhe9f09792013-03-30 10:05:45 +000029 uint8_t bottom_rise_count;
Brian Silverman59685152013-03-29 21:37:43 -070030
Austin Schuhe9f09792013-03-30 10:05:45 +000031 uint8_t bottom_fall_delay_count;
32 uint8_t bottom_fall_count;
Brian Silverman59685152013-03-29 21:37:43 -070033
Austin Schuhe9f09792013-03-30 10:05:45 +000034 uint8_t wrist_rise_count;
Brian Silverman59685152013-03-29 21:37:43 -070035
Austin Schuhe9f09792013-03-30 10:05:45 +000036 uint8_t shooter_angle_rise_count;
Brian Silverman59685152013-03-29 21:37:43 -070037
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;
Brian Silverman25329e62013-09-21 23:52:10 -070044 uint8_t loader_top : 1;
Brian Silverman59685152013-03-29 21:37:43 -070045 };
46 uint32_t digitals;
47 };
48
49 void NetworkToHost() {
Brian Silvermana4f9ef22013-03-30 14:31:16 -070050 // Apparently it sends the information out in little endian.
51#if 0
Brian Silverman59685152013-03-29 21:37:43 -070052 using ::aos::ntoh;
53
54 gyro_angle = ntoh(gyro_angle);
55
56 right_drive = ntoh(right_drive);
57 left_drive = ntoh(left_drive);
58 shooter_angle = ntoh(shooter_angle);
59 shooter = ntoh(shooter);
60 indexer = ntoh(indexer);
61 wrist = ntoh(wrist);
62
63 capture_top_rise = ntoh(capture_top_rise);
64 capture_top_fall = ntoh(capture_top_fall);
65 capture_bottom_fall_delay = ntoh(capture_bottom_fall_delay);
66 capture_wrist_rise = ntoh(capture_wrist_rise);
67 capture_shooter_angle_rise = ntoh(capture_shooter_angle_rise);
68
69 digitals = ntoh(digitals);
Brian Silvermana4f9ef22013-03-30 14:31:16 -070070#endif
Brian Silverman59685152013-03-29 21:37:43 -070071 }
72} __attribute__((__packed__));
73
74} // namespace frc971
75
76#endif // FRC971_INPUT_GYRO_BOARD_DATA_H_