beautypg.com

PNI SeaTRAX User Manual

Page 65

background image

PNI Sensor Corporation

DOC#1018154 r02

SeaTRAX User Manual

Page 60

kCoeffCopySet = 18,

// 18 - type UInt32

kAccelCoeffCopySet,

// 19 - type UInt32


// Mounting Reference IDs

kMountedStandard = 1, // 1

kMountedXUp,

// 2

kMountedYUp,

// 3

kMountedStdPlus90,

// 4

kMountedStdPlus180,

// 5

kMountedStdPlus270,

// 6

kMountedZDown

// 7

kMountedXUpPlus90

// 8

kMountedXUpPlus180

// 9

kMountedXUpPlus270

// 10

kMountedYUpPlus90

// 11

kMountedYUpPlus180

// 12

kMountedYUpPlus270

// 13

kMountedZDownPlus90

// 14

kMountedZDownPlus180

// 15

kMountedZDownPlus270

// 16



// Result IDs

kErrNone = 0,

// 0

kErrSave,

// 1

};


// function to calculate CRC-16
UInt16 CRC(void * data, UInt32 len)
{

UInt8 * dataPtr = (UInt8 *)data;

UInt32 index = 0;

// Update the CRC for transmitted and received data using

// the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1).

UInt16 crc = 0;

while(len--)

{

crc = (unsigned char)(crc >> 8) | (crc << 8);

crc ^= dataPtr[index++];

crc ^= (unsigned char)(crc & 0xff) >> 4;

crc ^= (crc << 8) << 4;

crc ^= ((crc & 0xff) << 4) << 1;

}

return crc;

}