void gpsNmeaTest(void) { // set the baud rate of UART 1 for NMEA uartSetBaudRate(1,4800); // clear screen vt100ClearScreen(); // initialize gps library gpsInit(); // initialize gps packet decoder nmeaInit(); // begin gps packet processing loop while(1) { // process received gps packets until receive buffer is exhausted while( nmeaProcess(uartGetRxBuffer(1)) ); // set cursor position to top left of screen vt100SetCursorPos(0,0); // print/dump current formatted GPS data gpsInfoPrint(); // print UART 1 overflow status to verify that we're processing packets // fast enough and that our receive buffer is large enough rprintf("Uart1RxOvfl: %d\r\n",uartRxOverflow[1]); // pause for 100ms timerPause(100); } }
/** * Called each time there are data in the input buffer */ void NMEAParser::processInputStream(char c) { if( !bufferAddToEnd(&gpsRxBuffer, c) ) { // no space in buffer // count overflow gpsRxOverflow++; return; } nmeaProcess(&gpsRxBuffer); }