Skip to content

Commit 4cb3ccf

Browse files
committed
Rename sempUnicore* to sempUnicoreBinary*
1 parent b9cdcc1 commit 4cb3ccf

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed

Examples/Unicore_Test/Unicore_Test.ino renamed to Examples/Unicore_Binary_Test/Unicore_Binary_Test.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
SparkFun Unicore test example sketch
2+
SparkFun Unicore binary test example sketch
33
44
License: MIT. Please see LICENSE.md for more details
55
*/
@@ -14,13 +14,13 @@
1414
// Build the table listing all of the parsers
1515
SEMP_PARSE_ROUTINE const parserTable[] =
1616
{
17-
sempUnicorePreamble
17+
sempUnicoreBinaryPreamble
1818
};
1919
const int parserCount = sizeof(parserTable) / sizeof(parserTable[0]);
2020

2121
const char * const parserNames[] =
2222
{
23-
"Unicore parser"
23+
"Unicore binary parser"
2424
};
2525
const int parserNameCount = sizeof(parserNames) / sizeof(parserNames[0]);
2626

src/Parse_Unicore.cpp renamed to src/Parse_Unicore_Binary.cpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*------------------------------------------------------------------------------
2-
Parse_Unicore.cpp
2+
Parse_Unicore_Binary.cpp
33
44
Unicore message parsing support routines
55
@@ -22,7 +22,7 @@ License: MIT. Please see LICENSE.md for more details
2222
//----------------------------------------
2323

2424
// Compute the CRC for the Unicore data
25-
uint32_t sempUnicoreComputeCrc(SEMP_PARSE_STATE *parse, uint8_t data)
25+
uint32_t sempUnicoreBinaryComputeCrc(SEMP_PARSE_STATE *parse, uint8_t data)
2626
{
2727
uint32_t crc;
2828

@@ -32,7 +32,7 @@ uint32_t sempUnicoreComputeCrc(SEMP_PARSE_STATE *parse, uint8_t data)
3232
}
3333

3434
// Print the Unicore message header
35-
void sempUnicorePrintHeader(SEMP_PARSE_STATE *parse)
35+
void sempUnicoreBinaryPrintHeader(SEMP_PARSE_STATE *parse)
3636
{
3737
SEMP_UNICORE_HEADER * header;
3838

@@ -77,12 +77,12 @@ void sempUnicorePrintHeader(SEMP_PARSE_STATE *parse)
7777
//
7878

7979
// Read the CRC
80-
bool sempUnicoreReadCrc(SEMP_PARSE_STATE *parse, uint8_t data)
80+
bool sempUnicoreBinaryReadCrc(SEMP_PARSE_STATE *parse, uint8_t data)
8181
{
8282
SEMP_SCRATCH_PAD *scratchPad = (SEMP_SCRATCH_PAD *)parse->scratchPad;
8383

8484
// Determine if the entire message was read
85-
if (--scratchPad->unicore.bytesRemaining)
85+
if (--scratchPad->unicoreBinary.bytesRemaining)
8686
// Need more bytes
8787
return true;
8888

@@ -100,27 +100,27 @@ bool sempUnicoreReadCrc(SEMP_PARSE_STATE *parse, uint8_t data)
100100
parse->buffer[parse->length - 3],
101101
parse->buffer[parse->length - 2],
102102
parse->buffer[parse->length - 1],
103-
scratchPad->unicore.crc & 0xff,
104-
(scratchPad->unicore.crc >> 8) & 0xff,
105-
(scratchPad->unicore.crc >> 16) & 0xff,
106-
(scratchPad->unicore.crc >> 24) & 0xff);
103+
scratchPad->unicoreBinary.crc & 0xff,
104+
(scratchPad->unicoreBinary.crc >> 8) & 0xff,
105+
(scratchPad->unicoreBinary.crc >> 16) & 0xff,
106+
(scratchPad->unicoreBinary.crc >> 24) & 0xff);
107107
}
108108
parse->state = sempFirstByte;
109109
return false;
110110
}
111111

