fix(battery): change nRF52 ADC gain
With ADC pin, maximum 3.6V input needs gain 1/6 to be less than the 0.6V reference. With VDDHDIV5, maximum 6V input corresponds to 1.2V so gain 1/2 will be less than the 0.6V reference and be slightly more precise.
This commit is contained in:
parent
bbb27ac027
commit
2d777f1cbe
2 changed files with 2 additions and 2 deletions
|
@ -93,7 +93,7 @@ static int vddh_init(const struct device *dev) {
|
||||||
|
|
||||||
#ifdef CONFIG_ADC_NRFX_SAADC
|
#ifdef CONFIG_ADC_NRFX_SAADC
|
||||||
drv_data->acc = (struct adc_channel_cfg){
|
drv_data->acc = (struct adc_channel_cfg){
|
||||||
.gain = ADC_GAIN_1_5,
|
.gain = ADC_GAIN_1_2,
|
||||||
.reference = ADC_REF_INTERNAL,
|
.reference = ADC_REF_INTERNAL,
|
||||||
.acquisition_time = ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40),
|
.acquisition_time = ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40),
|
||||||
.input_positive = SAADC_CH_PSELN_PSELN_VDDHDIV5,
|
.input_positive = SAADC_CH_PSELN_PSELN_VDDHDIV5,
|
||||||
|
|
|
@ -140,7 +140,7 @@ static int bvd_init(const struct device *dev) {
|
||||||
|
|
||||||
#ifdef CONFIG_ADC_NRFX_SAADC
|
#ifdef CONFIG_ADC_NRFX_SAADC
|
||||||
drv_data->acc = (struct adc_channel_cfg){
|
drv_data->acc = (struct adc_channel_cfg){
|
||||||
.gain = ADC_GAIN_1_5,
|
.gain = ADC_GAIN_1_6,
|
||||||
.reference = ADC_REF_INTERNAL,
|
.reference = ADC_REF_INTERNAL,
|
||||||
.acquisition_time = ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40),
|
.acquisition_time = ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40),
|
||||||
.input_positive = SAADC_CH_PSELP_PSELP_AnalogInput0 + drv_cfg->io_channel.channel,
|
.input_positive = SAADC_CH_PSELP_PSELP_AnalogInput0 + drv_cfg->io_channel.channel,
|
||||||
|
|
Loading…
Add table
Reference in a new issue