Added basic drivetrain encoders to SensorReader.
Moved drivetrain out of year specific, shifters will still have to be
year specific.
Change-Id: I5fc2418b2b741432299792186a171de96f54dc15
diff --git a/frc971/wpilib/sensor_reader.h b/frc971/wpilib/sensor_reader.h
index a5c90ac..6453cef 100644
--- a/frc971/wpilib/sensor_reader.h
+++ b/frc971/wpilib/sensor_reader.h
@@ -21,13 +21,21 @@
public:
SensorReader();
- // All of the DMA-related set_* calls must be made before this, and it
- // doesn't hurt to do all of them.
+ // Sets the left drivetrain encoder.
+ void set_drivetrain_left_encoder(::std::unique_ptr<frc::Encoder> encoder);
+
+ // Sets the right drivetrain encoder.
+ void set_drivetrain_right_encoder(::std::unique_ptr<frc::Encoder> encoder);
+
+ // Sets the dma.
void set_dma(::std::unique_ptr<DMA> dma);
+ // Sets the pwm trigger.
void set_pwm_trigger(::std::unique_ptr<frc::DigitalInput> pwm_trigger);
protected:
+ // Uses the pwm trigger to find the pwm cycle width and offset for that
+ // iteration.
void RunPWMDetecter();
::std::unique_ptr<frc::DigitalInput> pwm_trigger_;
@@ -44,6 +52,9 @@
::std::unique_ptr<::frc971::wpilib::DMASynchronizer> dma_synchronizer_;
::std::atomic<bool> run_{true};
+
+ ::std::unique_ptr<frc::Encoder> drivetrain_left_encoder_,
+ drivetrain_right_encoder_;
};
} // namespace wpilib