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() ...@@ -29,9 +29,7 @@ static int light_sensor_init()
uint16_t epic_light_sensor_read() uint16_t epic_light_sensor_read()
{ {
if (hwlock_acquire_timeout(HWLOCK_ADC, portMAX_DELAY) != 0) { hwlock_acquire(HWLOCK_ADC);
return 0;
}
ADC_StartConvert(ADC_CH_7, 0, 0); ADC_StartConvert(ADC_CH_7, 0, 0);
ADC_GetData(&last_value); ADC_GetData(&last_value);
...@@ -42,7 +40,7 @@ uint16_t epic_light_sensor_read() ...@@ -42,7 +40,7 @@ uint16_t epic_light_sensor_read()
static void readAdcCallback() 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 */ /* Can't do much about this here ... Retry next time */
return; return;
} }
...@@ -57,9 +55,7 @@ int epic_light_sensor_run() ...@@ -57,9 +55,7 @@ int epic_light_sensor_run()
{ {
int ret = 0; int ret = 0;
if (hwlock_acquire_timeout(HWLOCK_ADC, portMAX_DELAY) != 0) { hwlock_acquire(HWLOCK_ADC);
return -EBUSY;
}
light_sensor_init(); light_sensor_init();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment