Starting library to get the SI1143 Gesture Sensor to work. Currently only works in forced conversion mode.

Dependents:   Gesture_Sensor Gesture_Arm_Robot mbed_gesture Gesture_Sensor_Sample ... more

Files at this revision

API Documentation at this revision

Comitter:
GAT27
Date:
Thu Oct 17 23:23:33 2013 +0000
Parent:
3:cb3e8160f18e
Child:
5:3fadc61598bc
Commit message:
added a reset

Changed in this revision

SI1143.cpp Show annotated file Show diff for this revision Revisions of this file
SI1143.h Show annotated file Show diff for this revision Revisions of this file
--- a/SI1143.cpp	Thu Oct 17 22:03:54 2013 +0000
+++ b/SI1143.cpp	Thu Oct 17 23:23:33 2013 +0000
@@ -39,6 +39,11 @@
     //3.4MHz, as specified by the datasheet, but DO NOT USE.
     //i2c_->frequency(3400000);
     
+    restart();
+}
+
+void SI1143::restart()
+{
     command(RESET);
     wait_ms(30);
     
@@ -170,3 +175,4 @@
     //return PS1;
 }
 
+
--- a/SI1143.h	Thu Oct 17 22:03:54 2013 +0000
+++ b/SI1143.h	Thu Oct 17 23:23:33 2013 +0000
@@ -178,23 +178,29 @@
         SI1143(PinName sda, PinName scl);
         
         /**
-         * Sample the device and return a result.
+         * Takes a sample from the device and returns a raw output.
          *
-         * @param   A value of 1 will output led1
-         *          A value of 2 will output led2
-         *          A value of 3 will output led3
-         *          A value of 4 will output ambient light
-         *          A value of 5 will output infrared light
-         *          A value of anything else will output 0
-         * @return  In forced conversion output mode, will display the raw output minus any baseline
+         * @param   point Used to get a specific value from the device.
+         *          A value of 1 will output proximity of led1, a value of 2 will output proximity of led2,
+         *          a value of 3 will output proximity of led3, a value of 4 will output ambient light,
+         *          a value of 5 will output infrared light, and any other value will output 0.
+         * @return  In forced conversion output mode, will display a raw output minus any baseline,
+         *          where as the greater the value, the closer the object is to the device
+         *          (applies to proximity leds).
          */
         int sample(int point);
         
         /**
          * Creates a baseline for sampling measurements.
+         * Should be done early in your code and after a reset.
          */
         void bias(void);
         
+        /**
+         * Restarts the device.
+         */
+        void restart(void);
+        
     private:
     
         I2C* i2c_;