USB Host Shield 2.0
Loading...
Searching...
No Matches
controllerEnums.h
Go to the documentation of this file.
1
/* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. All rights reserved.
2
3
This software may be distributed and modified under the terms of the GNU
4
General Public License version 2 (GPL2) as published by the Free Software
5
Foundation and appearing in the file GPL2.TXT included in the packaging of
6
this file. Please note that GPL2 Section 2[b] requires that all works based
7
on this software must also be made publicly available under the terms of
8
the GPL2 ("Copyleft").
9
10
Contact information
11
-------------------
12
13
Kristian Lauszus, TKJ Electronics
14
Web : http://www.tkjelectronics.com
15
e-mail : kristianl@tkjelectronics.com
16
*/
17
18
#ifndef _controllerenums_h
19
#define _controllerenums_h
20
21
#if defined(ESP32)
22
#undef PS
23
#endif
24
31
enum
LEDEnum
{
32
OFF
= 0,
33
#ifndef RBL_NRF51822
34
LED1
= 1,
35
LED2
= 2,
36
LED3
= 3,
37
LED4
= 4,
38
#endif
39
LED5
= 5,
40
LED6
= 6,
41
LED7
= 7,
42
LED8
= 8,
43
LED9
= 9,
44
LED10
= 10,
46
ALL
= 5,
47
};
48
50
enum
ColorsEnum
{
52
Red
= 0xFF0000,
54
Green
= 0xFF00,
56
Blue
= 0xFF,
57
59
Yellow
= 0xFFEB04,
61
Lightblue
= 0xFFFF,
63
Purple
= 0xFF00FF,
64
Purble
= 0xFF00FF,
65
67
White
= 0xFFFFFF,
69
Off
= 0x00,
70
};
71
72
enum
RumbleEnum
{
73
RumbleHigh
= 0x10,
74
RumbleLow
= 0x20,
75
};
76
78
enum
ButtonEnum
{
81
UP
= 0,
82
RIGHT
= 1,
83
DOWN
= 2,
84
LEFT
= 3,
89
TRIANGLE
,
90
CIRCLE
,
91
CROSS
,
92
SQUARE
,
93
94
SELECT
,
95
START
,
96
97
L3
,
98
R3
,
99
100
L1
,
101
R1
,
102
L2
,
103
R2
,
104
105
PS
,
110
MOVE
,
// Covers 12 bits - we only need to read the top 8
111
T
,
// Covers 12 bits - we only need to read the top 8
116
RED
,
117
YELLOW
,
118
GREEN
,
119
ORANGE
,
120
BLUE
,
125
SHARE
,
126
OPTIONS
,
127
TOUCHPAD
,
132
CREATE
,
133
MICROPHONE
,
138
A
,
139
B
,
140
X
,
141
Y
,
142
143
BACK
,
144
// START, // listed under Playstation buttons
145
146
LB
,
147
RB
,
148
LT
,
149
RT
,
150
151
XBOX
,
152
SYNC
,
153
154
BLACK
,
// Available on the original Xbox controller
155
WHITE
,
// Available on the original Xbox controller
160
VIEW
,
161
MENU
,
166
PLUS
,
167
TWO
,
168
ONE
,
169
MINUS
,
170
HOME
,
171
Z
,
172
C
,
173
// B, // listed under Xbox buttons
174
// A, // listed under Xbox buttons
179
L
,
180
R
,
181
ZL
,
182
ZR
,
187
CAPTURE
,
189
};
190
191
inline
constexpr
int8_t
ButtonIndex
(
ButtonEnum
key
) {
192
// using a chained ternary in place of a switch for constexpr on older compilers
193
return
194
(
key
==
UP
||
key
==
RED
) ? 0 :
195
(
key
==
RIGHT
||
key
==
YELLOW
) ? 1 :
196
(
key
==
DOWN
||
key
==
GREEN
) ? 2 :
197
(
key
==
LEFT
||
key
==
ORANGE
) ? 3 :
198
(
key
==
SELECT
||
key
==
SHARE
||
key
==
BACK
||
key
==
VIEW
||
key
==
BLUE
||
key
==
CREATE
||
key
==
CAPTURE
) ? 4 :
199
(
key
==
START
||
key
==
OPTIONS
||
key
==
MENU
||
key
==
PLUS
) ? 5 :
200
(
key
==
L3
||
key
==
TWO
) ? 6 :
201
(
key
==
R3
||
key
==
ONE
) ? 7 :
202
(
key
==
L2
||
key
==
LT
||
key
==
MINUS
||
key
==
BLACK
) ? 8 :
203
(
key
==
R2
||
key
==
RT
||
key
==
HOME
||
key
==
WHITE
) ? 9 :
204
(
key
==
L1
||
key
==
LB
||
key
==
Z
) ? 10 :
205
(
key
==
R1
||
key
==
RB
||
key
==
C
) ? 11 :
206
(
key
==
TRIANGLE
||
key
==
B
) ? 12 :
207
(
key
==
CIRCLE
||
key
==
A
) ? 13 :
208
(
key
==
CROSS
||
key
==
X
) ? 14 :
209
(
key
==
SQUARE
||
key
==
Y
) ? 15 :
210
(
key
==
L
||
key
==
PS
||
key
==
XBOX
) ? 16 :
211
(
key
==
R
||
key
==
MOVE
||
key
==
TOUCHPAD
||
key
==
SYNC
) ? 17 :
212
(
key
==
ZL
||
key
==
T
||
key
==
MICROPHONE
) ? 18 :
213
(
key
==
ZR
) ? 19 :
214
-1;
// not a match
215
}
216
218
enum
AnalogHatEnum
{
220
LeftHatX
= 0,
222
LeftHatY
= 1,
224
RightHatX
= 2,
226
RightHatY
= 3,
227
};
228
233
enum
SensorEnum
{
235
aX
= 50,
aY
= 52,
aZ
= 54,
237
gZ
= 56,
238
gX
,
gY
,
// These are not available on the PS3 controller
239
241
aXmove
= 28,
243
aZmove
= 30,
245
aYmove
= 32,
246
248
gXmove
= 40,
250
gZmove
= 42,
252
gYmove
= 44,
253
255
tempMove
= 46,
256
258
mXmove
= 47,
260
mZmove
= 49,
262
mYmove
= 50,
263
};
264
266
enum
AngleEnum
{
267
Pitch
= 0x01,
268
Roll
= 0x02,
269
};
270
271
#endif
ConfigDescParser
Definition
confdescparser.h:47
SensorEnum
SensorEnum
Definition
controllerEnums.h:233
gY
@ gY
Definition
controllerEnums.h:238
aZmove
@ aZmove
Definition
controllerEnums.h:243
gX
@ gX
Definition
controllerEnums.h:238
gXmove
@ gXmove
Definition
controllerEnums.h:248
mZmove
@ mZmove
Definition
controllerEnums.h:260
aX
@ aX
Definition
controllerEnums.h:235
tempMove
@ tempMove
Definition
controllerEnums.h:255
aZ
@ aZ
Definition
controllerEnums.h:235
aYmove
@ aYmove
Definition
controllerEnums.h:245
gZ
@ gZ
Definition
controllerEnums.h:237
aXmove
@ aXmove
Definition
controllerEnums.h:241
gYmove
@ gYmove
Definition
controllerEnums.h:252
mXmove
@ mXmove
Definition
controllerEnums.h:258
gZmove
@ gZmove
Definition
controllerEnums.h:250
aY
@ aY
Definition
controllerEnums.h:235
mYmove
@ mYmove
Definition
controllerEnums.h:262
ButtonIndex
constexpr int8_t ButtonIndex(ButtonEnum key)
Definition
controllerEnums.h:191
AnalogHatEnum
AnalogHatEnum
Definition
controllerEnums.h:218
LeftHatX
@ LeftHatX
Definition
controllerEnums.h:220
RightHatY
@ RightHatY
Definition
controllerEnums.h:226
RightHatX
@ RightHatX
Definition
controllerEnums.h:224
LeftHatY
@ LeftHatY
Definition
controllerEnums.h:222
LEDEnum
LEDEnum
Definition
controllerEnums.h:31
LED9
@ LED9
Definition
controllerEnums.h:43
LED6
@ LED6
Definition
controllerEnums.h:40
LED7
@ LED7
Definition
controllerEnums.h:41
LED10
@ LED10
Definition
controllerEnums.h:44
LED8
@ LED8
Definition
controllerEnums.h:42
LED3
@ LED3
Definition
controllerEnums.h:36
LED2
@ LED2
Definition
controllerEnums.h:35
OFF
@ OFF
Definition
controllerEnums.h:32
ALL
@ ALL
Definition
controllerEnums.h:46
LED4
@ LED4
Definition
controllerEnums.h:37
LED1
@ LED1
Definition
controllerEnums.h:34
LED5
@ LED5
Definition
controllerEnums.h:39
AngleEnum
AngleEnum
Definition
controllerEnums.h:266
Roll
@ Roll
Definition
controllerEnums.h:268
Pitch
@ Pitch
Definition
controllerEnums.h:267
ButtonEnum
ButtonEnum
Definition
controllerEnums.h:78
L2
@ L2
Definition
controllerEnums.h:102
TWO
@ TWO
Definition
controllerEnums.h:167
START
@ START
Definition
controllerEnums.h:95
SELECT
@ SELECT
Definition
controllerEnums.h:94
R
@ R
Definition
controllerEnums.h:180
PS
@ PS
Definition
controllerEnums.h:105
OPTIONS
@ OPTIONS
Definition
controllerEnums.h:126
ZR
@ ZR
Definition
controllerEnums.h:182
T
@ T
Definition
controllerEnums.h:111
WHITE
@ WHITE
Definition
controllerEnums.h:155
CAPTURE
@ CAPTURE
Definition
controllerEnums.h:187
TRIANGLE
@ TRIANGLE
Definition
controllerEnums.h:89
BLUE
@ BLUE
Definition
controllerEnums.h:120
SHARE
@ SHARE
Definition
controllerEnums.h:125
B
@ B
Definition
controllerEnums.h:139
SQUARE
@ SQUARE
Definition
controllerEnums.h:92
A
@ A
Definition
controllerEnums.h:138
SYNC
@ SYNC
Definition
controllerEnums.h:152
CREATE
@ CREATE
Definition
controllerEnums.h:132
LT
@ LT
Definition
controllerEnums.h:148
MENU
@ MENU
Definition
controllerEnums.h:161
ZL
@ ZL
Definition
controllerEnums.h:181
Y
@ Y
Definition
controllerEnums.h:141
VIEW
@ VIEW
Definition
controllerEnums.h:160
X
@ X
Definition
controllerEnums.h:140
RB
@ RB
Definition
controllerEnums.h:147
TOUCHPAD
@ TOUCHPAD
Definition
controllerEnums.h:127
R2
@ R2
Definition
controllerEnums.h:103
C
@ C
Definition
controllerEnums.h:172
L3
@ L3
Definition
controllerEnums.h:97
ONE
@ ONE
Definition
controllerEnums.h:168
PLUS
@ PLUS
Definition
controllerEnums.h:166
HOME
@ HOME
Definition
controllerEnums.h:170
DOWN
@ DOWN
Definition
controllerEnums.h:83
GREEN
@ GREEN
Definition
controllerEnums.h:118
Z
@ Z
Definition
controllerEnums.h:171
CIRCLE
@ CIRCLE
Definition
controllerEnums.h:90
R3
@ R3
Definition
controllerEnums.h:98
UP
@ UP
Definition
controllerEnums.h:81
BACK
@ BACK
Definition
controllerEnums.h:143
ORANGE
@ ORANGE
Definition
controllerEnums.h:119
XBOX
@ XBOX
Definition
controllerEnums.h:151
CROSS
@ CROSS
Definition
controllerEnums.h:91
LEFT
@ LEFT
Definition
controllerEnums.h:84
MICROPHONE
@ MICROPHONE
Definition
controllerEnums.h:133
L1
@ L1
Definition
controllerEnums.h:100
YELLOW
@ YELLOW
Definition
controllerEnums.h:117
LB
@ LB
Definition
controllerEnums.h:146
RIGHT
@ RIGHT
Definition
controllerEnums.h:82
MOVE
@ MOVE
Definition
controllerEnums.h:110
L
@ L
Definition
controllerEnums.h:179
RT
@ RT
Definition
controllerEnums.h:149
MINUS
@ MINUS
Definition
controllerEnums.h:169
BLACK
@ BLACK
Definition
controllerEnums.h:154
RED
@ RED
Definition
controllerEnums.h:116
R1
@ R1
Definition
controllerEnums.h:101
ColorsEnum
ColorsEnum
Definition
controllerEnums.h:50
Purple
@ Purple
Definition
controllerEnums.h:63
Purble
@ Purble
Definition
controllerEnums.h:64
Lightblue
@ Lightblue
Definition
controllerEnums.h:61
White
@ White
Definition
controllerEnums.h:67
Yellow
@ Yellow
Definition
controllerEnums.h:59
Green
@ Green
Definition
controllerEnums.h:54
Red
@ Red
Definition
controllerEnums.h:52
Off
@ Off
Definition
controllerEnums.h:69
Blue
@ Blue
Definition
controllerEnums.h:56
RumbleEnum
RumbleEnum
Definition
controllerEnums.h:72
RumbleLow
@ RumbleLow
Definition
controllerEnums.h:74
RumbleHigh
@ RumbleHigh
Definition
controllerEnums.h:73
Generated by
1.9.8