From bc2e7937804ede50591857b21b70cf55e972204a Mon Sep 17 00:00:00 2001 From: Nguyen Hoan Hoang Date: Thu, 31 May 2018 23:01:43 -0400 Subject: [PATCH] Fixed gain for ADC connected to VDD --- ARM/Nordic/src/adc_nrf52_saadc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ARM/Nordic/src/adc_nrf52_saadc.cpp b/ARM/Nordic/src/adc_nrf52_saadc.cpp index ddb3ccd7..ffa48c03 100755 --- a/ARM/Nordic/src/adc_nrf52_saadc.cpp +++ b/ARM/Nordic/src/adc_nrf52_saadc.cpp @@ -533,6 +533,11 @@ bool AdcnRF52::OpenChannel(const ADC_CHAN_CFG *pChanCfg, int NbChan) chconfig |= ((5 + (31 - __builtin_clzl(pChanCfg[i].Gain >> 8))) << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk; } + if (pChanCfg[i].PinP.Conn == ADC_PIN_CONN_VDD) + { + s_AdcnRF52DevData.GainFactor[pChanCfg[i].Chan] *= 2.0; + } + if (pChanCfg[i].AcqTime < 5) { // Acquisition time 3us not need to set.