blob: 3d2f4c0e34da8a9c800aa64122948e287dc8d314 [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;
29 struct {
30 /*the order of these are flipped on the fit pc side to make it work*/
31 UINT8 fpgaChkSum :1;
32 UINT8 cRIOChkSum :1;
33 UINT8 resync : 1;
34 UINT8 fmsAttached:1;
35 UINT8 autonomous : 1;
36 UINT8 enabled : 1;
37 UINT8 notEStop : 1;
38 UINT8 reset : 1;
39 };
40 };
41 UINT8 dsDigitalIn;
42 UINT16 teamID;
43
44 char dsID_Alliance;
45 char dsID_Position;
46
47 union {
48 INT8 stick0Axes[6];
49 struct {
50 INT8 stick0Axis1;
51 INT8 stick0Axis2;
52 INT8 stick0Axis3;
53 INT8 stick0Axis4;
54 INT8 stick0Axis5;
55 INT8 stick0Axis6;
56 };
57 };
58 UINT16 stick0Buttons; // Left-most 4 bits are unused
59
60 union {
61 INT8 stick1Axes[6];
62 struct {
63 INT8 stick1Axis1;
64 INT8 stick1Axis2;
65 INT8 stick1Axis3;
66 INT8 stick1Axis4;
67 INT8 stick1Axis5;
68 INT8 stick1Axis6;
69 };
70 };
71 UINT16 stick1Buttons; // Left-most 4 bits are unused
72
73 union {
74 INT8 stick2Axes[6];
75 struct {
76 INT8 stick2Axis1;
77 INT8 stick2Axis2;
78 INT8 stick2Axis3;
79 INT8 stick2Axis4;
80 INT8 stick2Axis5;
81 INT8 stick2Axis6;
82 };
83 };
84 UINT16 stick2Buttons; // Left-most 4 bits are unused
85
86 union {
87 INT8 stick3Axes[6];
88 struct {
89 INT8 stick3Axis1;
90 INT8 stick3Axis2;
91 INT8 stick3Axis3;
92 INT8 stick3Axis4;
93 INT8 stick3Axis5;
94 INT8 stick3Axis6;
95 };
96 };
97 UINT16 stick3Buttons; // Left-most 4 bits are unused
98
99 //Analog inputs are 10 bit right-justified
100 UINT16 analog1;
101 UINT16 analog2;
102 UINT16 analog3;
103 UINT16 analog4;
104
105 UINT64 cRIOChecksum;
106 UINT32 FPGAChecksum0;
107 UINT32 FPGAChecksum1;
108 UINT32 FPGAChecksum2;
109 UINT32 FPGAChecksum3;
110
111 char versionData[8];
112};
113
114
115#endif