blob: 10135e3524e40964a5c5f48adc7f83203de105ea [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;
44 };
45 uint32_t digitals;
46 };
47
48 void NetworkToHost() {
Brian Silvermana4f9ef22013-03-30 14:31:16 -070049 // Apparently it sends the information out in little endian.
50#if 0
Brian Silverman59685152013-03-29 21:37:43 -070051 using ::aos::ntoh;
52
53 gyro_angle = ntoh(gyro_angle);
54
55 right_drive = ntoh(right_drive);
56 left_drive = ntoh(left_drive);
57 shooter_angle = ntoh(shooter_angle);
58 shooter = ntoh(shooter);
59 indexer = ntoh(indexer);
60 wrist = ntoh(wrist);
61
62 capture_top_rise = ntoh(capture_top_rise);
63 capture_top_fall = ntoh(capture_top_fall);
64 capture_bottom_fall_delay = ntoh(capture_bottom_fall_delay);
65 capture_wrist_rise = ntoh(capture_wrist_rise);
66 capture_shooter_angle_rise = ntoh(capture_shooter_angle_rise);
67
68 digitals = ntoh(digitals);
Brian Silvermana4f9ef22013-03-30 14:31:16 -070069#endif
Brian Silverman59685152013-03-29 21:37:43 -070070 }
71} __attribute__((__packed__));
72
73} // namespace frc971
74
75#endif // FRC971_INPUT_GYRO_BOARD_DATA_H_