Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fleur
firmware
Commits
e99d829f
Verified
Commit
e99d829f
authored
Aug 25, 2019
by
Rahix
Browse files
fix(light-sensor): Lock ADC during measurement
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
5fd10101
Changes
1
Hide whitespace changes
Inline
Side-by-side
epicardium/modules/light_sensor.c
View file @
e99d829f
...
...
@@ -29,8 +29,14 @@ static int light_sensor_init()
uint16_t
epic_light_sensor_read
()
{
if
(
hwlock_acquire
(
HWLOCK_ADC
,
pdMS_TO_TICKS
(
1000
))
!=
0
)
{
return
0
;
}
ADC_StartConvert
(
ADC_CH_7
,
0
,
0
);
ADC_GetData
(
&
last_value
);
hwlock_release
(
HWLOCK_ADC
);
return
last_value
;
}
...
...
Write
Preview
Supports
Markdown
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