Pol Rodoreda Valeri
/
RTOS_rma_2
jiosd
Fork of rtos_basic by
Revision 7:8fcd03be2590, committed 2016-11-11
- Comitter:
- polrodoreda
- Date:
- Fri Nov 11 18:48:15 2016 +0000
- Parent:
- 6:209f4db62daf
- Commit message:
- P5; 2
Changed in this revision
diff -r 209f4db62daf -r 8fcd03be2590 main.cpp --- a/main.cpp Tue Jun 04 16:01:32 2013 +0100 +++ b/main.cpp Fri Nov 11 18:48:15 2016 +0000 @@ -1,21 +1,77 @@ #include "mbed.h" #include "rtos.h" - -DigitalOut led1(LED1); -DigitalOut led2(LED2); + -void led2_thread(void const *args) { - while (true) { - led2 = !led2; - Thread::wait(1000); +DigitalOut led1S(p8); +DigitalOut led2S(p10); + +Timer tim1; +Timer tim2; +Timer tim3; + +int vectorT1[2][100]; +int vectorT2[2][100]; +int inde = 0; +const int max = 1000; +int T=100; +int Tfor=76; + + void t1_thread(void const *args) { + while(true) { + tim3.reset(); + + vectorT1[0][inde]=tim1.read_ms(); + vectorT2[1][inde]=tim2.read_ms(); + for(int i=0; i< max; i++ ){ + for(int j=0; j< max; j++ ){ + int a=1; + } + } + Thread::wait(10*tim3.read_ms()); } } - + +/*void t2_thread(void const *args) { + while(true) { + + } +}*/ int main() { - Thread thread(led2_thread); + tim1.start(); + tim2.start(); + tim3.start(); + Thread thread1(t1_thread); + //Thread thread2(t2_thread); + //osThreadSetPriority(osThreadGetId(),osPriorityBelowNormal); while (true) { - led1 = !led1; - Thread::wait(500); + tim3.reset(); + + vectorT2[0][inde]=tim2.read_ms(); + vectorT1[1][inde]=tim1.read_ms(); + for(int i=0; i< max; i++ ){ + for(int j=0; j< max; j++ ){ + int a=1; + } + } + for(int i=0; i< max; i++ ){ + for(int j=0; j< max; j++ ){ + int a=1; + } + } + Thread::wait(1.5*tim3.read_ms()); + + if(inde < 100){ + inde++; + }else{ + printf("INIT PRINT\r\n"); + for(int i=0; i < inde; i++ ){ + printf("%d:\t%d,%d,%d,%d\r\n",i, vectorT1[0][i], vectorT1[1][i], vectorT2[0][i], vectorT2[1][i]); + } + printf("END PRINT\r\n"); + inde=0; + tim1.reset(); + tim2.reset(); + } } }
diff -r 209f4db62daf -r 8fcd03be2590 mbed-rtos.lib --- a/mbed-rtos.lib Tue Jun 04 16:01:32 2013 +0100 +++ b/mbed-rtos.lib Fri Nov 11 18:48:15 2016 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/mbed-rtos/ \ No newline at end of file +https://mbed.org/users/mbed_official/code/mbed-rtos/#3da5f554d8bf
diff -r 209f4db62daf -r 8fcd03be2590 mbed.bld --- a/mbed.bld Tue Jun 04 16:01:32 2013 +0100 +++ b/mbed.bld Fri Nov 11 18:48:15 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file