Exemplo n.º 1
0
TM_GPS_Result_t TM_GPS_Update(TM_GPS_Data_t* GPS_Data) {
	if (!TM_USART_BufferEmpty(GPS_USART)) {
		while (!TM_USART_BufferEmpty(GPS_USART)) {
			TM_GPS_INT_Do(GPS_Data, (char)TM_USART_Getc(GPS_USART));
			if (GPS_Data->Status == TM_GPS_Result_NewData) {
				return GPS_Data->Status;
			}
		}
	}
	if (TM_GPS_FirstTime) {
		/* No any valid data, return First Data Waiting */
		/* Returning only after power up and calling when no all data is received */
		return TM_GPS_INT_ReturnWithStatus(GPS_Data, TM_GPS_Result_FirstDataWaiting);
	}
	/* We have old data */
	return TM_GPS_INT_ReturnWithStatus(GPS_Data, TM_GPS_Result_OldData);
}
TM_GPS_Result_t TM_GPS_Update(TM_GPS_t* GPS_Data) {
    /* Check for data in USART */
    while (!GPS_USART_BUFFER_EMPTY) {
        TM_GPS_INT_Do(GPS_Data, (char)GPS_USART_BUFFER_GET_CHAR);
        if (GPS_Data->Status == TM_GPS_Result_NewData) {
            return GPS_Data->Status;
        }
    }

    if (TM_GPS_FirstTime) {
        /* No any valid data, return First Data Waiting */
        /* Returning only after power up and calling when no all data is received */
        TM_GPS_INT_ReturnWithStatus(GPS_Data, TM_GPS_Result_FirstDataWaiting);
    }

    /* We have old data */
    TM_GPS_INT_ReturnWithStatus(GPS_Data, TM_GPS_Result_OldData);
}