Fixed using VDD as analog reference

The analog gain is a bit confusing as the input range is calculated by dividing Vref by the gain not multiplying. Using VDD as ref results in an input range of (VDD/4)/gain therefore if a range of 0...VDD is needed gain must be 1/4 not 4 (check p363 of product spec)
This commit is contained in:
Ureloc committed 2017-10-26 07:15:44 +02:00
1 parent 52752f378b
commit 501dba8f99
1 file changed
+1 -1
+1 -1
View File
@@ -98,7 +98,7 @@ void analogReference( eAnalogReference ulMode )
switch ( ulMode ) {
case AR_VDD4:
saadcReference = SAADC_CH_CONFIG_REFSEL_VDD1_4;
saadcGain = SAADC_CH_CONFIG_GAIN_Gain4;
saadcGain = SAADC_CH_CONFIG_GAIN_Gain1_4;
break;
case AR_INTERNAL_3_0:
saadcReference = SAADC_CH_CONFIG_REFSEL_Internal;