You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2018/12/17 09:19:44 UTC

[mynewt-core] 02/03: hw/drivers/lis2dh12: Fix multibyte write

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

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

commit d1bf3d4dbd42929b839549a8376a58eb9911aa68
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Dec 14 11:01:40 2018 +0100

    hw/drivers/lis2dh12: Fix multibyte write
    
    For multi-byte write over I2C address increment bit was not
    set in non-bus-driver build.
---
 hw/drivers/sensors/lis2dh12/src/lis2dh12.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/drivers/sensors/lis2dh12/src/lis2dh12.c b/hw/drivers/sensors/lis2dh12/src/lis2dh12.c
index e50f386..b676489 100644
--- a/hw/drivers/sensors/lis2dh12/src/lis2dh12.c
+++ b/hw/drivers/sensors/lis2dh12/src/lis2dh12.c
@@ -379,6 +379,9 @@ lis2dh12_i2c_writelen(struct sensor_itf *itf, uint8_t addr, uint8_t *buffer,
         goto err;
     }
 
+    if (len > 1) {
+        payload[0] += LIS2DH12_I2C_ADDR_INC;
+    }
     memcpy(&payload[1], buffer, len);
 
     /* Register write */