added logging of edges on control bits
diff --git a/aos/atom_code/input/JoystickInput.cpp b/aos/atom_code/input/JoystickInput.cpp
deleted file mode 100644
index 2c3b3b9..0000000
--- a/aos/atom_code/input/JoystickInput.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "aos/atom_code/input/JoystickInput.h"
-
-#include "aos/common/Configuration.h"
-#include "aos/common/network/ReceiveSocket.h"
-#include "aos/common/messages/RobotState.q.h"
-
-namespace aos {
-
-void JoystickInput::SetupButtons() {
-  for (int i = 0; i < 4; ++i) {
-    old_buttons[i] = buttons[i];
-  }
-  buttons[0] = control_data_.stick0Buttons;
-  buttons[1] = control_data_.stick1Buttons;
-  buttons[2] = control_data_.stick2Buttons;
-  buttons[3] = control_data_.stick3Buttons;
-
-  // Put the ENABLED, AUTONOMOUS, and FMS_ATTACHED values into unused bits in
-  // the values for joystick 0 so that PosEdge and NegEdge can be used with
-  // them.
-  // Windows only supports 12 buttons, so we know there will never be any more.
-  // Not using MASK because it doesn't make it any cleaner.
-  buttons[0] |= (control_data_.enabled << (ENABLED - 9)) |
-      (control_data_.autonomous << (AUTONOMOUS - 9)) |
-      (control_data_.fmsAttached << (FMS_ATTACHED - 9));
-
-  for (int j = 0; j < 4; ++j) {
-    for (int k = 1; k <= 12; ++k) {
-      if (PosEdge(j, k)) {
-        LOG(INFO, "PosEdge(%d, %d)\n", j, k);
-      }
-      if (NegEdge(j, k)) {
-        LOG(INFO, "NegEdge(%d, %d)\n", j, k);
-      }
-    }
-  }
-  if (PosEdge(0, ENABLED)) LOG(INFO, "PosEdge(ENABLED)\n");
-  if (NegEdge(0, ENABLED)) LOG(INFO, "NegEdge(ENABLED)\n");
-  if (PosEdge(0, AUTONOMOUS)) LOG(INFO, "PosEdge(AUTONOMOUS)\n");
-  if (NegEdge(0, AUTONOMOUS)) LOG(INFO, "NegEdge(AUTONOMOUS)\n");
-  if (PosEdge(0, FMS_ATTACHED)) LOG(INFO, "PosEdge(FMS_ATTACHED)\n");
-  if (NegEdge(0, FMS_ATTACHED)) LOG(INFO, "NegEdge(FMS_ATTACHED)\n");
-}
-
-void JoystickInput::Run() {
-  ReceiveSocket sock(NetworkPort::kDS);
-  while (true) {
-    if (sock.Receive(&control_data_, sizeof(control_data_)) !=
-        sizeof(control_data_)) {
-      LOG(WARNING, "socket receive failed\n");
-      continue;
-    }
-    SetupButtons();
-    if (!robot_state.MakeWithBuilder()
-        .enabled(Pressed(0, ENABLED))
-        .autonomous(Pressed(0, AUTONOMOUS))
-        .team_id(ntohs(control_data_.teamID))
-        .Send()) {
-			LOG(WARNING, "sending robot_state failed\n");
-		}
-		if (robot_state.FetchLatest()) {
-    	char state[1024];
-    	robot_state->Print(state, sizeof(state));
-    	LOG(DEBUG, "robot_state={%s}\n", state);
-		} else {
-			LOG(WARNING, "fetching robot_state failed\n");
-		}
-    RunIteration();
-  }
-}
-
-}  // namespace aos
-
diff --git a/aos/atom_code/input/JoystickInput.h b/aos/atom_code/input/JoystickInput.h
deleted file mode 100644
index 313ad0a..0000000
--- a/aos/atom_code/input/JoystickInput.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef AOS_INPUT_JOYSTICK_INPUT_H_
-#define AOS_INPUT_JOYSTICK_INPUT_H_
-
-#include "FRCComm.h"
-
-namespace aos {
-
-// Class for implementing atom code that reads the joystick values from the
-// cRIO.
-// Designed for a subclass that implements RunIteration to be instantiated and
-// Runed.
-// TODO(brians): rewrite this with OO buttons/fms state etc
-class JoystickInput {
- private:
-  uint16_t buttons[4], old_buttons[4];
-  inline uint16_t MASK(int button) {
-    return 1 << ((button > 8) ? (button - 9) : (button + 7));
-  }
-  void SetupButtons();
- protected:
-  FRCCommonControlData control_data_;
-
-  // Constants that retrieve data when used with joystick 0.
-  static const int ENABLED = 13;
-  static const int AUTONOMOUS = 14;
-  static const int FMS_ATTACHED = 15;
-  bool Pressed(int stick, int button) {
-	  return buttons[stick] & MASK(button);
-  }
-  bool PosEdge(int stick, int button) {
-	  return !(old_buttons[stick] & MASK(button)) && (buttons[stick] & MASK(button));
-  }
-  bool NegEdge(int stick, int button) {
-	  return (old_buttons[stick] & MASK(button)) && !(buttons[stick] & MASK(button));
-  }
-
-  virtual void RunIteration() = 0;
- public:
-  // Enters an infinite loop that reads values and calls RunIteration.
-  void Run();
-};
-
-} // namespace aos
-
-#endif
-
diff --git a/aos/atom_code/input/joystick_input.cc b/aos/atom_code/input/joystick_input.cc
index 28618ed..97b2c95 100644
--- a/aos/atom_code/input/joystick_input.cc
+++ b/aos/atom_code/input/joystick_input.cc
@@ -62,6 +62,26 @@
           }
         }
       }
+
+      using driver_station::ControlBit;
+      if (data.PosEdge(ControlBit::kFmsAttached)) {
+        LOG(INFO, "PosEdge(kFmsAttached)\n");
+      }
+      if (data.NegEdge(ControlBit::kFmsAttached)) {
+        LOG(INFO, "NegEdge(kFmsAttached)\n");
+      }
+      if (data.PosEdge(ControlBit::kAutonomous)) {
+        LOG(INFO, "PosEdge(kAutonomous)\n");
+      }
+      if (data.NegEdge(ControlBit::kAutonomous)) {
+        LOG(INFO, "NegEdge(kAutonomous)\n");
+      }
+      if (data.PosEdge(ControlBit::kEnabled)) {
+        LOG(INFO, "PosEdge(kEnabled)\n");
+      }
+      if (data.NegEdge(ControlBit::kEnabled)) {
+        LOG(INFO, "NegEdge(kEnabled)\n");
+      }
     }
 
     RunIteration(data);