blob: a3b60e59be61060ff9789362f89eb60013eecd6a [file] [log] [blame]
Daniel Pettibedbf8d2013-09-26 01:29:15 +00001#ifndef BOT3_INPUT_GYRO_BOARD_DATA_H_
2#define BOT3_INPUT_GYRO_BOARD_DATA_H_
Daniel Petti3fe36542013-09-25 04:18:24 +00003
4#include "aos/common/byteorder.h"
5
Daniel Pettibedbf8d2013-09-26 01:29:15 +00006namespace bot3 {
Daniel Petti3fe36542013-09-25 04:18:24 +00007
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 left_drive;
13 int32_t right_drive;
14 int32_t shooter_angle;
15 int32_t shooter;
Daniel Petti3fe36542013-09-25 04:18:24 +000016
17 int32_t capture_top_rise;
18 int32_t capture_top_fall;
19 int32_t capture_bottom_fall_delay;
Daniel Petti3fe36542013-09-25 04:18:24 +000020
21 uint8_t top_rise_count;
22
23 uint8_t top_fall_count;
24
25 uint8_t bottom_rise_count;
26
27 uint8_t bottom_fall_delay_count;
28 uint8_t bottom_fall_count;
29
Daniel Petti3fe36542013-09-25 04:18:24 +000030 union {
31 struct {
Daniel Petti3fe36542013-09-25 04:18:24 +000032 uint8_t top_disc : 1;
33 uint8_t bottom_disc : 1;
34 };
35 uint32_t digitals;
36 };
37
38 void NetworkToHost() {
39 // Apparently it sends the information out in little endian.
40#if 0
41 using ::aos::ntoh;
42
43 gyro_angle = ntoh(gyro_angle);
44
45 right_drive = ntoh(right_drive);
46 left_drive = ntoh(left_drive);
47 shooter_angle = ntoh(shooter_angle);
48 shooter = ntoh(shooter);
49 indexer = ntoh(indexer);
50 wrist = ntoh(wrist);
51
52 capture_top_rise = ntoh(capture_top_rise);
53 capture_top_fall = ntoh(capture_top_fall);
54 capture_bottom_fall_delay = ntoh(capture_bottom_fall_delay);
55 capture_wrist_rise = ntoh(capture_wrist_rise);
56 capture_shooter_angle_rise = ntoh(capture_shooter_angle_rise);
57
58 digitals = ntoh(digitals);
59#endif
60 }
61} __attribute__((__packed__));
62
Daniel Pettibedbf8d2013-09-26 01:29:15 +000063} // namespace bot3
Daniel Petti3fe36542013-09-25 04:18:24 +000064
Daniel Pettibedbf8d2013-09-26 01:29:15 +000065#endif // BOT3_INPUT_GYRO_BOARD_DATA_H_