Verified Commit e99d829f authored by Rahix's avatar Rahix
Browse files

fix(light-sensor): Lock ADC during measurement


Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent 5fd10101
Pipeline #3519 passed with stages
in 52 seconds
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment