analogRead()fix for nrf52

https://github.com/sandeepmistry/arduino-
nRF5/commit/c98a190eb34c0247eb8e0764a6367c7f9e51d2fc
This commit is contained in:
hathach committed 2017-02-13 14:40:52 +07:00
1 parent 7bc3809495
commit df80f2e786
1 file changed
+5 -2
+5 -2
View File
@@ -28,6 +28,9 @@
extern "C" {
#endif
static uint32_t saadcReference = SAADC_CH_CONFIG_REFSEL_Internal;
static uint32_t saadcGain = SAADC_CH_CONFIG_GAIN_Gain1_5;
#define PWM_COUNT 3
static NRF_PWM_Type* pwms[PWM_COUNT] = {
@@ -41,8 +44,6 @@ static uint32_t pwmChannelPins[PWM_COUNT] = {
0xFFFFFFFF,
0xFFFFFFFF
};
static uint32_t saadcReference = SAADC_CH_CONFIG_REFSEL_Internal;
static uint16_t pwmChannelSequence[PWM_COUNT];
static int readResolution = 10;
@@ -93,10 +94,12 @@ void analogReference( eAnalogReference ulMode )
case AR_INTERNAL:
default:
saadcReference = SAADC_CH_CONFIG_REFSEL_Internal;
saadcGain = SAADC_CH_CONFIG_GAIN_Gain1_5;
break;
case AR_VDD4:
saadcReference = SAADC_CH_CONFIG_REFSEL_VDD1_4;
saadcGain = SAADC_CH_CONFIG_GAIN_Gain1_4;
break;
}
}