Forked from Jose R. Padron and Aaron Berk's library, customized for my specific application using 9DoF-Stick by Sparkfun.

Fork of HMC5843 by Jose R Padron

HMC5843 is triple axis, digital interface compass (geomagnetic sensor).

This library is forked from Jose R. Padron and Aaron Berk's work.

This library is for specific application using 9DoF-Stick.

Datasheet:

http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf

HMC5843 は3軸のデジタルインターフェースを備えたコンパス(地磁気センサ)です。

このライブラリは 9DoF-Stick を使用した特定の企画のために保守しています。

mbed IDEが日本語をサポートするまでは英語でコメントを書いていきますが、サポートした後もきっと英語で書いていくでしょう。

Revision:
4:7a90125eedcf
Parent:
2:fdab96fc6fff
Child:
5:a83508250db7
--- a/HMC5843.h	Sun Sep 09 17:26:31 2012 +0000
+++ b/HMC5843.h	Wed Sep 12 15:54:13 2012 +0000
@@ -1,4 +1,5 @@
 /**
+ * @file HMC5843.h
  * @author Jose R. Padron
  * @author Used HMC5843 library  developed by Aaron Berk as template
  * @section LICENSE
@@ -35,14 +36,9 @@
 #ifndef HMC5843_H
 #define HMC5843_H
 
-/**
- * Includes
- */
 #include "mbed.h"
 
-/**
- * Defines
- */
+
 #define HMC5843_I2C_ADDRESS 0x1E //7-bit address. 0x3C write, 0x3D read.
 #define HMC5843_I2C_WRITE   0x3C 
 #define HMC5843_I2C_READ    0x3D 
@@ -208,8 +204,18 @@
     int getStatus(void);
 
   
+private:
 
-    I2C* i2c_;
+    /**
+     * Internal I2C object for communicating with the device.
+     *
+     * Changed from a pointer (new allocated object) from embedded object.
+     * The I2C class object is not meant to be allocated in the heap, but
+     * in the global storage.
+     * There's no point dynamically allocating an I2C object in this class,
+     * at least you should write destructor to release it!
+     */
+    I2C i2c_;