Daniel Petti | bedbf8d | 2013-09-26 01:29:15 +0000 | [diff] [blame] | 1 | #ifndef BOT3_INPUT_GYRO_BOARD_DATA_H_ |
| 2 | #define BOT3_INPUT_GYRO_BOARD_DATA_H_ |
Daniel Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame] | 3 | |
| 4 | #include "aos/common/byteorder.h" |
| 5 | |
Daniel Petti | bedbf8d | 2013-09-26 01:29:15 +0000 | [diff] [blame] | 6 | namespace bot3 { |
Daniel Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame] | 7 | |
| 8 | // The struct that the gyro board sends out with all of the data in it. |
| 9 | struct 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 Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame] | 16 | |
| 17 | int32_t capture_top_rise; |
| 18 | int32_t capture_top_fall; |
| 19 | int32_t capture_bottom_fall_delay; |
Daniel Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame] | 20 | |
| 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 Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame] | 30 | union { |
| 31 | struct { |
Daniel Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame] | 32 | 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 Petti | bedbf8d | 2013-09-26 01:29:15 +0000 | [diff] [blame] | 63 | } // namespace bot3 |
Daniel Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame] | 64 | |
Daniel Petti | bedbf8d | 2013-09-26 01:29:15 +0000 | [diff] [blame] | 65 | #endif // BOT3_INPUT_GYRO_BOARD_DATA_H_ |