Driver for the AKM AK9752 IR sensor device.

Dependents:   AKDP-RevD7_014

Library for the AK9752 Ultra-Small IR Sensor with I2C Interface. Includes integrated temperature sensor (0 - 50C) and 16-bit ADC.

Revision:
11:e4a64ed3ed58
Parent:
10:1cb542a62421
Child:
13:e02dfc48990a
--- a/AK9752.cpp	Mon Nov 14 19:11:45 2016 +0000
+++ b/AK9752.cpp	Fri Mar 17 23:29:48 2017 +0000
@@ -240,3 +240,22 @@
     
     return SUCCESS;    
 }
+
+
+AK9752::Status AK9752::isDataReady() {
+    AK9752::Status status = AK9752::ERROR;
+    
+    char stValue[1];
+    if ((status=AK9752::read(AK9752_REG_ADDR_ST1, stValue, 1)) != AK9752::SUCCESS) {
+        // I2C read failed.
+        return status;
+    }
+
+    // Sets a return status corresponds to the obtained value.    
+    if ((stValue[0] & AK9752_ST1_MASK_DRDY) > 0) {
+        status = AK9752::DATA_READY;
+    } else {
+        status = AK9752::NOT_DATA_READY;
+    }
+    return status;
+}
\ No newline at end of file