beautypg.com

PNI TCM 5 User Manual

Page 48

background image

PNI Sensor Corporation

Doc #1007537 r12

TCM3 & TCM5 User Manual- Sept 2011

Page 48

// Frame IDs (Commands)

kGetModInfo =

1

,

// 1

kModInfoResp,

// 2

kSetDataComponents,

// 3

kGetData,

// 4

kDataResp,

// 5

// Data Component IDs

kHeading = 5,

// 5 - type Float32

kTemperature = 7,

// 7 - type Float32

kPCalibrated = 21,

// 21 - type Float32

kRCalibrated,

// 22 - type Float32

kIZCalibrated,

// 23 - type Float32

kPAngle,

// 24 - type Float32

kRAngle,

// 25 - type Float32

};

enum

{

kBufferSize =

512

,

// maximum size of our input buffer

kPacketMinSize =

5

// minimum size of a serial packet

};

// SerPort is a serial communication object abstracting the hardware implementation

CommProtocol(CommHandler * handler =

NULL

, SerPort * serPort =

NULL

);

void

Init(UInt32 baud =

38400

);

void

SendData(UInt8 frame,

void

* dataPtr =

NULL

, UInt32 len =

0

);

void

SetBaud(UInt32 baud);

protected

:

CommHandler * mHandler;

SerPort * mSerialPort;

UInt8 mOutData[kBufferSize], mInData[kBufferSize];

UInt16 mExpectedLen;

UInt32 mOutLen, mOldInLen, mTime, mStep;

UInt16 CRC(

void

* data, UInt32 len);

void

Control();

};

This manual is related to the following products: