@@ -7,7 +7,7 @@ extern UM980 *ptrUM980; // Global pointer for external parser access into librar
77// If it's a response to a command, is it OK or BAD? $command,badResponse,response:
88// PARSING FAILD NO MATCHING FUNC BADRESPONSE*40
99// If it's Unicore binary, load into target variables If it's NMEA or RTCM, discard
10- void eomHandler (PARSE_STATE *parse)
10+ void eomHandler (UNICORE_PARSE_STATE *parse)
1111{
1212 // Switch on message type (NMEA, RTCM, Unicore Binary, etc)
1313
@@ -67,7 +67,7 @@ void eomHandler(PARSE_STATE *parse)
6767 }
6868}
6969
70- void waitForPreamble (PARSE_STATE *parse, uint8_t data)
70+ void um980WaitForPreamble (UNICORE_PARSE_STATE *parse, uint8_t data)
7171{
7272 // Verify that this is the preamble byte
7373 switch (data)
@@ -95,7 +95,7 @@ void waitForPreamble(PARSE_STATE *parse, uint8_t data)
9595
9696 parse->check = 0 ;
9797 parse->nmeaMessageNameLength = 0 ;
98- parse->state = PARSE_STATE_NMEA_FIRST_COMMA ;
98+ parse->state = UNICORE_PARSE_STATE_NMEA_FIRST_COMMA ;
9999 return ;
100100
101101 case 0xD3 :
@@ -115,7 +115,7 @@ void waitForPreamble(PARSE_STATE *parse, uint8_t data)
115115 //
116116
117117 // Start the CRC with this byte
118- parse->state = PARSE_STATE_RTCM_LENGTH1 ;
118+ parse->state = UNICORE_PARSE_STATE_RTCM_LENGTH1 ;
119119 return ;
120120
121121 case 0xAA :
@@ -134,17 +134,17 @@ void waitForPreamble(PARSE_STATE *parse, uint8_t data)
134134 // |<------------------------ CRC --------------->|
135135 //
136136
137- parse->state = PARSE_STATE_UNICORE_SYNC2 ;
137+ parse->state = UNICORE_PARSE_STATE_UNICORE_SYNC2 ;
138138 return ;
139139 }
140140
141141 // Preamble byte not found
142142 parse->length = 0 ;
143- parse->state = PARSE_STATE_WAITING_FOR_PREAMBLE ;
143+ parse->state = UNICORE_PARSE_STATE_WAITING_FOR_PREAMBLE ;
144144}
145145
146146// Read the message name
147- void nmeaFindFirstComma (PARSE_STATE *parse, uint8_t data)
147+ void um980NmeaFindFirstComma (UNICORE_PARSE_STATE *parse, uint8_t data)
148148{
149149 parse->check ^= data;
150150 if ((data != ' ,' ) || (parse->nmeaMessageNameLength == 0 ))
@@ -159,35 +159,35 @@ void nmeaFindFirstComma(PARSE_STATE *parse, uint8_t data)
159159 {
160160 // Zero terminate the message name
161161 parse->nmeaMessageName [parse->nmeaMessageNameLength ++] = 0 ;
162- parse->state = PARSE_STATE_NMEA_FIND_ASTERISK ; // Move to next state
162+ parse->state = UNICORE_PARSE_STATE_NMEA_FIND_ASTERISK ; // Move to next state
163163 }
164164}
165165
166166// Read the message data
167- void nmeaFindAsterisk (PARSE_STATE *parse, uint8_t data)
167+ void um980NmeaFindAsterisk (UNICORE_PARSE_STATE *parse, uint8_t data)
168168{
169169 if (data != ' *' )
170170 parse->check ^= data;
171171 else
172- parse->state = PARSE_STATE_NMEA_CHECKSUM1 ; // Move to next state
172+ parse->state = UNICORE_PARSE_STATE_NMEA_CHECKSUM1 ; // Move to next state
173173}
174174
175175// Read the first checksum byte
176- void nmeaChecksumByte1 (PARSE_STATE *parse, uint8_t data)
176+ void um980NmeaChecksumByte1 (UNICORE_PARSE_STATE *parse, uint8_t data)
177177{
178- parse->state = PARSE_STATE_NMEA_CHECKSUM2 ; // Move to next state
178+ parse->state = UNICORE_PARSE_STATE_NMEA_CHECKSUM2 ; // Move to next state
179179}
180180
181181// Read the second checksum byte
182- void nmeaChecksumByte2 (PARSE_STATE *parse, uint8_t data)
182+ void um980NmeaChecksumByte2 (UNICORE_PARSE_STATE *parse, uint8_t data)
183183{
184184 parse->nmeaLength = parse->length ;
185185 parse->bytesRemaining = 2 ;
186- parse->state = PARSE_STATE_NMEA_TERMINATION ; // Move to next state
186+ parse->state = UNICORE_PARSE_STATE_NMEA_TERMINATION ; // Move to next state
187187}
188188
189189// Read the line termination
190- void nmeaLineTermination (PARSE_STATE *parse, uint8_t data)
190+ void um980NmeaLineTermination (UNICORE_PARSE_STATE *parse, uint8_t data)
191191{
192192 // We expect a \r\n termination, but may vary between receiver types
193193 if (data == ' \r ' || data == ' \n ' )
@@ -280,7 +280,7 @@ void nmeaLineTermination(PARSE_STATE *parse, uint8_t data)
280280 eomHandler (parse);
281281
282282 parse->length = 0 ;
283- parse->state = PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move to next state
283+ parse->state = UNICORE_PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move to next state
284284 return ;
285285 }
286286
@@ -315,14 +315,14 @@ void nmeaLineTermination(PARSE_STATE *parse, uint8_t data)
315315 // We already have new data, process it immediately
316316 parse->length = 0 ;
317317 parse->buffer [parse->length ++] = data;
318- parse->state = PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move to next state
319- return (waitForPreamble (parse, data));
318+ parse->state = UNICORE_PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move to next state
319+ return (um980WaitForPreamble (parse, data));
320320 }
321321 else
322322 {
323323 // We're done. Move on to waiting.
324324 parse->length = 0 ;
325- parse->state = PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move to next state
325+ parse->state = UNICORE_PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move to next state
326326 }
327327 }
328328}
@@ -340,37 +340,37 @@ int AsciiToNibble(int data)
340340}
341341
342342// Read the second sync byte
343- void unicoreBinarySync2 (PARSE_STATE *parse, uint8_t data)
343+ void um980UnicoreBinarySync2 (UNICORE_PARSE_STATE *parse, uint8_t data)
344344{
345345 // Verify sync byte 2
346346 if (data != 0x44 )
347347 {
348348 // Invalid sync byte, place this byte at the beginning of the buffer
349349 parse->length = 0 ;
350350 parse->buffer [parse->length ++] = data;
351- return (waitForPreamble (parse, data)); // Start searching for a preamble byte
351+ return (um980WaitForPreamble (parse, data)); // Start searching for a preamble byte
352352 }
353353
354- parse->state = PARSE_STATE_UNICORE_SYNC3 ; // Move on
354+ parse->state = UNICORE_PARSE_STATE_UNICORE_SYNC3 ; // Move on
355355}
356356
357357// Read the third sync byte
358- void unicoreBinarySync3 (PARSE_STATE *parse, uint8_t data)
358+ void um980UnicoreBinarySync3 (UNICORE_PARSE_STATE *parse, uint8_t data)
359359{
360360 // Verify sync byte 3
361361 if (data != 0xB5 )
362362 {
363363 // Invalid sync byte, place this byte at the beginning of the buffer
364364 parse->length = 0 ;
365365 parse->buffer [parse->length ++] = data;
366- return (waitForPreamble (parse, data)); // Start searching for a preamble byte
366+ return (um980WaitForPreamble (parse, data)); // Start searching for a preamble byte
367367 }
368368
369- parse->state = PARSE_STATE_UNICORE_READ_LENGTH ; // Move on
369+ parse->state = UNICORE_PARSE_STATE_UNICORE_READ_LENGTH ; // Move on
370370}
371371
372372// Read the message length
373- void unicoreBinaryReadLength (PARSE_STATE *parse, uint8_t data)
373+ void um980UnicoreBinaryReadLength (UNICORE_PARSE_STATE *parse, uint8_t data)
374374{
375375 if (parse->length == offsetHeaderMessageLength + 2 )
376376 {
@@ -390,17 +390,17 @@ void unicoreBinaryReadLength(PARSE_STATE *parse, uint8_t data)
390390 parse->buffer [parse->length ++] = data;
391391
392392 // Start searching for a preamble byte
393- return waitForPreamble (parse, data);
393+ return um980WaitForPreamble (parse, data);
394394 }
395395
396396 // Account for the bytes already received
397397 parse->bytesRemaining -= parse->length ;
398- parse->state = PARSE_STATE_UNICORE_READ_DATA ; // Move on
398+ parse->state = UNICORE_PARSE_STATE_UNICORE_READ_DATA ; // Move on
399399 }
400400}
401401
402402// Read the message content until we reach the end, then check CRC
403- void unicoreReadData (PARSE_STATE *parse, uint8_t data)
403+ void um980UnicoreReadData (UNICORE_PARSE_STATE *parse, uint8_t data)
404404{
405405 // Account for this data byte
406406 parse->bytesRemaining -= 1 ;
@@ -434,7 +434,7 @@ void unicoreReadData(PARSE_STATE *parse, uint8_t data)
434434
435435 // Search for another preamble byte
436436 parse->length = 0 ;
437- parse->state = PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move on
437+ parse->state = UNICORE_PARSE_STATE_WAITING_FOR_PREAMBLE ; // Move on
438438}
439439
440440// Calculate and return the CRC of the given buffer
@@ -447,7 +447,7 @@ uint32_t calculateCRC32(uint8_t *charBuffer, uint16_t bufferSize)
447447}
448448
449449// Read the upper two bits of the length
450- void rtcmReadLength1 (PARSE_STATE *parse, uint8_t data)
450+ void um980RtcmReadLength1 (UNICORE_PARSE_STATE *parse, uint8_t data)
451451{
452452 // Verify the length byte - check the 6 MS bits are all zero
453453 if (data & (~3 ))
@@ -457,16 +457,16 @@ void rtcmReadLength1(PARSE_STATE *parse, uint8_t data)
457457 parse->buffer [parse->length ++] = data;
458458
459459 // Start searching for a preamble byte
460- return waitForPreamble (parse, data);
460+ return um980WaitForPreamble (parse, data);
461461 }
462462
463463 // Save the upper 2 bits of the length
464464 parse->bytesRemaining = data << 8 ;
465- parse->state = PARSE_STATE_RTCM_LENGTH2 ;
465+ parse->state = UNICORE_PARSE_STATE_RTCM_LENGTH2 ;
466466}
467467
468468// Read the lower 8 bits of the length
469- void rtcmReadLength2 (PARSE_STATE *parse, uint8_t data)
469+ void um980RtcmReadLength2 (UNICORE_PARSE_STATE *parse, uint8_t data)
470470{
471471 parse->bytesRemaining |= data;
472472
@@ -480,28 +480,28 @@ void rtcmReadLength2(PARSE_STATE *parse, uint8_t data)
480480 parse->buffer [parse->length ++] = data;
481481
482482 // Start searching for a preamble byte
483- return waitForPreamble (parse, data);
483+ return um980WaitForPreamble (parse, data);
484484 }
485485
486- parse->state = PARSE_STATE_RTCM_MESSAGE1 ;
486+ parse->state = UNICORE_PARSE_STATE_RTCM_MESSAGE1 ;
487487}
488488
489489// Read the upper 8 bits of the message number
490- void rtcmReadMessage1 (PARSE_STATE *parse, uint8_t data)
490+ void um980RtcmReadMessage1 (UNICORE_PARSE_STATE *parse, uint8_t data)
491491{
492492 parse->bytesRemaining -= 1 ;
493- parse->state = PARSE_STATE_RTCM_MESSAGE2 ;
493+ parse->state = UNICORE_PARSE_STATE_RTCM_MESSAGE2 ;
494494}
495495
496496// Read the lower 4 bits of the message number
497- void rtcmReadMessage2 (PARSE_STATE *parse, uint8_t data)
497+ void um980RtcmReadMessage2 (UNICORE_PARSE_STATE *parse, uint8_t data)
498498{
499499 parse->bytesRemaining -= 1 ;
500- parse->state = PARSE_STATE_RTCM_DATA ;
500+ parse->state = UNICORE_PARSE_STATE_RTCM_DATA ;
501501}
502502
503503// Read the rest of the message
504- void rtcmReadData (PARSE_STATE *parse, uint8_t data)
504+ void um980RtcmReadData (UNICORE_PARSE_STATE *parse, uint8_t data)
505505{
506506 // Account for this data byte
507507 parse->bytesRemaining -= 1 ;
@@ -510,12 +510,12 @@ void rtcmReadData(PARSE_STATE *parse, uint8_t data)
510510 if (parse->bytesRemaining <= 0 )
511511 {
512512 parse->bytesRemaining = 3 ;
513- parse->state = PARSE_STATE_RTCM_CRC ;
513+ parse->state = UNICORE_PARSE_STATE_RTCM_CRC ;
514514 }
515515}
516516
517517// Read the CRC
518- void rtcmReadCrc (PARSE_STATE *parse, uint8_t data)
518+ void um980RtcmReadCrc (UNICORE_PARSE_STATE *parse, uint8_t data)
519519{
520520 // Account for this data byte
521521 parse->bytesRemaining -= 1 ;
@@ -556,5 +556,5 @@ void rtcmReadCrc(PARSE_STATE *parse, uint8_t data)
556556
557557 // Search for another preamble byte
558558 parse->length = 0 ;
559- parse->state = PARSE_STATE_WAITING_FOR_PREAMBLE ;
559+ parse->state = UNICORE_PARSE_STATE_WAITING_FOR_PREAMBLE ;
560560}
0 commit comments