This is a device driver of AK8963, which is 3-axis magnetometer manufactured by AKM.

Dependents:   SimpleSample combination combination

Revision:
1:a362b9e3aac2
Parent:
0:fc56973c077a
--- a/ak8963.h	Wed Aug 05 23:08:02 2015 +0000
+++ b/ak8963.h	Tue Aug 18 18:06:02 2015 +0000
@@ -6,7 +6,54 @@
 /**
  * This is a device driver of AK8963.
  *
- * @note AK8963 is a 3-axis magnetic sensor device manufactured by AKM.
+ * @note AK8963 is a 3-axis magnetometer (magnetic sensor) device manufactured by AKM.
+ * 
+ * Example:
+ * @code
+ * #include "mbed.h"
+ * #include "ak8963.h"
+ * 
+ * #define I2C_SPEED_100KHZ    100000
+ * #define I2C_SPEED_400KHZ    400000
+ * 
+ * int main() {
+ *     // Creates an instance of I2C
+ *     I2C connection(I2C_SDA0, I2C_SCL0);
+ *     connection.frequency(I2C_SPEED_100KHZ);
+ *
+ *     // Creates an instance of AK8963
+ *     AK8963 ak8963(&connection, AK8963::SLAVE_ADDR_1);
+ *     
+ *     // Checks connectivity
+ *     if(ak8963.checkConnection() != AK8963::SUCCESS) {
+ *         // Failed to check device connection.
+ *         // - error handling here -
+ *     }
+ *     
+ *     // Puts the device into continuous measurement mode.
+ *     if(ak8963.setOperationMode(AK8963::MODE_CONTINUOUS_1) != AK8963::SUCCESS) {
+ *         // Failed to set the device into continuous measurement mode.
+ *         // - error handling here -
+ *     }
+ *
+ *     while(true) {
+ *         // checks DRDY
+ *         if (statusAK8963 == AK8963::DATA_READY) {
+ *             AK8963::MagneticVector mag;
+ *             ak8963.getMagneticVector(&mag);
+ *             // You may use serial output to see data.
+ *             // serial.printf("%d,%5.1f,%5.1f,%5.1f\n",
+ *             //    mag.isOverflow,
+ *             //    mag.mx, mag.my, mag.mz);
+ *             statusAK8963 = AK8963::NOT_DATA_READY;
+ *         } else if (statusAK8963 == AK8963::NOT_DATA_READY) {
+ *             // Nothing to do.
+ *         } else {
+ *             // - error handling here -
+ *         }
+ *     }
+ * }
+ * @endcode
  */
 class AK8963
 {
@@ -50,6 +97,7 @@
         float mx;        /**< x component */
         float my;        /**< y component */
         float mz;        /**< z component */
+        bool isOverflow; /**< Indicating magnetic sensor overflow */
     } MagneticVector;
 
     /**