9 static volatile uint8_t gnss_data_buffer[GNSS_DATA_BUFFER_SIZE];
10 static volatile uint16_t buf_index=0;
11 static volatile uint8_t GNSS_location_stored=0;
12 static volatile uint8_t GNSS_location_found=0;
13 #define LOC_ID_LENGTH 6
14 const uint8_t location_identifier[] = {
"$GNGLL"};
15 static volatile uint8_t id_index=0;
17 void USART2_IRQHandler(
void)
20 volatile uint32_t SR_content;
23 SR_content = USART2->SR;
27 if (!GNSS_location_stored)
29 if (SR_content & USART_SR_ORE)
36 gnss_data_buffer[buf_index] = tmp;
37 if (buf_index<(GNSS_DATA_BUFFER_SIZE-1))
42 if ((tmp==location_identifier[id_index]) && (GNSS_location_found==0))
46 if (id_index>=LOC_ID_LENGTH)
49 GNSS_location_found=1;
56 if (GNSS_location_found==0)
62 if (GNSS_location_found)
64 if ((gnss_data_buffer[buf_index-1]==
'\n') && (gnss_data_buffer[buf_index-2]==
'\r'))
68 gnss_data_buffer[buf_index-2]=0;
70 GNSS_location_found=0;
74 GNSS_location_stored=1;
84 if (GNSS_location_stored)
89 while ((gnss_data_buffer[k]!=0) && (k<(max_length-1)))
91 str_out[k] = gnss_data_buffer[k];
98 GNSS_location_stored=0;