Library for the BME220

Fork of BME680 by CHENGQI YANG

Files at this revision

API Documentation at this revision

Comitter:
UHSLMarcus
Date:
Wed Jan 25 12:06:36 2017 +0000
Parent:
5:0cdc1c3adb32
Commit message:
debug prints

Changed in this revision

BME680.cpp Show annotated file Show diff for this revision Revisions of this file
BME680.h Show annotated file Show diff for this revision Revisions of this file
--- a/BME680.cpp	Tue Jan 24 14:10:36 2017 +0000
+++ b/BME680.cpp	Wed Jan 25 12:06:36 2017 +0000
@@ -808,7 +808,7 @@
 void BME680::readRegister(int reg, int size)
 {
     _i2c_bus->start();
-    _i2c_bus->write(_addr);
+    if (_i2c_bus->write(_addr) != 1) USBserialComms.printf("BME680 addr write failed (read)\r");
     _i2c_bus->write(reg);
     _i2c_bus->start();
     _i2c_bus->write(_addr | 0x01);
@@ -822,7 +822,7 @@
 void BME680::writeRegister(int reg, int value)
 {
     _i2c_bus->start();
-    _i2c_bus->write(_addr);
+    if (_i2c_bus->write(_addr) != 1) USBserialComms.printf("BME680 addr write failed (write)\r");
     _i2c_bus->write(reg);
     _i2c_bus->write(value);
     _i2c_bus->stop();
--- a/BME680.h	Tue Jan 24 14:10:36 2017 +0000
+++ b/BME680.h	Wed Jan 25 12:06:36 2017 +0000
@@ -3,6 +3,7 @@
 
 #include "mbed.h"
 #include "stdint.h"
+#include "serial.h"
 
 /*
 * Use below macro for fixed Point Calculation