generation_mbed2
Dependencies: 202hm2_slave mbed
Fork of 202hm2_slave by
Diff: main.cpp
- Revision:
- 1:76a206e19490
- Parent:
- 0:7c4f7de16626
- Child:
- 2:4457eb1e9b83
--- a/main.cpp Thu Mar 13 21:27:49 2014 +0000 +++ b/main.cpp Thu Mar 13 22:05:48 2014 +0000 @@ -19,13 +19,11 @@ uint32_t TIME(){return loop_num*mod+TPM0->CNT;} -void sycronize(){ +void synchronize(){ switch(state){ - case 0:{buff=0; - pc.printf("state0\n"); - while(uart.readable()&& buff<4){ - buffer[buff]=uart.getc();buff++;} - + case 0:{pc.printf("state0"); + if(uart.readable()&&buff<4){buffer[buff]=uart.getc();buff++;} + else if(buff==4){ pc.printf("0=%d\n",buffer[0]); pc.printf("1=%d\n",buffer[1]); pc.printf("2=%d\n",buffer[2]); @@ -36,6 +34,8 @@ pc.printf("\n"); TPM0->MOD=mod; state++;break;}//sending a 9 char command + else break; + } case 1: { T3=TIME(); char* tmp=(char*)&T2; @@ -93,7 +93,7 @@ NVIC_DisableIRQ(TPM0_IRQn); NVIC_ClearPendingIRQ(TPM0_IRQn); pc.printf("set=%d\n",state); - while(state<4){sycronize();} + while(state<4){synchronize();} } void Initial(){