ldc1612: shutdown on i2c errors

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
Timofey Titovets authored and KevinOConnor committed 2024-10-26 22:06:30 -04:00
1 parent 1563a68144
commit 1c3b30b815
2 files changed
+3 -1

No files matched your search

+1
View File
@@ -26,5 +26,6 @@ void i2cdev_set_software_bus(struct i2cdev_s *i2c, struct i2c_software *is);
int i2c_dev_read(struct i2cdev_s *i2c, uint8_t reg_len, uint8_t *reg
, uint8_t read_len, uint8_t *read);
int i2c_dev_write(struct i2cdev_s *i2c, uint8_t write_len, uint8_t *data);
void i2c_shutdown_on_err(int ret);
#endif
+2 -1
View File
@@ -146,7 +146,8 @@ check_home(struct ldc1612 *ld, uint32_t data)
static void
read_reg(struct ldc1612 *ld, uint8_t reg, uint8_t *res)
{
i2c_dev_read(ld->i2c, sizeof(reg), &reg, 2, res);
int ret = i2c_dev_read(ld->i2c, sizeof(reg), &reg, 2, res);
i2c_shutdown_on_err(ret);
}
// Read the status register on the ldc1612