beautypg.com

Code examples, Header file & crc-16 function, 8code examples – PNI CompassPoint Prime User Manual

Page 55: 1 header file & crc-16 function

background image

Prime User Manual r08

Page 49

8

Code Examples

The following example files (CommProtocol.h, CommProtocol.cp, Prime.h and Prime.cp)

would be used together for proper communication with a Prime module.

NOTE: The user also needs to create the following: SystemSerPort.h; Processes.h, TickGenerator.h.

8.1

Header File & CRC-16 Function

// type declarations
typedef struct
{

UInt8 pollingMode, flushFilter;

Float32 sensorAcqTime, intervalRespTime;

} __attribute__ ((packed)) AcqParams;

typedef struct
{

Float32 stdDevErr;

Float32 xCoverage;

Float32 yCoverage;

Float32 zCoverage;

Float32 xyzAccelCoverage;

Float32 accelStdDevErr;

} __attribute__ ((packed)) CalScore;

enum
{

// Frame IDs (Commands)

kGetModInfo = 1,

// 1

kModInfoResp,

// 2

kSetDataComponents,

// 3

kGetData,

// 4

kDataResp,

// 5

kSetConfig,

// 6

kGetConfig,

// 7

kConfigResp,

// 8

kSave,

// 9

kStartCal,

// 10

kStopCal,

// 11

kSetParam,

// 12

kGetParam,

// 13

kParamResp,

// 14

kPowerDown,

// 15

kSaveDone,

// 16

kUserCalSampCount,

// 17

kUserCalScore,

// 18

kSetConfigDone,

// 19

kSetParamDone,

// 20

kStartIntervalMode,

// 21