HMC6352 Library

Revision:
1:1f500fa755c8
Parent:
0:78e66010e47b
--- a/HMC6352.cpp	Thu Feb 11 12:18:33 2010 +0000
+++ b/HMC6352.cpp	Sun Mar 28 20:23:44 2010 +0000
@@ -201,17 +201,27 @@
 
 void HMC6352::calibrate(int delay)
 {
+    startCalibrate();
+        
+    // Now wait an optimal 20s in which two full turns should be 
+    // made of the compass to gather enough data, see page 7 of 
+    // the data sheet.
+    wait(delay);
+
+    endCalibrate();    
+}
+
+void HMC6352::startCalibrate()
+{
     // Send the enter calibrate command.
     _buffer[0] = HMC6352_START_CAL;
     _i2c.write(this->address(), _buffer, 1);
     // Enter takes 10us.
     wait_us(10);
-    
-    // Now wait an optimal 20s in which two full turns should be 
-    // made of the compass to gather enough data, see page 7 of 
-    // the data sheet.
-    wait(delay);
-    
+}
+
+void HMC6352::endCalibrate()
+{
     // Send the exit calibrate command.
     _buffer[0] = HMC6352_END_CAL;
     _i2c.write(this->address(), _buffer, 1);