beautypg.com

PNI CompassPoint Prime User Manual

Page 68

background image

PNI Sensor Corporation

DOC# 1014177 r08

Prime User Manual

– July 2011

Page 62

break;

}


default:

{

// Message is a function that displays a formatted

// string (similar to printf)

Message("Unknown frame %02X received\r\n",

(UInt16)frameType);

break;

}

}

}

//
// Have the CommProtocol build and send the frame to the unit.
//
void Prime::SendComm(UInt8 frameType, void * dataPtr, UInt16 dataLen)
{

if(mComm) mComm->SendData(frameType, dataPtr, dataLen);

// Ticks is a timer function. 1 tick = 10msec.

mResponseTime = Ticks() + 300;

// Expect a response within

// 3 seconds

}

// This is called each time this process gets a turn to execute.
//
void Prime::Control()
{

switch(mStep)

{

case 1:

{

// the compents we are requesting, preceded by the

// number of...

UInt8 pkt[kDataCount + 1];

// ...components being requested

pkt[0] = kDataCount;

pkt[1] = CommProtocol::kHeading;

pkt[2] = CommProtocol::kPAngle;

pkt[3] = CommProtocol::kRAngle;

SendComm(CommProtocol::kSetDataComponents,

pkt, kDataCount + 1);


// Ticks is a timer function. 1 tick = 10msec.

mTime = Ticks() + 100; // Taking a sample in 1s.

mStep++;

// go to next step of process

break;

}


case 2:

{