Merge changes Ie49be384,I9e45a220,Ic942ab67,I127da046

* changes:
  Handled WPILib stupidly #defineing ERROR and get everything building.
  Used new WPILIB2015 macro to mark differences with the old WPILib.
  Added a layer of abstraction to make switching WPILibs easy.
  Removed HallEffect class usage from //bot3/
diff --git a/aos/externals/BUILD b/aos/externals/BUILD
index 0991067..e42db6c 100644
--- a/aos/externals/BUILD
+++ b/aos/externals/BUILD
@@ -8,7 +8,7 @@
 ]
 
 cc_library(
-  name = 'wpilib',
+  name = 'wpilib_2015',
   visibility = ['//visibility:public'],
   srcs = glob([
     'allwpilib/wpilibc/wpilibC++/src/*.cpp',
@@ -35,4 +35,15 @@
     '-lspi',
     '-li2c',
   ],
+  defines = [
+    'WPILIB2015=1',
+  ],
+)
+
+cc_library(
+  name = 'wpilib',
+  visibility = ['//visibility:public'],
+  deps = [
+    ':wpilib_2015',
+  ],
 )
diff --git a/aos/externals/forwpilib/dma.cc b/aos/externals/forwpilib/dma.cc
index 148ff29..3d41c43 100644
--- a/aos/externals/forwpilib/dma.cc
+++ b/aos/externals/forwpilib/dma.cc
@@ -175,7 +175,7 @@
     return;
   }
 
-  nFPGA::nFRC_2015_1_0_A::tDMA::tExternalTriggers new_trigger;
+  nFPGA::nRoboRIO_FPGANamespace::tDMA::tExternalTriggers new_trigger;
 
   new_trigger.FallingEdge = falling;
   new_trigger.RisingEdge = rising;
diff --git a/bot3/wpilib/BUILD b/bot3/wpilib/BUILD
index 0ee1460..77b90b8 100644
--- a/bot3/wpilib/BUILD
+++ b/bot3/wpilib/BUILD
@@ -18,7 +18,6 @@
     '//aos/common/messages:robot_state',
     '//aos/common/util:phased_loop',
     '//aos/common/util:wrapping_counter',
-    '//frc971/wpilib:hall_effect',
     '//frc971/wpilib:joystick_sender',
     '//frc971/wpilib:loop_output_handler',
     '//frc971/wpilib:buffered_pcm',
diff --git a/bot3/wpilib/wpilib_interface.cc b/bot3/wpilib/wpilib_interface.cc
index 36e14ad..e1cc670 100644
--- a/bot3/wpilib/wpilib_interface.cc
+++ b/bot3/wpilib/wpilib_interface.cc
@@ -7,6 +7,21 @@
 #include <mutex>
 #include <functional>
 
+#include "Encoder.h"
+#include "Talon.h"
+#include "DriverStation.h"
+#include "AnalogInput.h"
+#include "Compressor.h"
+#include "Relay.h"
+#include "RobotBase.h"
+#include "dma.h"
+#include "ControllerPower.h"
+#ifndef WPILIB2015
+#include "DigitalGlitchFilter.h"
+#endif
+#include "DigitalInput.h"
+#undef ERROR
+
 #include "aos/common/logging/logging.h"
 #include "aos/common/logging/queue_logging.h"
 #include "aos/common/time.h"
@@ -23,7 +38,6 @@
 #include "bot3/control_loops/intake/intake.q.h"
 #include "bot3/autonomous/auto.q.h"
 
-#include "frc971/wpilib/hall_effect.h"
 #include "frc971/wpilib/joystick_sender.h"
 #include "frc971/wpilib/loop_output_handler.h"
 #include "frc971/wpilib/buffered_solenoid.h"
@@ -34,15 +48,6 @@
 #include "bot3/control_loops/elevator/elevator.h"
 #include "bot3/control_loops/intake/intake.h"
 
-#include "Encoder.h"
-#include "Talon.h"
-#include "DriverStation.h"
-#include "AnalogInput.h"
-#include "Compressor.h"
-#include "Relay.h"
-#include "RobotBase.h"
-#include "dma.h"
-#include "ControllerPower.h"
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
@@ -57,7 +62,6 @@
 using ::frc971::wpilib::LoopOutputHandler;
 using ::frc971::wpilib::JoystickSender;
 using ::frc971::wpilib::GyroSender;
-using ::frc971::wpilib::HallEffect;
 
 namespace bot3 {
 namespace wpilib {
@@ -105,7 +109,7 @@
     elevator_encoder_ = ::std::move(encoder);
   }
 
-  void set_elevator_zeroing_hall_effect(::std::unique_ptr<HallEffect> hall) {
+  void set_elevator_zeroing_hall_effect(::std::unique_ptr<DigitalInput> hall) {
     zeroing_hall_effect_ = ::std::move(hall);
   }
 
@@ -118,7 +122,12 @@
     ::aos::SetCurrentThreadName("SensorReader");
 
     my_pid_ = getpid();
-    ds_ = DriverStation::GetInstance();
+    ds_ =
+#ifdef WPILIB2015
+        DriverStation::GetInstance();
+#else
+        &DriverStation::GetInstance();
+#endif
 
     LOG(INFO, "Things are now started\n");
 
@@ -168,7 +177,7 @@
       auto elevator_message = elevator_queue.position.MakeMessage();
       elevator_message->encoder =
           elevator_translate(elevator_encoder_->GetRaw());
-      elevator_message->bottom_hall_effect = zeroing_hall_effect_->Get();
+      elevator_message->bottom_hall_effect = !zeroing_hall_effect_->Get();
       elevator_message->has_tote = tote_sensor_->GetVoltage() > 2.5;
 
       elevator_message.Send();
@@ -191,7 +200,7 @@
   DriverStation *ds_;
 
   ::std::unique_ptr<Encoder> left_encoder_, right_encoder_, elevator_encoder_;
-  ::std::unique_ptr<HallEffect> zeroing_hall_effect_;
+  ::std::unique_ptr<DigitalInput> zeroing_hall_effect_;
   ::std::unique_ptr<AnalogInput> tote_sensor_;
 
   ::std::atomic<bool> run_{true};
@@ -207,7 +216,7 @@
         intake_(".bot3.control_loops.intake_queue.output"),
         can_grabber_control_(".bot3.autonomous.can_grabber_control") {}
 
-  void set_pressure_switch(::std::unique_ptr<DigitalSource> pressure_switch) {
+  void set_pressure_switch(::std::unique_ptr<DigitalInput> pressure_switch) {
     pressure_switch_ = ::std::move(pressure_switch);
   }
 
@@ -300,7 +309,7 @@
   ::std::unique_ptr<BufferedSolenoid> intake_claw_;
   ::std::unique_ptr<BufferedSolenoid> can_grabber_;
 
-  ::std::unique_ptr<DigitalSource> pressure_switch_;
+  ::std::unique_ptr<DigitalInput> pressure_switch_;
   ::std::unique_ptr<Relay> compressor_relay_;
 
   ::aos::Queue<::bot3::control_loops::ElevatorQueue::Output> elevator_;
@@ -465,7 +474,7 @@
     LOG(INFO, "Creating the reader\n");
 
     reader.set_elevator_encoder(encoder(6));
-    reader.set_elevator_zeroing_hall_effect(make_unique<HallEffect>(6));
+    reader.set_elevator_zeroing_hall_effect(make_unique<DigitalInput>(6));
 
     reader.set_left_encoder(encoder(0));
     reader.set_right_encoder(encoder(1));
diff --git a/frc971/wpilib/buffered_pcm.h b/frc971/wpilib/buffered_pcm.h
index 50f86fc..288cdfb 100644
--- a/frc971/wpilib/buffered_pcm.h
+++ b/frc971/wpilib/buffered_pcm.h
@@ -4,6 +4,7 @@
 #include <memory>
 
 #include "SolenoidBase.h"
+#undef ERROR
 
 #include "frc971/wpilib/buffered_solenoid.h"
 
@@ -29,7 +30,9 @@
 
  private:
   // WPILib declares this pure virtual and then never calls it...
+#ifdef WPILIB2015
   virtual void InitSolenoid() override {}
+#endif
 
   void Set(int number, bool value);
 
diff --git a/frc971/wpilib/gyro_interface.h b/frc971/wpilib/gyro_interface.h
index 05b9bff..cd734a9 100644
--- a/frc971/wpilib/gyro_interface.h
+++ b/frc971/wpilib/gyro_interface.h
@@ -4,6 +4,7 @@
 #include <memory>
 
 #include "SPI.h"
+#undef ERROR
 
 namespace frc971 {
 namespace wpilib {
diff --git a/frc971/wpilib/hall_effect.h b/frc971/wpilib/hall_effect.h
index 407f2b9..d95b717 100644
--- a/frc971/wpilib/hall_effect.h
+++ b/frc971/wpilib/hall_effect.h
@@ -2,6 +2,7 @@
 #define FRC971_WPILIB_HALL_EFFECT_H_
 
 #include "DigitalInput.h"
+#undef ERROR
 
 namespace frc971 {
 namespace wpilib {
diff --git a/frc971/wpilib/joystick_sender.cc b/frc971/wpilib/joystick_sender.cc
index 236cc0f..4942eaa 100644
--- a/frc971/wpilib/joystick_sender.cc
+++ b/frc971/wpilib/joystick_sender.cc
@@ -12,7 +12,12 @@
 namespace wpilib {
 
 void JoystickSender::operator()() {
-  DriverStation *ds = DriverStation::GetInstance();
+  DriverStation *ds =
+#ifdef WPILIB2015
+      DriverStation::GetInstance();
+#else
+      &DriverStation::GetInstance();
+#endif
   ::aos::SetCurrentThreadName("DSReader");
   uint16_t team_id = ::aos::network::GetTeamNumber();
 
diff --git a/y2014/wpilib/wpilib_interface.cc b/y2014/wpilib/wpilib_interface.cc
index ffb10e2..3977300 100644
--- a/y2014/wpilib/wpilib_interface.cc
+++ b/y2014/wpilib/wpilib_interface.cc
@@ -7,6 +7,20 @@
 #include <mutex>
 #include <functional>
 
+#include "Encoder.h"
+#include "Talon.h"
+#include "DriverStation.h"
+#include "AnalogInput.h"
+#include "Compressor.h"
+#include "Relay.h"
+#include "RobotBase.h"
+#include "dma.h"
+#include "ControllerPower.h"
+#ifndef WPILIB2015
+#include "DigitalGlitchFilter.h"
+#endif
+#undef ERROR
+
 #include "aos/common/logging/logging.h"
 #include "aos/common/logging/queue_logging.h"
 #include "aos/common/time.h"
@@ -35,16 +49,6 @@
 #include "frc971/wpilib/encoder_and_potentiometer.h"
 #include "frc971/wpilib/logging.q.h"
 
-#include "Encoder.h"
-#include "Talon.h"
-#include "DriverStation.h"
-#include "AnalogInput.h"
-#include "Compressor.h"
-#include "Relay.h"
-#include "RobotBase.h"
-#include "dma.h"
-#include "ControllerPower.h"
-
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
 #endif
@@ -235,7 +239,12 @@
     LOG(INFO, "In sensor reader thread\n");
 
     my_pid_ = getpid();
-    ds_ = DriverStation::GetInstance();
+    ds_ =
+#ifdef WPILIB2015
+        DriverStation::GetInstance();
+#else
+        &DriverStation::GetInstance();
+#endif
 
     top_reader_.Start();
     bottom_reader_.Start();
diff --git a/y2015/wpilib/wpilib_interface.cc b/y2015/wpilib/wpilib_interface.cc
index 758ecf1..76d5976 100644
--- a/y2015/wpilib/wpilib_interface.cc
+++ b/y2015/wpilib/wpilib_interface.cc
@@ -7,6 +7,20 @@
 #include <mutex>
 #include <functional>
 
+#include "Encoder.h"
+#include "Talon.h"
+#include "DriverStation.h"
+#include "AnalogInput.h"
+#include "Compressor.h"
+#include "Relay.h"
+#include "RobotBase.h"
+#include "dma.h"
+#include "ControllerPower.h"
+#ifndef WPILIB2015
+#include "DigitalGlitchFilter.h"
+#endif
+#undef ERROR
+
 #include "aos/common/logging/logging.h"
 #include "aos/common/logging/queue_logging.h"
 #include "aos/common/time.h"
@@ -35,16 +49,6 @@
 #include "frc971/wpilib/encoder_and_potentiometer.h"
 #include "frc971/wpilib/logging.q.h"
 
-#include "Encoder.h"
-#include "Talon.h"
-#include "DriverStation.h"
-#include "AnalogInput.h"
-#include "Compressor.h"
-#include "Relay.h"
-#include "RobotBase.h"
-#include "dma.h"
-#include "ControllerPower.h"
-
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
 #endif
@@ -127,7 +131,7 @@
     arm_left_encoder_.set_encoder(::std::move(encoder));
   }
 
-  void set_arm_left_index(::std::unique_ptr<DigitalSource> index) {
+  void set_arm_left_index(::std::unique_ptr<DigitalInput> index) {
     filter_.Add(index.get());
     arm_left_encoder_.set_index(::std::move(index));
   }
@@ -142,7 +146,7 @@
     arm_right_encoder_.set_encoder(::std::move(encoder));
   }
 
-  void set_arm_right_index(::std::unique_ptr<DigitalSource> index) {
+  void set_arm_right_index(::std::unique_ptr<DigitalInput> index) {
     filter_.Add(index.get());
     arm_right_encoder_.set_index(::std::move(index));
   }
@@ -157,7 +161,7 @@
     elevator_left_encoder_.set_encoder(::std::move(encoder));
   }
 
-  void set_elevator_left_index(::std::unique_ptr<DigitalSource> index) {
+  void set_elevator_left_index(::std::unique_ptr<DigitalInput> index) {
     filter_.Add(index.get());
     elevator_left_encoder_.set_index(::std::move(index));
   }
@@ -172,7 +176,7 @@
     elevator_right_encoder_.set_encoder(::std::move(encoder));
   }
 
-  void set_elevator_right_index(::std::unique_ptr<DigitalSource> index) {
+  void set_elevator_right_index(::std::unique_ptr<DigitalInput> index) {
     filter_.Add(index.get());
     elevator_right_encoder_.set_index(::std::move(index));
   }
@@ -187,7 +191,7 @@
     wrist_encoder_.set_encoder(::std::move(encoder));
   }
 
-  void set_wrist_index(::std::unique_ptr<DigitalSource> index) {
+  void set_wrist_index(::std::unique_ptr<DigitalInput> index) {
     filter_.Add(index.get());
     wrist_encoder_.set_index(::std::move(index));
   }
@@ -219,7 +223,12 @@
     ::aos::SetCurrentThreadName("SensorReader");
 
     my_pid_ = getpid();
-    ds_ = DriverStation::GetInstance();
+    ds_ =
+#ifdef WPILIB2015
+        DriverStation::GetInstance();
+#else
+        &DriverStation::GetInstance();
+#endif
 
     wrist_encoder_.Start();
     dma_synchronizer_->Start();
@@ -369,7 +378,7 @@
         fridge_(".frc971.control_loops.fridge_queue.output"),
         claw_(".frc971.control_loops.claw_queue.output") {}
 
-  void set_pressure_switch(::std::unique_ptr<DigitalSource> pressure_switch) {
+  void set_pressure_switch(::std::unique_ptr<DigitalInput> pressure_switch) {
     pressure_switch_ = ::std::move(pressure_switch);
   }
 
@@ -469,7 +478,7 @@
   ::std::unique_ptr<BufferedSolenoid> claw_pinchers_;
   ::std::unique_ptr<BufferedSolenoid> grabber_latch_release_;
   ::std::unique_ptr<BufferedSolenoid> grabber_fold_up_;
-  ::std::unique_ptr<DigitalSource> pressure_switch_;
+  ::std::unique_ptr<DigitalInput> pressure_switch_;
   ::std::unique_ptr<Relay> compressor_relay_;
 
   ::aos::Queue<::frc971::control_loops::FridgeQueue::Output> fridge_;