Skip to content

Commit

Permalink
analogRead()fix for nrf52
Browse files Browse the repository at this point in the history
https://github.com/sandeepmistry/arduino-
nRF5/commit/c98a190eb34c0247eb8e0764a6367c7f9e51d2fc
  • Loading branch information
hathach committed Feb 13, 2017
1 parent 7bc3809 commit df80f2e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cores/nRF5/wiring_analog_nRF52.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit df80f2e

Please sign in to comment.