beautypg.com

PNI CompassPoint Prime User Manual

Page 66

background image

PNI Sensor Corporation

DOC# 1014177 r08

Prime User Manual

– July 2011

Page 60

// Message is a function that displays a C

// formatted string (similar to printf)

Message("Received %u data elements instead of

the %u requested\r\n", (UInt16)count,

(UInt16)kDataCount);

return;

}

// loop through and collect the elements

while(count)

{

// The elements are received as {type (ie.

// kHeading), data}

switch(data[pntr++])

// read the type and

// go to the first

// byte of the data

{

// Only handling the 4 elements we are

// looking for

case CommProtocol::kHeading:

{

// Move(source, destination, size

// (bytes)). Move copies the

// specified number of bytes from

// the source pointer to the

// destination pointer.

// Store the heading.

Move(&(data[pntr]), &heading,

sizeof(heading));

// increase the pointer to point

// to the next data element type

pntr += sizeof(heading);

break;

}


case CommProtocol::kPAngle:

{

// Move(source, destination, size

// (bytes)). Move copies the

// specified number of bytes from

// the source pointer to the

// destination pointer.

// Store the pitch.

Move(&(data[pntr]), &pitch,

sizeof(pitch));

// increase the pointer to point

// to the next data element type

pntr += sizeof(pitch);

break;

}


case CommProtocol::kRAngle: