beautypg.com

PNI TCM 5 User Manual

Page 56

background image

PNI Sensor Corporation

Doc #1007537 r12

TCM3 & TCM5 User Manual- Sept 2011

Page 56

4.4.2.4 TCM5.cp File (For TCM3, TCM5 & TCM5L Modules):

#include "TCM.h"

#include "TickGenerator.h"

const

UInt8 kDataCount =

4

;

// We will be requesting 4 componets (Heading, pitch, roll,

temperature)

//

// This object polls the TCM unit once a second for heading, pitch, roll and temperature.

//

TCM::TCM(SerPort * serPort)

: Process(

"TCM"

)

{

// Let the CommProtocol know this object will handle any serial data returned by the unit

mComm =

new

CommProtocol(

this

, serPort);

mTime =

0

;

mStep =

1

;

}

TCM::~TCM()

{

}

//

// Called by the CommProtocol object when a frame is completely received

//

void

TCM::HandleComm(UInt8 frameType,

void

* dataPtr, UInt16 dataLen)

{

UInt8 * data = (UInt8 *)dataPtr;

switch

(frameType)

{

case

CommProtocol::kDataResp:

{

// Parse the data response

UInt8 count = data[

0

];

// The number of data elements returned

UInt32 pntr =

1

;

// Used to retrieve the returned elements

// The data elements we requested

Float32 heading, pitch, roll, temperature;

if

(count != kDataCount)

{

// Message is a function that displays a C formatted string (similar to

printf)

This manual is related to the following products: