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

refact(gpio): Use new style HW locks

parent ceaf1e4a
No related branches found
No related tags found
1 merge request!379Remove legacy HW lock interface
......@@ -137,18 +137,15 @@ int epic_gpio_read_pin(uint8_t pin)
} else if (cfg->func == GPIO_FUNC_IN) {
return GPIO_InGet(cfg) != 0;
} else if (cfg->func == GPIO_FUNC_ALT1) {
int rc = hwlock_acquire_timeout(HWLOCK_ADC, portMAX_DELAY);
if (!rc) {
ADC_StartConvert(s_adc_channels[pin], 0, 0);
uint16_t value;
int rc = ADC_GetData(&value);
hwlock_release(HWLOCK_ADC);
if (rc < 0) {
return -EIO;
}
return (int)value;
hwlock_acquire(HWLOCK_ADC);
ADC_StartConvert(s_adc_channels[pin], 0, 0);
uint16_t value;
int rc = ADC_GetData(&value);
hwlock_release(HWLOCK_ADC);
if (rc < 0) {
return -EIO;
}
return rc;
return (int)value;
} else {
return -EINVAL;
}
......
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