APDS-9960 Light, RGB, Proximity, and Gesture Sensor https://www.sparkfun.com/products/12787 This library interfaces the APDS-9960 to Mbed over I2C. The library relies on the I2C library. To use the library, instantiate a glibr object, call ginit(), and call the appropriate functions.

Dependents:   Gesture_User_Interface car_test_v1 Capt_couleur_CAN Capt_couleur_smart

Fork of APDS_9960 by Krishan Bhagat

Files at this revision

API Documentation at this revision

Comitter:
kbhagat6
Date:
Mon Apr 27 02:05:49 2015 +0000
Parent:
1:fafb44ef4b41
Commit message:
gesture control

Changed in this revision

glibr.cpp Show annotated file Show diff for this revision Revisions of this file
glibr.h Show annotated file Show diff for this revision Revisions of this file
--- a/glibr.cpp	Thu Mar 12 21:12:45 2015 +0000
+++ b/glibr.cpp	Mon Apr 27 02:05:49 2015 +0000
@@ -31,7 +31,7 @@
          return false;
     }
     
-    if(!setMode(ALL, OFF)) {
+    if(!setMode(ALL, Off)) {
         return false;
     }
     if(I2CwriteByte(APDS9960_I2C_ADDR,APDS9960_ATIME, DEFAULT_ATIME)){
@@ -164,7 +164,7 @@
  * @brief Enables or disables a feature in the APDS-9960
  *
  * @param[in] mode which feature to enable
- * @param[in] enable ON (1) or OFF (0)
+ * @param[in] enable On (1) or Off (0)
  * @return True if operation success. False otherwise.
  */
 bool glibr::setMode(uint8_t mode, uint8_t enable)
@@ -541,7 +541,7 @@
  */
 bool glibr::enablePower()
 {
-    if( !setMode(POWER, 1) ) {
+    if( !setMode(Power, 1) ) {
         return false;
     }
     
@@ -555,7 +555,7 @@
  */
 bool glibr::disablePower()
 {
-    if( !setMode(POWER, 0) ) {
+    if( !setMode(Power, 0) ) {
         return false;
     }
     
@@ -591,7 +591,6 @@
         return false;
     }
     val = val + ((uint16_t)val_byte << 8);
-    
     return true;
 }
 
@@ -1660,7 +1659,7 @@
 *
 *
 *
-*LEFT OFF HERE AT 3:47PM ON 3/6/15
+*LEFT Off HERE AT 3:47PM On 3/6/15
 *
 *
 *
--- a/glibr.h	Thu Mar 12 21:12:45 2015 +0000
+++ b/glibr.h	Mon Apr 27 02:05:49 2015 +0000
@@ -83,11 +83,11 @@
 #define APDS9960_GVALID         0x01
 
 /* On/Off definitions */
-#define OFF                     0
-#define ON                      1
+#define Off                     0
+#define On                      1
 
 /* Acceptable parameters for setMode */
-#define POWER                   0
+#define Power                   0
 #define AMBIENT_LIGHT           1
 #define PROXIMITY               2
 #define WAIT                    3