void vGpsHandler (void *pvParameters) { //char *nmea = "$GNRMC,165835.000,A,6001.8859,N,03024.1946,E,0.02,26.13,151016,,,D*4B\r\n$GPGGA,091719.714,3654.822,N,07502.393,W,0,00,,,M,,M,,*51\r\n"; while(1) { if(osMutexWait(mGPS_DATA_ARRIVAL, 1000) == osOK) { if(!(GpsBufNumber())) { // gps_parser(nmea, strlen(nmea)); gps_parser(pRxBufferGPS, RX_BUFFER_SIZE1/2); //USART_Write(UART_DBG, pRxBufferGPS, RX_BUFFER_SIZE1/2); } else { gps_parser(&pRxBufferGPS[RX_BUFFER_SIZE1/2], RX_BUFFER_SIZE1/2); //USART_Write(UART_DBG, &pRxBufferGPS[RX_BUFFER_SIZE1/2], RX_BUFFER_SIZE1/2); } } } }
int main(void) { PE_low_level_init(); gpio_init(); uart_init(); i2c_init(); gps_sate_data_init(); while(1) { // Wait to receive input data if(kStatus_LPSCI_Success == LPSCI_HAL_ReceiveDataPolling(UART0, &SBUF,1)) { // Echo received character // LPSCI_HAL_SendDataPolling(UART0, &SBUF, 1); gps_parser(); } GPIO_Test_for_TE(); } }
int GPS::Available(void) { int i,j; memset(buffer, 0, sizeof(buffer)); if(mySerial->available()) { while(mySerial->available()) { buffer[i++] = mySerial->read(); if(i == sizeof(buffer))break; } //Serial.write(buffer, i); for(j=0;j<i;j++) { SBUF = buffer[j]; gps_parser(); } } if(gps_recive_ok()) { gps_data_convert(); /* Serial.print(GPS_RMC_Data.UTCDateTime[0]); Serial.print("-"); Serial.print(GPS_RMC_Data.UTCDateTime[1]); Serial.print("-"); Serial.print(GPS_RMC_Data.UTCDateTime[2]); Serial.print(" "); Serial.print(GPS_RMC_Data.UTCDateTime[3]); Serial.print(":"); Serial.print(GPS_RMC_Data.UTCDateTime[4]); Serial.print(":"); Serial.println(GPS_RMC_Data.UTCDateTime[5]); */ return 1; } return 0; }