diff --git a/epicardium/modules/light_sensor.c b/epicardium/modules/light_sensor.c index a0f997ac1d88e1b1e60822ea1309f06879b3ee65..ea8d74c36c92e381dd8239a2bd9b02617fd92b6a 100644 --- a/epicardium/modules/light_sensor.c +++ b/epicardium/modules/light_sensor.c @@ -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();