112112
// Read the message data
113-
bool sempUnicoreReadData(SEMP_PARSE_STATE *parse, uint8_t data)
113+
bool sempUnicoreBinaryReadData(SEMP_PARSE_STATE *parse, uint8_t data)
114114
{
115115
SEMP_SCRATCH_PAD *scratchPad = (SEMP_SCRATCH_PAD *)parse->scratchPad;
116116

117117
// Determine if the entire message was read
118-
if (!--scratchPad->unicore.bytesRemaining)
118+
if (!--scratchPad->unicoreBinary.bytesRemaining)
119119
{
120120
// The message data is complete, read the CRC
121-
scratchPad->unicore.bytesRemaining = 4;
122-
scratchPad->unicore.crc = parse->crc;
123-
parse->state = sempUnicoreReadCrc;
121+
scratchPad->unicoreBinary.bytesRemaining = 4;
122+
scratchPad->unicoreBinary.crc = parse->crc;
123+
parse->state = sempUnicoreBinaryReadCrc;
124124
}
125125
return true;
126126
}
@@ -143,75 +143,75 @@ bool sempUnicoreReadData(SEMP_PARSE_STATE *parse, uint8_t data)
143143
// 2 Output delay time, ms
144144
//
145145
// Read the header
146-
bool sempUnicoreReadHeader(SEMP_PARSE_STATE *parse, uint8_t data)
146+
bool sempUnicoreBinaryReadHeader(SEMP_PARSE_STATE *parse, uint8_t data)
147147
{
148148
SEMP_SCRATCH_PAD *scratchPad = (SEMP_SCRATCH_PAD *)parse->scratchPad;
149149

150150
if (parse->length >= sizeof(SEMP_UNICORE_HEADER))
151151
{
152152
// The header is complete, read the message data next
153153
SEMP_UNICORE_HEADER *header = (SEMP_UNICORE_HEADER *)parse->buffer;
154-
scratchPad->unicore.bytesRemaining = header->messageLength;
155-
parse->state = sempUnicoreReadData;
154+
scratchPad->unicoreBinary.bytesRemaining = header->messageLength;
155+
parse->state = sempUnicoreBinaryReadData;
156156
}
157157
return true;
158158
}
159159

160160
// Read the third sync byte
161-
bool sempUnicoreBinarySync3(SEMP_PARSE_STATE *parse, uint8_t data)
161+
bool sempUnicoreBinaryBinarySync3(SEMP_PARSE_STATE *parse, uint8_t data)
162162
{
163163
// Verify sync byte 3
164164
if (data != 0xB5)
165165
// Invalid sync byte, start searching for a preamble byte
166166
return sempFirstByte(parse, data);
167167

168168
// Read the header next
169-
parse->state = sempUnicoreReadHeader;
169+
parse->state = sempUnicoreBinaryReadHeader;
170170
return true;
171171
}
172172

173173
// Read the second sync byte
174-
bool sempUnicoreBinarySync2(SEMP_PARSE_STATE *parse, uint8_t data)
174+
bool sempUnicoreBinaryBinarySync2(SEMP_PARSE_STATE *parse, uint8_t data)
175175
{
176176
// Verify sync byte 2
177177
if (data != 0x44)
178178
// Invalid sync byte, start searching for a preamble byte
179179
return sempFirstByte(parse, data);
180180

181181
// Look for the last sync byte
182-
parse->state = sempUnicoreBinarySync3;
182+
parse->state = sempUnicoreBinaryBinarySync3;
183183
return true;
184184
}
185185

186186
// Check for the preamble
187-
bool sempUnicorePreamble(SEMP_PARSE_STATE *parse, uint8_t data)
187+
bool sempUnicoreBinaryPreamble(SEMP_PARSE_STATE *parse, uint8_t data)
188188
{
189189
// Determine if this is the beginning of a Unicore message
190190
if (data != 0xAA)
191191
return false;
192192

193193
// Look for the second sync byte
194194
parse->crc = 0;
195-
parse->computeCrc = sempUnicoreComputeCrc;
195+
parse->computeCrc = sempUnicoreBinaryComputeCrc;
196196
parse->crc = parse->computeCrc(parse, data);
197-
parse->state = sempUnicoreBinarySync2;
197+
parse->state = sempUnicoreBinaryBinarySync2;
198198
return true;
199199
}
200200

