This is an example of a tilt compensated eCompass running on a K64F Freedom Platform using the on board FXOS8700 6 axis sensor and Freescale's eCompass software library in a linkable object library compiled for a FPU enabled Cortex M4.

Dependencies:   FXOS8700Q eCompass_FPU_Lib mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
JimCarver
Date:
Fri May 09 16:30:47 2014 +0000
Parent:
2:51f3303cbefd
Commit message:
Bug fix

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 51f3303cbefd -r d6404f10bd3b main.cpp
--- a/main.cpp	Fri May 09 16:23:09 2014 +0000
+++ b/main.cpp	Fri May 09 16:30:47 2014 +0000
@@ -67,6 +67,7 @@
         seconds++;
         sflag = 1;
         compass.calibrate();
+        debug_print();
         l = 0;
         led = !led;
         }
@@ -82,7 +83,7 @@
     }
 }
  
-*/
+
   
 void print_thread(void const *argument) {
     while (true) {
@@ -91,35 +92,24 @@
         debug_print(); // re-calibrate the eCompass every second
     }
 }
-             
+ */            
 
 int main() {
 
 
-//Thread calibrate(calibrate_thread);
-Thread dprint(print_thread);
-//RtosTimer compass_timer(compass_thread, osTimerPeriodic);
+RtosTimer compass_timer(compass_thread, osTimerPeriodic);
 
 //cdebug = 1;  // uncomment to disable compass
 printf("\r\n\n\n\n\n\n\n");
+printf("Who AM I= %X\r\n", acc.whoAmI());
 acc.enable();
-printf("Who AM I= %X\r\n", acc.whoAmI());
+
 
 acc.getAxis( acc_raw);
 mag.getAxis( mag_raw);
 
-dprint.set_priority(osPriorityLow);
-//calibrate.set_priority(osPriorityBelowNormal);
-//compass_timer.set_priority(osPriorityRealtime);
-
-//compass_timer.start(20); // Run the Compass every 20ms
+compass_timer.start(20); // Run the Compass every 20ms
 while(1) {
-    //while(!sflag);
-    sflag = 0;
-    //debug_print();
-    printf("\r\nL\r\n");
-    //calibrate.signal_set(0x1);
-    dprint.signal_set(0x1);
-    wait(1000);
+    Thread::wait(osWaitForever);
     }  
 }
diff -r 51f3303cbefd -r d6404f10bd3b mbed-rtos.lib
--- a/mbed-rtos.lib	Fri May 09 16:23:09 2014 +0000
+++ b/mbed-rtos.lib	Fri May 09 16:30:47 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#cb1d43beeb70
+http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d