finished up the fitpc pc side joystick reading code

This meant writing a nice OO api for reading joysticks.
It also involved redoing the wire format to fix byte-order problems and
get rid of the need for packing structs.
diff --git a/aos/common/input/driver_station_data.cc b/aos/common/input/driver_station_data.cc
new file mode 100644
index 0000000..803d46a
--- /dev/null
+++ b/aos/common/input/driver_station_data.cc
@@ -0,0 +1,74 @@
+#include "aos/common/input/driver_station_data.h"
+
+namespace aos {
+namespace input {
+namespace driver_station {
+
+Data::Data() : current_values_(), old_values_() {}
+
+void Data::Update(const NetworkRobotJoysticks &new_values) {
+  old_values_ = current_values_;
+  current_values_ = new_values;
+}
+
+namespace {
+
+bool GetButton(const ButtonLocation location,
+               const NetworkRobotJoysticks &values) {
+  return values.joysticks[location.joystick() - 1].buttons &
+      (1 << (location.number() - 1));
+}
+
+bool GetControlBitValue(const ControlBit bit,
+                        const NetworkRobotJoysticks &values) {
+  switch (bit) {
+    case ControlBit::kTestMode:
+      return values.control.test_mode();
+    case ControlBit::kFmsAttached:
+      return values.control.fms_attached();
+    case ControlBit::kAutonomous:
+      return values.control.autonomous();
+    case ControlBit::kEnabled:
+      return values.control.enabled();
+  }
+}
+
+}  // namespace
+
+bool Data::IsPressed(const ButtonLocation location) const {
+  return GetButton(location, current_values_);
+}
+
+bool Data::PosEdge(const ButtonLocation location) const {
+  return !GetButton(location, old_values_) &&
+      GetButton(location, current_values_);
+}
+
+bool Data::NegEdge(const ButtonLocation location) const {
+  return GetButton(location, old_values_) &&
+      !GetButton(location, current_values_);
+}
+
+bool Data::GetControlBit(const ControlBit bit) const {
+  return GetControlBitValue(bit, current_values_);
+}
+
+bool Data::PosEdge(const ControlBit bit) const {
+  return !GetControlBitValue(bit, old_values_) &&
+      GetControlBitValue(bit, current_values_);
+}
+
+bool Data::NegEdge(const ControlBit bit) const {
+  return GetControlBitValue(bit, old_values_) &&
+      !GetControlBitValue(bit, current_values_);
+}
+
+float Data::GetAxis(JoystickAxis axis) const {
+  // TODO(brians): check this math against what our joysticks report as their
+  // logical minimums and maximums
+  return current_values_.joysticks[axis.joystick()].axes[axis.number()] / 127.0;
+}
+
+}  // namespace driver_station
+}  // namespace input
+}  // namespace aos