First draft HMC5883 magnetometer sensor using physical quantities, outputting via serial port using std::cout on mbed os 5

Revision:
9:87a7169b4d5c
Parent:
8:c5dc1ce10722
Child:
10:75c8ce89aeb7
--- a/magnetometer.cpp	Thu Mar 26 21:13:44 2020 +0000
+++ b/magnetometer.cpp	Thu Mar 26 21:35:19 2020 +0000
@@ -1,4 +1,3 @@
-
 
 #include "magnetometer.h"
 #include "quan_time.h"
@@ -12,9 +11,8 @@
 bool mag_init()
 {
 // allow magnetometer hardware time to start
-   auto now = Kernel::get_ms_count();
-   if ( now < 500U){
-     ThisThread::sleep_until(500);
+   if ( Kernel::get_ms_count() < 500U){
+       ThisThread::sleep_until(500U);
    }
    if (! hmc5883L_ID1.detected(true)){
       return false; // usr has been notified
@@ -27,7 +25,7 @@
         hmc5883L_ID1.set_samples_average(8) &&
         hmc5883L_ID1.set_range( earth_magnetic_field_flux_density * 2U);
    
-    //gains frm calib engine
+    // gains from calib engine
     quan::three_d::vect<double> gain{1.37689,1.35057,1.56647};
     hmc5883L_ID1.set_gain(gain);
     
@@ -36,8 +34,7 @@
         quan::magnetic_flux_density::uT
     > offset{10.5724_uT,-10.869_uT,2.241468_uT};
     hmc5883L_ID1.set_offset(offset);
-   // set gain and offsets
-   return success;
+    return success;
 }
 
 bool mag_start_measurement()
@@ -52,5 +49,5 @@
 
 bool mag_read(quan::three_d::vect<quan::magnetic_flux_density::uT> & v)
 {
-     return hmc5883L_ID1.read(v);
+    return hmc5883L_ID1.read(v);
 }