Class for making communication easier from code to i2c connected Rohm/Kionix sensors. Maybe could be used later also for abstracting Arduino/mbed os. Code ported from 'C'-library rohm-sensor-hal.

Dependents:   kionix-kx123-hello rohm-bh1790glc-hello simple-sensor-client rohm-SensorShield-example

Fork of rohm-sensor-hal by Rohm

Files at this revision

API Documentation at this revision

Comitter:
MikkoZ
Date:
Mon Oct 03 13:34:09 2016 +0000
Parent:
9:51c7b97b6a7d
Child:
11:272713c9e118
Commit message:
Bugfix to FIFO write; ; - sad writing was 0 bytes with stop condition changed to 1 byte without stop

Changed in this revision

source/RegisterWriter.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/RegisterWriter.cpp	Mon Oct 03 11:07:46 2016 +0000
+++ b/source/RegisterWriter.cpp	Mon Oct 03 13:34:09 2016 +0000
@@ -55,7 +55,7 @@
     uint8_t received_bytes;
     int read_ok;
 
-    i2c_bus.write( (int)((sad << 1) | I2C_WRITE), (char*)&reg, (int)0 );
+    i2c_bus.write( (int)((sad << 1) | I2C_WRITE), (char*)&reg, (int)1, repeated = true );
     read_ok = i2c_bus.read( (int)((sad << 1) | I2C_READ), (char*)buf, (int)buf_len);
 
     if( read_ok == 0 ){     //0 == success(ack)