Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: RTOS-Threads/src/Task1.cpp
- Revision:
- 31:3dde2201e54d
- Parent:
- 30:d9b988f8d84f
- Child:
- 33:f88a6ee18103
--- a/RTOS-Threads/src/Task1.cpp Mon May 12 04:43:38 2014 +0000
+++ b/RTOS-Threads/src/Task1.cpp Mon May 12 05:12:19 2014 +0000
@@ -1,7 +1,8 @@
/* File: Task1.cpp
* Author: Trung Tin Ian HUA
* Date: May 2014
- * Purpose: Thread1: Code to read Yaw Pitch Roll angles from MPU6050 DMP.
+ * Functions: Thread1: Service YPR telemetry output
+ * Functions: AHRSSample: Read MPU6050 DMP and calculate YPR
* Settings: 100Hz
* Timing: 1440us
*/
@@ -31,9 +32,6 @@
double heading = 0;
#endif
-#ifdef TIME_TASK1
-Timer _t1;
-#endif
// ================================================================
// === YPR THREAD ===
// ================================================================
@@ -42,37 +40,20 @@
switch (box_demo) {
case true:
AHRSSample();
-
- BT.printf("
+ if (box_demo)
+ BT.printf("\nY%3.2f\nP%3.2f\nR%3.2f\n", ypr[0] - ypr_offset[0],
+ ypr[1] - ypr_offset[1], ypr[2] - ypr_offset[2]);
break;
-
- case false:
-#ifdef TIME_TASK1
- _t1.reset();
- _t1.start();
-#endif
- if (armed) {
- switch (mode) {
- case RATE:
- break;
-
- case ATTITUDE:
- default:
- AHRSSample();
-
- counterTask1 = true;
- break;
- }
- }
}
}
-
+//Timer
// ================================================================
// === Helper functions ===
// ================================================================
void AHRSSample(void)
{
+//Timer
// reset interrupt flag and get INT_STATUS byte
mpuIntStatus = imu.getIntStatus();
@@ -120,4 +101,5 @@
ypr[0] += 0.02*heading;
*/
}
-}
\ No newline at end of file
+//Timer
+}