User manual

LPCXpresso Experiment Kit - User’s Guide
Page 120
Copyright 2013 © Embedded Artists AB
div = pow / div;
deg = sum / (div*100);
min = sum - (deg*div*100);
// convert to decimal minutes
min = (min * 100) / 60;
*pDegree = (deg*div*100) + min;
if (div > 10000) {
// normalize minutes to 6 decimal places
*pDegree /= (div / 10000);
}
}
/*****************************************************************************
** Function name: parseUTC
**
** Descriptions: Extracts the UTC time string in hhmmss.sss,
** ignoring the .sss part and stores the result
** as a string in data.utcTime.
**
** parameters: The buffer
** Returned value: None
**
*****************************************************************************/
static void parseUTC(uint8_t **ppBuf)
{
int index = 0;
// parse utc hhmmss.sss
while(**ppBuf != END_OF_MESSAGE) {
if(**ppBuf == '.') {
pointToNextValue(ppBuf);
break; //reached end of the value
}
data.utcTime[index++] = **ppBuf;
if(index == 2 || index == 5) {
//Add divider
data.utcTime[index++] = ':';
}
(*ppBuf)++;
}
data.utcTime[index] = '\0';
}
/*****************************************************************************
** Function name: parseLatitude
**
** Descriptions: Extracts the latitude information and stores
** the result as an integer in data.latitude.
**
** parameters: The buffer
** Returned value: None
**
*****************************************************************************/
static void parseLatitude(uint8_t **ppBuf)
{
int index = 0;
while(**ppBuf != END_OF_MESSAGE) {
if (**ppBuf == DIVIDER) {
(*ppBuf)++; //reached end of the value
break;
}
data.bufLatitude[index++] = **ppBuf;
(*ppBuf)++;
}
convertCordinateToDegree((uint8_t *) &data.bufLatitude, &data.latitude, 8);
}
/*****************************************************************************
** Function name: GPSRetreiveData