Move ADC code into individual boards where it belongs
Change-Id: Id8c2db1166c6e07caaf7d3ccc503bade4ec198f6
diff --git a/motors/simple_receiver.cc b/motors/simple_receiver.cc
index 49f5ecb..20ca298 100644
--- a/motors/simple_receiver.cc
+++ b/motors/simple_receiver.cc
@@ -29,6 +29,32 @@
using ::frc971::control_loops::DrivetrainQueue_Output;
using ::motors::seems_reasonable::Spring;
+struct SimpleAdcReadings {
+ uint16_t sin, cos;
+};
+
+void AdcInitSimple() {
+ AdcInitCommon();
+
+ // ENC_SIN ADC0_SE23
+ // ENC_COS ADC1_SE23
+}
+
+SimpleAdcReadings AdcReadSimple(const DisableInterrupts &) {
+ SimpleAdcReadings r;
+
+ ADC0_SC1A = 23;
+ ADC1_SC1A = 23;
+ while (!(ADC0_SC1A & ADC_SC1_COCO)) {
+ }
+ while (!(ADC1_SC1A & ADC_SC1_COCO)) {
+ }
+ r.sin = ADC0_RA;
+ r.cos = ADC1_RA;
+
+ return r;
+}
+
const ShifterHallEffect kThreeStateDriveShifter{0.0, 0.0, 0.25, 0.75};
const DrivetrainConfig<float> &GetDrivetrainConfig() {