You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/01/08 13:11:21 UTC

[mynewt-core] 06/06: hw/drivers/lps33thw: Restore read error stats

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit cb9ece042bb2b1491f405d8e83e7c2f39dea4a4d
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Jan 8 14:01:56 2019 +0100

    hw/drivers/lps33thw: Restore read error stats
---
 hw/drivers/sensors/lps33thw/src/lps33thw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/drivers/sensors/lps33thw/src/lps33thw.c b/hw/drivers/sensors/lps33thw/src/lps33thw.c
index 9919929..d3d44cb 100644
--- a/hw/drivers/sensors/lps33thw/src/lps33thw.c
+++ b/hw/drivers/sensors/lps33thw/src/lps33thw.c
@@ -375,6 +375,12 @@ lps33thw_i2c_get_regs(struct sensor_itf *itf, uint8_t reg, uint8_t size,
     rc = i2cn_master_write_read_transact(itf->si_num, &wdata, &rdata,
                                          MYNEWT_VAL(LPS33THW_I2C_TIMEOUT_TICKS) * (size + 1),
                                          1, MYNEWT_VAL(LPS33THW_I2C_RETRIES));
+    if (rc) {
+        LPS33THW_LOG(ERROR, "I2C access failed at address 0x%02X\n",
+                     itf->si_addr);
+        STATS_INC(g_lps33thwstats, read_errors);
+        return rc;
+    }
 #endif
 
     return rc;