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
No related merge requests found
...@@ -43,9 +43,7 @@ int epic_bme680_init() ...@@ -43,9 +43,7 @@ int epic_bme680_init()
return 0; return 0;
} }
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) { hwlock_acquire(HWLOCK_I2C);
return -EBUSY;
}
bme.dev_id = BME680_I2C_ADDR_PRIMARY; bme.dev_id = BME680_I2C_ADDR_PRIMARY;
bme.intf = BME680_I2C_INTF; bme.intf = BME680_I2C_INTF;
...@@ -110,9 +108,7 @@ int epic_bme680_deinit() ...@@ -110,9 +108,7 @@ int epic_bme680_deinit()
return 0; return 0;
} }
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) { hwlock_acquire(HWLOCK_I2C);
return -EBUSY;
}
int8_t result = bme680_soft_reset(&bme); int8_t result = bme680_soft_reset(&bme);
if (result != BME680_OK) { if (result != BME680_OK) {
...@@ -133,9 +129,7 @@ int epic_bme680_read_sensors(struct bme680_sensor_data *data) ...@@ -133,9 +129,7 @@ int epic_bme680_read_sensors(struct bme680_sensor_data *data)
return -EINVAL; return -EINVAL;
} }
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) { hwlock_acquire(HWLOCK_I2C);
return -EBUSY;
}
uint16_t profile_dur = 0; uint16_t profile_dur = 0;
bme680_get_profile_dur(&profile_dur, &bme); bme680_get_profile_dur(&profile_dur, &bme);
...@@ -152,9 +146,7 @@ int epic_bme680_read_sensors(struct bme680_sensor_data *data) ...@@ -152,9 +146,7 @@ int epic_bme680_read_sensors(struct bme680_sensor_data *data)
*/ */
hwlock_release(HWLOCK_I2C); hwlock_release(HWLOCK_I2C);
vTaskDelay(pdMS_TO_TICKS(profile_dur)); vTaskDelay(pdMS_TO_TICKS(profile_dur));
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) { hwlock_acquire(HWLOCK_I2C);
return -EBUSY;
}
struct bme680_field_data raw_data; struct bme680_field_data raw_data;
result = bme680_get_sensor_data(&raw_data, &bme); result = bme680_get_sensor_data(&raw_data, &bme);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment