Skip to content
Snippets Groups Projects
Commit 9974238a authored by schneider's avatar schneider
Browse files

fix(light_sensor): Use work queue

parent bafda368
Branches
No related tags found
1 merge request!427Basic work queue
Pipeline #4970 passed
......@@ -38,17 +38,14 @@ uint16_t epic_light_sensor_read()
return last_value;
}
static void readAdcCallback()
static void workpoll(void *data)
{
if (hwlock_acquire_nonblock(HWLOCK_ADC) != 0) {
/* Can't do much about this here ... Retry next time */
return;
}
ADC_StartConvert(ADC_CH_7, 0, 0);
ADC_GetData(&last_value);
epic_light_sensor_read();
}
hwlock_release(HWLOCK_ADC);
static void poll(TimerHandle_t xTimer)
{
workqueue_schedule(workpoll, NULL);
}
int epic_light_sensor_run()
......@@ -65,7 +62,7 @@ int epic_light_sensor_run()
READ_FREQ,
pdTRUE,
NULL,
readAdcCallback,
poll,
&poll_timer_buffer
);
// since &poll_timer_buffer is not NULL, xTimerCreateStatic should allways succeed, so
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment