An in-development library to provide effective access to all features of the FXOS8700CQ on the FRDM-K64F mbed-enabled development board. As of 28 May 2014 1325EDT, the code should be generally usable and modifiable.

Dependents:   fxos8700cq_example frdm_fxos8700_logger AVC_test1 frdm_accel ... more

A basic implementation of accessing the FXOS8700CQ. This should be useable, but as the Apache License says, don't expect it to be good at doing anything, even what it's supposed to do.

Revision:
3:2ce85aa45d7d
Parent:
2:4c2f8a3549a9
Child:
4:e2fe752b881e
--- a/FXOS8700CQ.h	Wed May 28 17:08:33 2014 +0000
+++ b/FXOS8700CQ.h	Wed May 28 18:38:09 2014 +0000
@@ -116,7 +116,7 @@
 * A driver on top of mbed-I2C to operate the FXOS8700CQ accelerometer/magnetometer
 * on the FRDM-K64F.
 *
-* Warning: incomplete code!
+* Code has been completed, but likely not optimized and potentially buggy.
 */
 class FXOS8700CQ
 {
@@ -137,9 +137,18 @@
 
     void enable(void);
     void disable(void);
+
+    /**
+    * @return the contents of device register FXOS8700CQ_WHOAMI 0x0D,
+    * should be FXOS8700CQ_WHOAMI_VAL 0xC7
+    */
     uint8_t get_whoami(void);
+    
+    /**
+    * @return the contents of device register FXOS8700CQ_STATUS 0x00
+    */
     uint8_t status(void);
-    
+
     /**
     * Data retrieval from the FXOS8700CQ
     *
@@ -148,10 +157,10 @@
     * @return 0 on success, non-zero on failure
     */
     uint8_t get_data(SRAWDATA *accel_data, SRAWDATA *magn_data);
-    
+
     /**
     * Retrieve the full-range scale value of the accelerometer
-    * 
+    *
     * @return 2, 4, or 8, depending on part configuration; 0 on error
     */
     uint8_t get_accel_scale(void);
@@ -161,7 +170,7 @@
 private:
     I2C dev_i2c; // instance of the mbed I2C class
     uint8_t dev_addr; // Device I2C address, in (7-bit << 1) form
-    bool enabled;
+    bool enabled; // keep track of enable bit of device
 
     // I2C helper methods
     void read_regs(int reg_addr, uint8_t* data, int len);