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

refact(bme680): Use new style HW locks

parent 861d604a
No related branches found
No related tags found
1 merge request!379Remove legacy HW lock interface
......@@ -43,9 +43,7 @@ int epic_bme680_init()
return 0;
}
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) {
return -EBUSY;
}
hwlock_acquire(HWLOCK_I2C);
bme.dev_id = BME680_I2C_ADDR_PRIMARY;
bme.intf = BME680_I2C_INTF;
......@@ -110,9 +108,7 @@ int epic_bme680_deinit()
return 0;
}
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) {
return -EBUSY;
}
hwlock_acquire(HWLOCK_I2C);
int8_t result = bme680_soft_reset(&bme);
if (result != BME680_OK) {
......@@ -133,9 +129,7 @@ int epic_bme680_read_sensors(struct bme680_sensor_data *data)
return -EINVAL;
}
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) {
return -EBUSY;
}
hwlock_acquire(HWLOCK_I2C);
uint16_t profile_dur = 0;
bme680_get_profile_dur(&profile_dur, &bme);
......@@ -152,9 +146,7 @@ int epic_bme680_read_sensors(struct bme680_sensor_data *data)
*/
hwlock_release(HWLOCK_I2C);
vTaskDelay(pdMS_TO_TICKS(profile_dur));
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) {
return -EBUSY;
}
hwlock_acquire(HWLOCK_I2C);
struct bme680_field_data raw_data;
result = bme680_get_sensor_data(&raw_data, &bme);
......
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