AHRS with RTOS
Dependencies: AHRS mbed-rtos mbed
Fork of RazorAHRS by
main.cpp@3:c2d895d76e75, 2012-11-08 (annotated)
- Committer:
- tylerjw
- Date:
- Thu Nov 08 18:57:58 2012 +0000
- Revision:
- 3:c2d895d76e75
RtosTimer AHRS demo.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tylerjw | 3:c2d895d76e75 | 1 | #include "mbed.h" |
tylerjw | 3:c2d895d76e75 | 2 | #include "AHRS.h" |
tylerjw | 3:c2d895d76e75 | 3 | #include "rtos.h" |
tylerjw | 3:c2d895d76e75 | 4 | |
tylerjw | 3:c2d895d76e75 | 5 | IMU imu; |
tylerjw | 3:c2d895d76e75 | 6 | Serial pc(USBTX, USBRX); |
tylerjw | 3:c2d895d76e75 | 7 | |
tylerjw | 3:c2d895d76e75 | 8 | void imu_thread(void const *arg) |
tylerjw | 3:c2d895d76e75 | 9 | { |
tylerjw | 3:c2d895d76e75 | 10 | float data[4]; |
tylerjw | 3:c2d895d76e75 | 11 | imu.loop(data); |
tylerjw | 3:c2d895d76e75 | 12 | pc.printf("#YPR=%f,%f,%f\t%f\r\n", data[1],data[2],data[3],data[0]); |
tylerjw | 3:c2d895d76e75 | 13 | } |
tylerjw | 3:c2d895d76e75 | 14 | |
tylerjw | 3:c2d895d76e75 | 15 | int main() |
tylerjw | 3:c2d895d76e75 | 16 | { |
tylerjw | 3:c2d895d76e75 | 17 | pc.baud(9600); |
tylerjw | 3:c2d895d76e75 | 18 | |
tylerjw | 3:c2d895d76e75 | 19 | RtosTimer ahrs_timer(imu_thread, osTimerPeriodic, NULL); |
tylerjw | 3:c2d895d76e75 | 20 | ahrs_timer.start(20); |
tylerjw | 3:c2d895d76e75 | 21 | |
tylerjw | 3:c2d895d76e75 | 22 | while (1); |
tylerjw | 3:c2d895d76e75 | 23 | } |