MPU6050のサンプルプログラム2
Dependencies: ConfigFile SDFileSystem mbed
Fork of LAURUS_program by
Diff: GMS6_CR6/GMS6_CR6.cpp
- Revision:
- 16:174daf81eea0
- Parent:
- 4:45dc5590abc0
diff -r d14d385d37e2 -r 174daf81eea0 GMS6_CR6/GMS6_CR6.cpp --- a/GMS6_CR6/GMS6_CR6.cpp Sat Jun 20 16:39:11 2015 +0000 +++ b/GMS6_CR6/GMS6_CR6.cpp Sun Jun 21 15:45:38 2015 +0000 @@ -33,17 +33,20 @@ } void GMS6_CR6::INT_Rx() { + char *sp; buff1[pointer] = p_port->getc(); if(buff1[pointer] != '\r') { - pointer = (pointer+1)%BuffSize; + if(pointer<(BuffSize-1)){ + pointer = pointer+1; + } } else { - if(strstr((const char*)buff1, "GPGGA") != NULL) { + if((sp=strstr(buff1, "$GPGGA")) != NULL) { buff1[pointer] = '\0'; INT_flag = 1; - strcpy(buff2, (const char*)buff1); + strcpy(buff2, sp); INT_flag = 0; - pointer = 0; } + pointer = 0; } } \ No newline at end of file