Finish low level parts of the simple receiver code
It does the same motor test code still, but it's ready for real code to
be used instead.
Change-Id: Ie74f0b29f40ff25402adf7cbac0283262bd8f07c
diff --git a/motors/peripheral/adc.cc b/motors/peripheral/adc.cc
index 7232a45..90b1d0d 100644
--- a/motors/peripheral/adc.cc
+++ b/motors/peripheral/adc.cc
@@ -129,6 +129,13 @@
PORTB_PCR2 = PORT_PCR_MUX(0);
}
+void AdcInitSimple() {
+ AdcInitCommon();
+
+ // ENC_SIN ADC0_SE23
+ // ENC_COS ADC1_SE23
+}
+
MediumAdcReadings AdcReadMedium(const DisableInterrupts &) {
MediumAdcReadings r;
@@ -248,5 +255,20 @@
return r;
}
+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;
+}
+
} // namespace salsa
} // namespace frc971