201201
// Translates state value into an string, returns nullptr if not found
202-
const char * sempUnicoreGetStateName(const SEMP_PARSE_STATE *parse)
202+
const char * sempUnicoreBinaryGetStateName(const SEMP_PARSE_STATE *parse)
203203
{
204-
if (parse->state == sempUnicorePreamble)
205-
return "sempUnicorePreamble";
206-
if (parse->state == sempUnicoreBinarySync2)
207-
return "sempUnicoreBinarySync2";
208-
if (parse->state == sempUnicoreBinarySync3)
209-
return "sempUnicoreBinarySync3";
210-
if (parse->state == sempUnicoreReadHeader)
211-
return "sempUnicoreReadHeader";
212-
if (parse->state == sempUnicoreReadData)
213-
return "sempUnicoreReadData";
214-
if (parse->state == sempUnicoreReadCrc)
215-
return "sempUnicoreReadCrc";
204+
if (parse->state == sempUnicoreBinaryPreamble)
205+
return "sempUnicoreBinaryPreamble";
206+
if (parse->state == sempUnicoreBinaryBinarySync2)
207+
return "sempUnicoreBinaryBinarySync2";
208+
if (parse->state == sempUnicoreBinaryBinarySync3)
209+
return "sempUnicoreBinaryBinarySync3";
210+
if (parse->state == sempUnicoreBinaryReadHeader)
211+
return "sempUnicoreBinaryReadHeader";
212+
if (parse->state == sempUnicoreBinaryReadData)
213+
return "sempUnicoreBinaryReadData";
214+
if (parse->state == sempUnicoreBinaryReadCrc)
215+
return "sempUnicoreBinaryReadCrc";
216216
return nullptr;
217217
}

src/SparkFun_Extensible_Message_Parser.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ typedef struct _SEMP_UBLOX_VALUES
7979
} SEMP_UBLOX_VALUES;
8080

8181
// Unicore parser scratch area
82-
typedef struct _SEMP_UNICORE_VALUES
82+
typedef struct _SEMP_UNICORE_BINARY_VALUES
8383
{
8484
uint32_t crc; // Copy of CRC calculation before CRC bytes
8585
uint16_t bytesRemaining; // Bytes remaining in RTCM CRC calculation
86-
} SEMP_UNICORE_VALUES;
86+
} SEMP_UNICORE_BINARY_VALUES;
8787

8888
// Overlap the scratch areas since only one parser is active at a time
8989
typedef union
9090
{
9191
SEMP_NMEA_VALUES nmea; // NMEA specific values
9292
SEMP_RTCM_VALUES rtcm; // RTCM specific values
9393
SEMP_UBLOX_VALUES ublox; // U-blox specific values
94-
SEMP_UNICORE_VALUES unicore; // Unicore specific values
94+
SEMP_UNICORE_BINARY_VALUES unicoreBinary; // Unicore binary specific values
9595
} SEMP_SCRATCH_PAD;
9696

9797
// Maintain the operating state of one or more parsers processing a raw
@@ -269,9 +269,9 @@ const char * sempRtcmGetStateName(const SEMP_PARSE_STATE *parse);
269269
bool sempUbloxPreamble(SEMP_PARSE_STATE *parse, uint8_t data);
270270
const char * sempUbloxGetStateName(const SEMP_PARSE_STATE *parse);
271271

272-
// Unicore parse routines
273-
bool sempUnicorePreamble(SEMP_PARSE_STATE *parse, uint8_t data);
274-
const char * sempUnicoreGetStateName(const SEMP_PARSE_STATE *parse);
275-
void sempUnicorePrintHeader(SEMP_PARSE_STATE *parse);
272+
// Unicore binary parse routines
273+
bool sempUnicoreBinaryPreamble(SEMP_PARSE_STATE *parse, uint8_t data);
274+
const char * sempUnicoreBinaryGetStateName(const SEMP_PARSE_STATE *parse);
275+
void sempUnicoreBinaryPrintHeader(SEMP_PARSE_STATE *parse);
276276

277277
#endif // __SPARKFUN_EXTENSIBLE_MESSAGE_PARSER_H__

0 commit comments

Comments
 (0)