blob: cc0a4dbb3727508813693e465a15eec5abe0c3d1 [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 Silverman004ec812013-09-26 15:47:58 -070045 uint8_t loader_bottom : 1;
Brian Silverman59685152013-03-29 21:37:43 -070046 };
47 uint32_t digitals;
48 };
49
50 void NetworkToHost() {
Brian Silvermana4f9ef22013-03-30 14:31:16 -070051 // Apparently it sends the information out in little endian.
52#if 0
Brian Silverman59685152013-03-29 21:37:43 -070053 using ::aos::ntoh;
54
55 gyro_angle = ntoh(gyro_angle);
56
57 right_drive = ntoh(right_drive);
58 left_drive = ntoh(left_drive);
59 shooter_angle = ntoh(shooter_angle);
60 shooter = ntoh(shooter);
61 indexer = ntoh(indexer);
62 wrist = ntoh(wrist);
63
64 capture_top_rise = ntoh(capture_top_rise);
65 capture_top_fall = ntoh(capture_top_fall);
66 capture_bottom_fall_delay = ntoh(capture_bottom_fall_delay);
67 capture_wrist_rise = ntoh(capture_wrist_rise);
68 capture_shooter_angle_rise = ntoh(capture_shooter_angle_rise);
69
70 digitals = ntoh(digitals);
Brian Silvermana4f9ef22013-03-30 14:31:16 -070071#endif
Brian Silverman59685152013-03-29 21:37:43 -070072 }
73} __attribute__((__packed__));
74
75} // namespace frc971
76
77#endif // FRC971_INPUT_GYRO_BOARD_DATA_H_