![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
asdfsaf
Dependencies: MPU6050-DMP-Ian mbed-rtos mbed
main.cpp@0:dceb852b19f3, 2014-05-27 (annotated)
- Committer:
- majik
- Date:
- Tue May 27 09:23:23 2014 +0000
- Revision:
- 0:dceb852b19f3
dfsasf
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
majik | 0:dceb852b19f3 | 1 | /* |
majik | 0:dceb852b19f3 | 2 | This code is in working condition. |
majik | 0:dceb852b19f3 | 3 | DMP works in RTOS environment |
majik | 0:dceb852b19f3 | 4 | */ |
majik | 0:dceb852b19f3 | 5 | |
majik | 0:dceb852b19f3 | 6 | #include "mbed.h" |
majik | 0:dceb852b19f3 | 7 | #include "rtos.h" |
majik | 0:dceb852b19f3 | 8 | #include "robot.h" |
majik | 0:dceb852b19f3 | 9 | #include "MPU6050_6Axis_MotionApps20.h" |
majik | 0:dceb852b19f3 | 10 | #include "DMP.h" |
majik | 0:dceb852b19f3 | 11 | |
majik | 0:dceb852b19f3 | 12 | |
majik | 0:dceb852b19f3 | 13 | |
majik | 0:dceb852b19f3 | 14 | //int main() { |
majik | 0:dceb852b19f3 | 15 | void led2_thread(void const *args){ |
majik | 0:dceb852b19f3 | 16 | DigitalOut reset_pin(PTE5); |
majik | 0:dceb852b19f3 | 17 | test_dmp(); |
majik | 0:dceb852b19f3 | 18 | MPU6050 mpu; |
majik | 0:dceb852b19f3 | 19 | |
majik | 0:dceb852b19f3 | 20 | myled = 0; //turn on LED |
majik | 0:dceb852b19f3 | 21 | |
majik | 0:dceb852b19f3 | 22 | btSwitch = 1; |
majik | 0:dceb852b19f3 | 23 | bt.baud(baudRate); //set baud rate for bluetooth device |
majik | 0:dceb852b19f3 | 24 | |
majik | 0:dceb852b19f3 | 25 | start_dmp(mpu); |
majik | 0:dceb852b19f3 | 26 | |
majik | 0:dceb852b19f3 | 27 | while(1){ |
majik | 0:dceb852b19f3 | 28 | //bt.baud(baudRate); |
majik | 0:dceb852b19f3 | 29 | //reset_pin = 0; |
majik | 0:dceb852b19f3 | 30 | if(!mpuInterrupt && fifoCount < packetSize); //interrupt not ready |
majik | 0:dceb852b19f3 | 31 | else{ //mpu interrupt is ready |
majik | 0:dceb852b19f3 | 32 | update_dmp(mpu); |
majik | 0:dceb852b19f3 | 33 | mpuInterrupt = false; //this resets the interrupt flag |
majik | 0:dceb852b19f3 | 34 | } |
majik | 0:dceb852b19f3 | 35 | } |
majik | 0:dceb852b19f3 | 36 | } |
majik | 0:dceb852b19f3 | 37 | |
majik | 0:dceb852b19f3 | 38 | int main() { |
majik | 0:dceb852b19f3 | 39 | Thread thread(led2_thread); |
majik | 0:dceb852b19f3 | 40 | |
majik | 0:dceb852b19f3 | 41 | while (true) { |
majik | 0:dceb852b19f3 | 42 | Thread::wait(500); |
majik | 0:dceb852b19f3 | 43 | } |
majik | 0:dceb852b19f3 | 44 | } |