gprs
Fork of Nucleo_printf_test by
Diff: main.cpp
- Revision:
- 1:78ed2d2c5af7
- Parent:
- 0:3ba942901d6e
--- a/main.cpp Fri Jun 09 02:45:45 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -#include "mbed.h" -#include <cstring> - -Serial pc(SERIAL_TX, SERIAL_RX); //USART2 -Serial gps(D1,D0); //USART1 -DigitalOut myled(LED1); -char buffer[256]; -void getline(); -void callback() -{ - getline(); -} -volatile int sig=0; -volatile int i=0; -int main() -{ - pc.printf("start test!\r\n"); - gps.attach(&callback); - - while(1) - { - hal_sleep(); - if(sig == 7) - { - sig=0; - i=0; - pc.printf("%s",buffer); - memset(buffer,0,sizeof(buffer)); - } - } -} - - -void getline() -{ - buffer[i] = gps.getc(); - if(buffer[i] == 0x0a) - { - sig++; - } - i++; -}