Skip to content

Commit

Permalink
Fixed gain for ADC connected to VDD
Browse files Browse the repository at this point in the history
  • Loading branch information
hnhoan committed Jun 1, 2018
1 parent 39c5493 commit bc2e793
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ARM/Nordic/src/adc_nrf52_saadc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bc2e793

Please sign in to comment.