A quick adaptation of a library made for Arduino by Fabio Varesano Interface a Honeywell HMC58X3 magnetometer to a mbed via i2c.

Files at this revision

API Documentation at this revision

Comitter:
pommzorz
Date:
Mon Jun 24 19:44:55 2013 +0000
Parent:
0:d84e1c7e4e86
Commit message:
Minor adjustments

Changed in this revision

HMC58X3.cpp Show annotated file Show diff for this revision Revisions of this file
HMC58X3.h Show annotated file Show diff for this revision Revisions of this file
--- a/HMC58X3.cpp	Mon Jun 24 16:18:52 2013 +0000
+++ b/HMC58X3.cpp	Mon Jun 24 19:44:55 2013 +0000
@@ -70,9 +70,10 @@
 
 /* PUBLIC METHODS */
 
-HMC58X3::HMC58X3(PinName sda, PinName scl): i2c(sda, scl)
+//HMC58X3::HMC58X3(PinName sda, PinName scl): i2c(sda, scl)
+HMC58X3::HMC58X3(I2C i2c_):i2c(i2c_)
 {
-    
+    //this->i2c= i2c_;
     x_scale=1.0F;
     y_scale=1.0F;
     z_scale=1.0F;
--- a/HMC58X3.h	Mon Jun 24 16:18:52 2013 +0000
+++ b/HMC58X3.h	Mon Jun 24 19:44:55 2013 +0000
@@ -84,8 +84,8 @@
 
 
 public:
-    HMC58X3(PinName sda, PinName scl);
-    
+    //HMC58X3(PinName sda, PinName scl);
+    HMC58X3(I2C i2c_);
     void init(bool setmode);
     void init(int address, bool setmode);
     void getValues(int *x,int *y,int *z);