Daniel Petti | 3fe3654 | 2013-09-25 04:18:24 +0000 | [diff] [blame^] | 1 | #ifndef FRC971_INPUT_GYRO_BOARD_DATA_H_ |
| 2 | #define FRC971_INPUT_GYRO_BOARD_DATA_H_ |
| 3 | |
| 4 | #include "aos/common/byteorder.h" |
| 5 | |
| 6 | namespace frc971 { |
| 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; |
| 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 | |
| 25 | uint8_t top_rise_count; |
| 26 | |
| 27 | uint8_t top_fall_count; |
| 28 | |
| 29 | uint8_t bottom_rise_count; |
| 30 | |
| 31 | uint8_t bottom_fall_delay_count; |
| 32 | uint8_t bottom_fall_count; |
| 33 | |
| 34 | uint8_t wrist_rise_count; |
| 35 | |
| 36 | uint8_t shooter_angle_rise_count; |
| 37 | |
| 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() { |
| 49 | // Apparently it sends the information out in little endian. |
| 50 | #if 0 |
| 51 | 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); |
| 69 | #endif |
| 70 | } |
| 71 | } __attribute__((__packed__)); |
| 72 | |
| 73 | } // namespace frc971 |
| 74 | |
| 75 | #endif // FRC971_INPUT_GYRO_BOARD_DATA_H_ |