blob: 14c4602a471538cdd0d35e5335330d8182154c21 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001/*************************************************************
2 * NOTICE
3 *
4 * These are the only externally exposed functions to the
5 * NetworkCommunication library
6 *
7 * This is an implementation of FRC Spec for Comm Protocol
8 * Revision 4.5, June 30, 2008
9 *
10 * Copyright (c) National Instruments 2008. All Rights Reserved.
11 *
12 *************************************************************/
13
14#ifndef __FRC_COMM_H__
15#define __FRC_COMM_H__
16
17#include <stdint.h>
18
19typedef uint64_t UINT64;
20typedef uint32_t UINT32;
21typedef uint16_t UINT16;
22typedef uint8_t UINT8;
23typedef int8_t INT8;
24
25struct FRCCommonControlData{
26 UINT16 packetIndex;
27 union {
28 UINT8 control;
brians6591d582013-03-03 05:31:53 +000029 // The order of the bits has to be flipped on little-endian machines (aka
30 // everything other than the cRIO that we build for) in order for it to
31 // work. Upstream WPILib does this based off of a different macro.
32#ifndef __VXWORKS__
brians343bc112013-02-10 01:53:46 +000033 struct {
brians6591d582013-03-03 05:31:53 +000034 UINT8 checkVersions :1;
35 UINT8 test :1;
brians343bc112013-02-10 01:53:46 +000036 UINT8 resync : 1;
37 UINT8 fmsAttached:1;
38 UINT8 autonomous : 1;
39 UINT8 enabled : 1;
40 UINT8 notEStop : 1;
41 UINT8 reset : 1;
42 };
brians6591d582013-03-03 05:31:53 +000043#else
44 struct {
45 UINT8 reset : 1;
46 UINT8 notEStop : 1;
47 UINT8 enabled : 1;
48 UINT8 autonomous : 1;
49 UINT8 fmsAttached:1;
50 UINT8 resync : 1;
51 UINT8 test :1;
52 UINT8 checkVersions :1;
53 };
54#endif
brians343bc112013-02-10 01:53:46 +000055 };
56 UINT8 dsDigitalIn;
57 UINT16 teamID;
58
59 char dsID_Alliance;
60 char dsID_Position;
61
62 union {
63 INT8 stick0Axes[6];
64 struct {
65 INT8 stick0Axis1;
66 INT8 stick0Axis2;
67 INT8 stick0Axis3;
68 INT8 stick0Axis4;
69 INT8 stick0Axis5;
70 INT8 stick0Axis6;
71 };
72 };
73 UINT16 stick0Buttons; // Left-most 4 bits are unused
74
75 union {
76 INT8 stick1Axes[6];
77 struct {
78 INT8 stick1Axis1;
79 INT8 stick1Axis2;
80 INT8 stick1Axis3;
81 INT8 stick1Axis4;
82 INT8 stick1Axis5;
83 INT8 stick1Axis6;
84 };
85 };
86 UINT16 stick1Buttons; // Left-most 4 bits are unused
87
88 union {
89 INT8 stick2Axes[6];
90 struct {
91 INT8 stick2Axis1;
92 INT8 stick2Axis2;
93 INT8 stick2Axis3;
94 INT8 stick2Axis4;
95 INT8 stick2Axis5;
96 INT8 stick2Axis6;
97 };
98 };
99 UINT16 stick2Buttons; // Left-most 4 bits are unused
100
101 union {
102 INT8 stick3Axes[6];
103 struct {
104 INT8 stick3Axis1;
105 INT8 stick3Axis2;
106 INT8 stick3Axis3;
107 INT8 stick3Axis4;
108 INT8 stick3Axis5;
109 INT8 stick3Axis6;
110 };
111 };
112 UINT16 stick3Buttons; // Left-most 4 bits are unused
113
114 //Analog inputs are 10 bit right-justified
115 UINT16 analog1;
116 UINT16 analog2;
117 UINT16 analog3;
118 UINT16 analog4;
119
120 UINT64 cRIOChecksum;
121 UINT32 FPGAChecksum0;
122 UINT32 FPGAChecksum1;
123 UINT32 FPGAChecksum2;
124 UINT32 FPGAChecksum3;
125
126 char versionData[8];
127};
128
129
130#endif