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
...@@ -29,8 +29,14 @@ static int light_sensor_init() ...@@ -29,8 +29,14 @@ static int light_sensor_init()
uint16_t epic_light_sensor_read() 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_StartConvert(ADC_CH_7, 0, 0);
ADC_GetData(&last_value); ADC_GetData(&last_value);
hwlock_release(HWLOCK_ADC);
return last_value; 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