Add a hook in the IMU code for the camera board communications

Change-Id: Ib667ba814ce1e3e376252bba3375bedcf98ff707
diff --git a/frc971/wpilib/ADIS16448.cc b/frc971/wpilib/ADIS16448.cc
index 6c4a6d1..1107602 100644
--- a/frc971/wpilib/ADIS16448.cc
+++ b/frc971/wpilib/ADIS16448.cc
@@ -122,6 +122,8 @@
     : spi_(new frc::SPI(port)), dio1_(dio1) {
   // 1MHz is the maximum supported for burst reads, but we
   // want to go slower to hopefully make it more reliable.
+  // Note that the roboRIO's minimum supported clock rate appears to be
+  // 0.781MHz, so that's what this actually does.
   spi_->SetClockRate(1e5);
   spi_->SetChipSelectActiveLow();
   spi_->SetClockActiveLow();
@@ -298,6 +300,8 @@
     if (!message.Send()) {
       LOG(WARNING, "sending queue message failed\n");
     }
+
+    spi_idle_callback_();
   }
 }
 
diff --git a/frc971/wpilib/ADIS16448.h b/frc971/wpilib/ADIS16448.h
index a631fee..1846723 100644
--- a/frc971/wpilib/ADIS16448.h
+++ b/frc971/wpilib/ADIS16448.h
@@ -45,6 +45,10 @@
   // readings.
   void operator()();
 
+  void set_spi_idle_callback(std::function<void()> spi_idle_callback) {
+    spi_idle_callback_ = std::move(spi_idle_callback);
+  }
+
   void Quit() { run_ = false; }
 
   double gyro_x_zeroed_offset() const { return gyro_x_zeroed_offset_; }
@@ -89,6 +93,7 @@
   frc::DigitalInput *const dio1_;
   frc::DigitalOutput *reset_ = nullptr;
 
+  std::function<void()> spi_idle_callback_ = []() {};
   ::std::atomic<bool> run_{true};
 
   // The averaged values of the gyro over 6 seconds after power up.