Made DMA compile again, and fixed analog bugs.
Change-Id: Ib4ff5fd48eddfc1e6f15b97fe6fda977258c96f7
diff --git a/aos/externals/forwpilib/dma.cc b/aos/externals/forwpilib/dma.cc
index 4517905..148ff29 100644
--- a/aos/externals/forwpilib/dma.cc
+++ b/aos/externals/forwpilib/dma.cc
@@ -380,7 +380,7 @@
return -1;
}
- if (encoder->GetFPGAIndex() >= 4) {
+ if (input->GetFPGAIndex() >= 4) {
wpi_setStaticErrorWithContext(dma_,
NiFpga_Status_ResourceNotFound,
getHALErrorMessage(NiFpga_Status_ResourceNotFound));
@@ -435,12 +435,12 @@
uint32_t dmaWord;
uint32_t channel = input->GetChannel();
- if (input->GetChannel() <= 3) {
+ if (channel <= 3) {
dmaWord = read_buffer_[offset(kEnable_AI0_Low) + channel / 2];
} else {
dmaWord = read_buffer_[offset(kEnable_AI0_High) + (channel - 4) / 2];
}
- if (channel % 1) {
+ if (channel % 2) {
return (dmaWord >> 16) & 0xffff;
} else {
return (dmaWord) & 0xffff;
diff --git a/frc971/wpilib/encoder_and_potentiometer.h b/frc971/wpilib/encoder_and_potentiometer.h
index 82fa9a8..2450841 100644
--- a/frc971/wpilib/encoder_and_potentiometer.h
+++ b/frc971/wpilib/encoder_and_potentiometer.h
@@ -141,7 +141,7 @@
dma->Add(encoder_.get());
dma->Add(index_.get());
dma->Add(potentiometer_.get());
- dma->SetExternalTrigger(index_.get(), true, false);
+ dma->SetExternalTrigger(index_.get(), true, true);
}
private: