Added DMA and DMA synchronizer.
Pulled the dma setters out of year specific.
Change-Id: I4e797df52aa07edb5515f941113e7b43747622c9
diff --git a/frc971/wpilib/sensor_reader.h b/frc971/wpilib/sensor_reader.h
index 23646f1..a5c90ac 100644
--- a/frc971/wpilib/sensor_reader.h
+++ b/frc971/wpilib/sensor_reader.h
@@ -8,6 +8,8 @@
#include "aos/time/time.h"
#include "frc971/wpilib/ahal/DigitalGlitchFilter.h"
#include "frc971/wpilib/ahal/DigitalInput.h"
+#include "frc971/wpilib/dma.h"
+#include "frc971/wpilib/dma_edge_counting.h"
using ::aos::monotonic_clock;
namespace chrono = ::std::chrono;
@@ -19,6 +21,10 @@
public:
SensorReader();
+ // All of the DMA-related set_* calls must be made before this, and it
+ // doesn't hurt to do all of them.
+ void set_dma(::std::unique_ptr<DMA> dma);
+
void set_pwm_trigger(::std::unique_ptr<frc::DigitalInput> pwm_trigger);
protected:
@@ -35,6 +41,8 @@
monotonic_clock::min_time;
chrono::nanoseconds last_period_ = chrono::microseconds(5050);
+ ::std::unique_ptr<::frc971::wpilib::DMASynchronizer> dma_synchronizer_;
+
::std::atomic<bool> run_{true};
};