Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Boardcore
Commits
d24a8011
Commit
d24a8011
authored
1 year ago
by
Niccolò Betto
Browse files
Options
Downloads
Patches
Plain Diff
[InternalADC] Warn on undefined V_DDA_VOLTAGE instead of erroring out
Also fix some cppcheck warnings.
parent
67275bc0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/shared/drivers/adc/InternalADC.cpp
+5
-10
5 additions, 10 deletions
src/shared/drivers/adc/InternalADC.cpp
src/shared/drivers/adc/InternalADCData.h
+1
-1
1 addition, 1 deletion
src/shared/drivers/adc/InternalADCData.h
with
6 additions
and
11 deletions
src/shared/drivers/adc/InternalADC.cpp
+
5
−
10
View file @
d24a8011
...
...
@@ -61,7 +61,8 @@ static const float VBAT_DIV = 4.0f;
// If it is missing you need to define it, preferably in the board_settings.h
// file in miosix. Check your board schematic to find the voltage value.
#ifndef V_DDA_VOLTAGE
#error Missing V_DDA_VOLTAGE definition for current target
#warning Missing V_DDA_VOLTAGE definition for current target, using default value of 3.0V
#define V_DDA_VOLTAGE 3.0f
#endif
InternalADC
::
InternalADC
(
ADC_TypeDef
*
adc
)
:
adc
(
adc
)
...
...
@@ -115,9 +116,7 @@ InternalADCData InternalADC::sampleImpl()
{
newData
.
voltage
[
i
]
=
readChannel
(
static_cast
<
Channel
>
(
i
));
newData
.
voltage
[
i
]
=
newData
.
voltage
[
i
]
*
V_DDA_VOLTAGE
// cppcheck-suppress ConfigurationNotChecked
/
ADC_RESOLUTION
;
newData
.
voltage
[
i
]
*
V_DDA_VOLTAGE
/
ADC_RESOLUTION
;
}
}
...
...
@@ -141,9 +140,7 @@ InternalADCData InternalADC::sampleImpl()
if
(
temperatureRawValue
!=
0
)
{
newData
.
temperature
=
temperatureRawValue
*
V_DDA_VOLTAGE
// cppcheck-suppress ConfigurationNotChecked
/
ADC_RESOLUTION
;
temperatureRawValue
*
V_DDA_VOLTAGE
/
ADC_RESOLUTION
;
#ifdef INTERNAL_ADC_WITHOUT_CALIBRATION
// Default conversion
...
...
@@ -168,9 +165,7 @@ InternalADCData InternalADC::sampleImpl()
ADC
->
CCR
&=
~
ADC_CCR_VBATE
;
newData
.
vBat
=
vbatVoltageRawValue
*
V_DDA_VOLTAGE
// cppcheck-suppress ConfigurationNotChecked
/
ADC_RESOLUTION
*
VBAT_DIV
;
vbatVoltageRawValue
*
V_DDA_VOLTAGE
/
ADC_RESOLUTION
*
VBAT_DIV
;
}
return
newData
;
...
...
This diff is collapsed.
Click to expand it.
src/shared/drivers/adc/InternalADCData.h
+
1
−
1
View file @
d24a8011
...
...
@@ -34,7 +34,7 @@ struct InternalADCData
float
temperature
;
float
vBat
;
InternalADCData
()
{}
InternalADCData
()
:
voltage
(),
temperature
(),
vBat
()
{}
static
std
::
string
header
()
{
...
...
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