Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-nRF5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-nRF5
Commits
98444beb
Commit
98444beb
authored
May 07, 2017
by
Sandeep Mistry
Committed by
GitHub
May 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #152 from carlosperate/adc_default
Set nRF51 default ADC to 1/3 prescaler and 1/3 reference voltage
parents
6418b198
c6a6d043
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
cores/nRF5/wiring_analog_nRF51.c
cores/nRF5/wiring_analog_nRF51.c
+10
-10
No files found.
cores/nRF5/wiring_analog_nRF51.c
View file @
98444beb
...
...
@@ -47,7 +47,7 @@ static struct PWMContext pwmContext[PWM_COUNT] = {
static
int
timerEnabled
=
0
;
static
uint32_t
adcReference
=
ADC_CONFIG_REFSEL_
VBG
;
static
uint32_t
adcReference
=
ADC_CONFIG_REFSEL_
SupplyOneThirdPrescaling
;
static
uint32_t
adcPrescaling
=
ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling
;
static
uint32_t
readResolution
=
10
;
...
...
@@ -89,10 +89,8 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to
*/
void
analogReference
(
eAnalogReference
ulMode
)
{
switch
(
ulMode
)
{
case
AR_DEFAULT
:
switch
(
ulMode
)
{
case
AR_VBG
:
default:
// 1.2 Reference, 1/3 prescaler = 0 V - 3.6 V range
// Minimum VDD for full range in safe operation = 3.3V
adcReference
=
ADC_CONFIG_REFSEL_VBG
;
...
...
@@ -105,12 +103,6 @@ void analogReference( eAnalogReference ulMode )
adcPrescaling
=
ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling
;
break
;
case
AR_SUPPLY_ONE_THIRD
:
// 1/3 VDD Reference, 1/3 prescaler = 0 V - VDD range
adcReference
=
ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling
;
adcPrescaling
=
ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling
;
break
;
case
AR_EXT0
:
// ARF0 reference, 2/3 prescaler = 0 V - 1.5 ARF0
adcReference
=
ADC_CONFIG_REFSEL_External
|
(
ADC_CONFIG_EXTREFSEL_AnalogReference0
<<
ADC_CONFIG_EXTREFSEL_Pos
);
...
...
@@ -122,6 +114,14 @@ void analogReference( eAnalogReference ulMode )
adcReference
=
(
ADC_CONFIG_REFSEL_External
|
ADC_CONFIG_EXTREFSEL_AnalogReference1
<<
ADC_CONFIG_EXTREFSEL_Pos
);
adcPrescaling
=
ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling
;
break
;
case
AR_SUPPLY_ONE_THIRD
:
case
AR_DEFAULT
:
default:
// 1/3 VDD Reference, 1/3 prescaler = 0 V - VDD range
adcReference
=
ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling
;
adcPrescaling
=
ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment