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

refact(light_sensor): Use new style HW locks

parent 7ff1d3ae
No related branches found
No related tags found
1 merge request!379Remove legacy HW lock interface
......@@ -29,9 +29,7 @@ static int light_sensor_init()
uint16_t epic_light_sensor_read()
{
if (hwlock_acquire_timeout(HWLOCK_ADC, portMAX_DELAY) != 0) {
return 0;
}
hwlock_acquire(HWLOCK_ADC);
ADC_StartConvert(ADC_CH_7, 0, 0);
ADC_GetData(&last_value);
......@@ -42,7 +40,7 @@ uint16_t epic_light_sensor_read()
static void readAdcCallback()
{
if (hwlock_acquire_timeout(HWLOCK_ADC, 0) != 0) {
if (hwlock_acquire_nonblock(HWLOCK_ADC) != 0) {
/* Can't do much about this here ... Retry next time */
return;
}
......@@ -57,9 +55,7 @@ int epic_light_sensor_run()
{
int ret = 0;
if (hwlock_acquire_timeout(HWLOCK_ADC, portMAX_DELAY) != 0) {
return -EBUSY;
}
hwlock_acquire(HWLOCK_ADC);
light_sensor_init();
......
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