Skip to content

Commit

Permalink
fix checking return values of i2c
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDick committed May 30, 2024
1 parent 3049f60 commit 9e18277
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/flow3r_bsp/flow3r_bsp_imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static BMI2_INTF_RETURN_TYPE bmi2_i2c_read(uint8_t reg_addr, uint8_t *reg_data,
{ .len = len, .buf = reg_data } };
esp_err_t ret = tildagon_mux_i2c_transaction (mux, imu->bmi_dev_addr, 2, buffer, READ);

if (ret != ESP_OK) {
if (ret < 0) {
ESP_LOGE(TAG, "i2c read/write fail: %s", esp_err_to_name(ret));
return BMI2_E_COM_FAIL;
}
Expand All @@ -69,7 +69,7 @@ static BMI2_INTF_RETURN_TYPE bmi2_i2c_write(uint8_t reg_addr,
mp_machine_i2c_buf_t buffer[1] = { { .len = sizeof(tx), .buf = tx } };
esp_err_t ret = tildagon_mux_i2c_transaction (mux, imu->bmi_dev_addr, 1, buffer, WRITE);

if (ret != ESP_OK) {
if (ret < 0) {
ESP_LOGE(TAG, "i2c write fail: %s", esp_err_to_name(ret));
return BMI2_E_COM_FAIL;
}
Expand Down

0 comments on commit 9e18277

Please sign in to comment.