Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Arduino Core for SAMD21 CPU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
Arduino Core for SAMD21 CPU
Commits
d14b46e0
Commit
d14b46e0
authored
10 years ago
by
Thibaut VIARD
Browse files
Options
Downloads
Patches
Plain Diff
fixing default analog reference
Signed-off-by:
Thibaut VIARD
<
thibaut.viard@atmel.com
>
parent
05d82d72
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cores/arduino/wiring_analog.c
+9
-4
9 additions, 4 deletions
cores/arduino/wiring_analog.c
with
9 additions
and
4 deletions
cores/arduino/wiring_analog.c
+
9
−
4
View file @
d14b46e0
...
@@ -54,19 +54,23 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to
...
@@ -54,19 +54,23 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to
}
}
}
}
/*
* Internal Reference is at 1.0v
* External Reference should be between 1v and VDDANA-0.6v=2.7v
*
* Warning : On Arduino Zero board the input/output voltage for SAMD21G18 is 3.3 volts maximum
*/
void
analogReference
(
eAnalogReference
ulMode
)
void
analogReference
(
eAnalogReference
ulMode
)
{
{
// ATTENTION : On this board the default is not 5volts or 3.3volts BUT 1volt
switch
(
ulMode
)
switch
(
ulMode
)
{
{
case
AR_DEFAULT
:
case
AR_INTERNAL
:
case
AR_INTERNAL
:
default:
ADC
->
REFCTRL
.
bit
.
REFSEL
=
ADC_REFCTRL_REFSEL_INT1V_Val
;
ADC
->
REFCTRL
.
bit
.
REFSEL
=
ADC_REFCTRL_REFSEL_INT1V_Val
;
break
;
break
;
case
AR_DEFAULT
:
case
AR_EXTERNAL
:
case
AR_EXTERNAL
:
default:
ADC
->
REFCTRL
.
bit
.
REFSEL
=
ADC_REFCTRL_REFSEL_AREFA_Val
;
ADC
->
REFCTRL
.
bit
.
REFSEL
=
ADC_REFCTRL_REFSEL_AREFA_Val
;
break
;
break
;
}
}
...
@@ -75,6 +79,7 @@ void analogReference( eAnalogReference ulMode )
...
@@ -75,6 +79,7 @@ void analogReference( eAnalogReference ulMode )
uint32_t
analogRead
(
uint32_t
ulPin
)
uint32_t
analogRead
(
uint32_t
ulPin
)
{
{
uint32_t
valueRead
=
0
;
uint32_t
valueRead
=
0
;
pinPeripheral
(
ulPin
,
g_APinDescription
[
ulPin
].
ulPinType
);
pinPeripheral
(
ulPin
,
g_APinDescription
[
ulPin
].
ulPinType
);
ADC
->
INPUTCTRL
.
bit
.
MUXPOS
=
g_APinDescription
[
ulPin
].
ulADCChannelNumber
;
ADC
->
INPUTCTRL
.
bit
.
MUXPOS
=
g_APinDescription
[
ulPin
].
ulADCChannelNumber
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment