ADT7410 library

Dependents:   mbed_DEMO mbed_BLE

See https://developer.mbed.org/users/yasuyuki/notebook/ADT7410/

Files at this revision

API Documentation at this revision

Comitter:
yasuyuki
Date:
Wed Jun 03 01:27:12 2015 +0000
Parent:
1:b13511ed5965
Commit message:
one shot

Changed in this revision

ADT7410.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b13511ed5965 -r f01d96ee8fda ADT7410.cpp
--- a/ADT7410.cpp	Fri Oct 10 04:39:36 2014 +0000
+++ b/ADT7410.cpp	Wed Jun 03 01:27:12 2015 +0000
@@ -13,6 +13,9 @@
 #include "mbed.h"
 #include "ADT7410.h"
 
+//#define SPS
+#define ONESHOT
+
 ADT7410::ADT7410 (PinName sda, PinName scl) : _i2c(sda, scl) {
     init();
 }
@@ -39,6 +42,13 @@
 short ADT7410::value()
 {
 
+#ifdef ONESHOT
+    // wakeup
+    // set 16bit resolution with one shot mode
+    put(ADT7410_CONFIG, 0xA0);
+    wait_ms(240);
+#endif
+
     // RDY?
 //    do{
 //        get(ADT7410_STATUS);
@@ -56,8 +66,15 @@
 
 void ADT7410::init()
 {
-    // set 16bit resolution
+#ifdef SPS
+    // set 16bit resolution with 1 sps mode
     put(ADT7410_CONFIG, 0xC0);
+#endif
+#ifdef ONSHOT
+    // set 16bit resolution with one shot mode
+    put(ADT7410_CONFIG, 0xA0);
+#endif
+
 }