Skip to content
Snippets Groups Projects
Verified Commit e99d829f authored by rahix's avatar rahix
Browse files

fix(light-sensor): Lock ADC during measurement


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent 5fd10101
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment