Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
swym
firmware
Commits
5325059a
Commit
5325059a
authored
5 years ago
by
swym
Browse files
Options
Downloads
Patches
Plain Diff
analog pgio: lock ADC HW
parent
c19f1153
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#3518
passed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/modules/gpio.c
+12
-6
12 additions, 6 deletions
epicardium/modules/gpio.c
with
12 additions
and
6 deletions
epicardium/modules/gpio.c
+
12
−
6
View file @
5325059a
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include
"adc.h"
#include
"adc.h"
#include
"mxc_errors.h"
#include
"mxc_errors.h"
#include
"modules/log.h"
#include
"modules/log.h"
#include
"modules/modules.h"
/*
/*
* Despite what the schematic (currently, 2019-08-18) says these are the correct
* Despite what the schematic (currently, 2019-08-18) says these are the correct
...
@@ -133,13 +134,18 @@ int epic_gpio_read_pin(uint8_t pin)
...
@@ -133,13 +134,18 @@ int epic_gpio_read_pin(uint8_t pin)
}
else
if
(
cfg
->
func
==
GPIO_FUNC_IN
)
{
}
else
if
(
cfg
->
func
==
GPIO_FUNC_IN
)
{
return
GPIO_InGet
(
cfg
)
!=
0
;
return
GPIO_InGet
(
cfg
)
!=
0
;
}
else
if
(
cfg
->
func
==
GPIO_FUNC_ALT1
)
{
}
else
if
(
cfg
->
func
==
GPIO_FUNC_ALT1
)
{
int
rc
=
hwlock_acquire
(
HWLOCK_ADC
,
pdMS_TO_TICKS
(
10
));
if
(
!
rc
)
{
ADC_StartConvert
(
s_adc_channels
[
pin
],
0
,
0
);
ADC_StartConvert
(
s_adc_channels
[
pin
],
0
,
0
);
uint16_t
value
;
uint16_t
value
;
int
rc
=
ADC_GetData
(
&
value
);
int
rc
=
ADC_GetData
(
&
value
);
hwlock_release
(
HWLOCK_ADC
);
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
return
-
EIO
;
return
-
EIO
;
}
}
return
(
int
)
value
;
return
(
int
)
value
;
}
return
rc
;
}
else
{
}
else
{
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
...
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