From 6948701ac49443bb89ef2f2d1d16734e7cefce8f Mon Sep 17 00:00:00 2001 From: Bexin3 <88098139+Bexin3@users.noreply.github.com> Date: Mon, 23 Jan 2023 20:06:34 +0000 Subject: [PATCH] Update ADCSetup.cpp --- src/ADCSetup.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ADCSetup.cpp b/src/ADCSetup.cpp index 5c9e3d5..a04758b 100644 --- a/src/ADCSetup.cpp +++ b/src/ADCSetup.cpp @@ -68,10 +68,10 @@ void AttachADC0(int ADCpin, bool IDACRefon) { if (IDACRefon) { ADC0->INPUTCTRL.bit.MUXNEG = 0; -ADC0->INPUTCTRL.bit.MUXPOS = ADCpin; +ADC0->INPUTCTRL.bit.MUXPOS = g_APinDescription[ADCpin].ulADCChannelNumber; } else { ADC0->INPUTCTRL.bit.MUXNEG = 0x18; -ADC0->INPUTCTRL.bit.MUXPOS = ADCpin; +ADC0->INPUTCTRL.bit.MUXPOS = g_APinDescription[ADCpin].ulADCChannelNumber; }; } @@ -99,10 +99,10 @@ int FastAnalogRead(int pin) { if (mp) { ADC0->INPUTCTRL.bit.MUXNEG = 0; -ADC0->INPUTCTRL.bit.MUXPOS = pin; +ADC0->INPUTCTRL.bit.MUXPOS = g_APinDescription[pin].ulADCChannelNumber; } else { ADC0->INPUTCTRL.bit.MUXNEG = 0x18; -ADC0->INPUTCTRL.bit.MUXPOS = pin; +ADC0->INPUTCTRL.bit.MUXPOS = g_APinDescription[pin].ulADCChannelNumber; }; //while (ADC->STATUS.bit.SYNCBUSY) {}; ADC0->SWTRIG.bit.START = true; //Start reading again @@ -178,10 +178,10 @@ void AttachADC1(int ADCpin, bool IDACRefon) { if (IDACRefon) { ADC1->INPUTCTRL.bit.MUXNEG = 0; -ADC1->INPUTCTRL.bit.MUXPOS = ADCpin; +ADC1->INPUTCTRL.bit.MUXPOS = g_APinDescription[ADCpin].ulADCChannelNumber; } else { ADC1->INPUTCTRL.bit.MUXNEG = 0x18; -ADC1->INPUTCTRL.bit.MUXPOS = ADCpin; +ADC1->INPUTCTRL.bit.MUXPOS = g_APinDescription[ADCpin].ulADCChannelNumber; }; }