Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BME280 by
Revision 6:a9bb4ca073b2, committed 2017-06-01
- Comitter:
- Allar
- Date:
- Thu Jun 01 08:04:13 2017 +0000
- Parent:
- 5:c1f1647004c4
- Commit message:
- night;
Changed in this revision
| BME280.cpp | Show annotated file Show diff for this revision Revisions of this file | 
| BME280.h | Show annotated file Show diff for this revision Revisions of this file | 
--- a/BME280.cpp	Sat Mar 11 04:21:14 2017 +0000
+++ b/BME280.cpp	Thu Jun 01 08:04:13 2017 +0000
@@ -55,7 +55,17 @@
     if (NULL != i2c_p)
         delete  i2c_p;
 }
-    
+bool BME280::verifyConnection(void) {
+    char cmd[1];
+    cmd[0] = 0xD0; //ID
+    i2c.write(address, cmd, 1);
+    i2c.read(address, cmd, 1);
+    uint8_t part_id = cmd[0];//ID
+    if (part_id == 0x60)
+        return true;
+    return false;
+}
+
 void BME280::initialize()
 {
     char cmd[18];
--- a/BME280.h	Sat Mar 11 04:21:14 2017 +0000
+++ b/BME280.h	Thu Jun 01 08:04:13 2017 +0000
@@ -111,6 +111,7 @@
      */
     void initialize(void);
 
+    bool verifyConnection(void);
     /** Read the current temperature value (degree Celsius) from BME280 sensor
      *
      */
    