USB Host Shield 2.0
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
Purble
@ Purble
Definition:
controllerEnums.h:64
R3
@ R3
Definition:
controllerEnums.h:98
LED5
@ LED5
Definition:
controllerEnums.h:39
LT
@ LT
Definition:
controllerEnums.h:148
gYmove
@ gYmove
Definition:
controllerEnums.h:252
LED8
@ LED8
Definition:
controllerEnums.h:42
gX
@ gX
Definition:
controllerEnums.h:238
SQUARE
@ SQUARE
Definition:
controllerEnums.h:92
SHARE
@ SHARE
Definition:
controllerEnums.h:125
LED1
@ LED1
Definition:
controllerEnums.h:34
Yellow
@ Yellow
Definition:
controllerEnums.h:59
aZ
@ aZ
Definition:
controllerEnums.h:235
aYmove
@ aYmove
Definition:
controllerEnums.h:245
mZmove
@ mZmove
Definition:
controllerEnums.h:260
BLUE
@ BLUE
Definition:
controllerEnums.h:120
MENU
@ MENU
Definition:
controllerEnums.h:161
ButtonIndex
constexpr int8_t ButtonIndex(ButtonEnum key)
Definition:
controllerEnums.h:191
SensorEnum
SensorEnum
Definition:
controllerEnums.h:233
LED10
@ LED10
Definition:
controllerEnums.h:44
CROSS
@ CROSS
Definition:
controllerEnums.h:91
Y
@ Y
Definition:
controllerEnums.h:141
WHITE
@ WHITE
Definition:
controllerEnums.h:155
CAPTURE
@ CAPTURE
Definition:
controllerEnums.h:187
X
@ X
Definition:
controllerEnums.h:140
SYNC
@ SYNC
Definition:
controllerEnums.h:152
gZmove
@ gZmove
Definition:
controllerEnums.h:250
AngleEnum
AngleEnum
Definition:
controllerEnums.h:266
aXmove
@ aXmove
Definition:
controllerEnums.h:241
TRIANGLE
@ TRIANGLE
Definition:
controllerEnums.h:89
BLACK
@ BLACK
Definition:
controllerEnums.h:154
BACK
@ BACK
Definition:
controllerEnums.h:143
UP
@ UP
Definition:
controllerEnums.h:81
aY
@ aY
Definition:
controllerEnums.h:235
A
@ A
Definition:
controllerEnums.h:138
mXmove
@ mXmove
Definition:
controllerEnums.h:258
MICROPHONE
@ MICROPHONE
Definition:
controllerEnums.h:133
R1
@ R1
Definition:
controllerEnums.h:101
TWO
@ TWO
Definition:
controllerEnums.h:167
RIGHT
@ RIGHT
Definition:
controllerEnums.h:82
ORANGE
@ ORANGE
Definition:
controllerEnums.h:119
B
@ B
Definition:
controllerEnums.h:139
LEDEnum
LEDEnum
Definition:
controllerEnums.h:31
LB
@ LB
Definition:
controllerEnums.h:146
RT
@ RT
Definition:
controllerEnums.h:149
ONE
@ ONE
Definition:
controllerEnums.h:168
DOWN
@ DOWN
Definition:
controllerEnums.h:83
Pitch
@ Pitch
Definition:
controllerEnums.h:267
MOVE
@ MOVE
Definition:
controllerEnums.h:110
gXmove
@ gXmove
Definition:
controllerEnums.h:248
LED2
@ LED2
Definition:
controllerEnums.h:35
RightHatY
@ RightHatY
Definition:
controllerEnums.h:226
ALL
@ ALL
Definition:
controllerEnums.h:46
RB
@ RB
Definition:
controllerEnums.h:147
RumbleEnum
RumbleEnum
Definition:
controllerEnums.h:72
LED9
@ LED9
Definition:
controllerEnums.h:43
YELLOW
@ YELLOW
Definition:
controllerEnums.h:117
GREEN
@ GREEN
Definition:
controllerEnums.h:118
L2
@ L2
Definition:
controllerEnums.h:102
LED4
@ LED4
Definition:
controllerEnums.h:37
aZmove
@ aZmove
Definition:
controllerEnums.h:243
Roll
@ Roll
Definition:
controllerEnums.h:268
SELECT
@ SELECT
Definition:
controllerEnums.h:94
ZR
@ ZR
Definition:
controllerEnums.h:182
gZ
@ gZ
Definition:
controllerEnums.h:237
L
@ L
Definition:
controllerEnums.h:179
T
@ T
Definition:
controllerEnums.h:111
Purple
@ Purple
Definition:
controllerEnums.h:63
White
@ White
Definition:
controllerEnums.h:67
LED6
@ LED6
Definition:
controllerEnums.h:40
Green
@ Green
Definition:
controllerEnums.h:54
PLUS
@ PLUS
Definition:
controllerEnums.h:166
XBOX
@ XBOX
Definition:
controllerEnums.h:151
tempMove
@ tempMove
Definition:
controllerEnums.h:255
CREATE
@ CREATE
Definition:
controllerEnums.h:132
RED
@ RED
Definition:
controllerEnums.h:116
ColorsEnum
ColorsEnum
Definition:
controllerEnums.h:50
OFF
@ OFF
Definition:
controllerEnums.h:32
Blue
@ Blue
Definition:
controllerEnums.h:56
L1
@ L1
Definition:
controllerEnums.h:100
Z
@ Z
Definition:
controllerEnums.h:171
C
@ C
Definition:
controllerEnums.h:172
VIEW
@ VIEW
Definition:
controllerEnums.h:160
CIRCLE
@ CIRCLE
Definition:
controllerEnums.h:90
TOUCHPAD
@ TOUCHPAD
Definition:
controllerEnums.h:127
LED7
@ LED7
Definition:
controllerEnums.h:41
R
@ R
Definition:
controllerEnums.h:180
RumbleHigh
@ RumbleHigh
Definition:
controllerEnums.h:73
R2
@ R2
Definition:
controllerEnums.h:103
LeftHatX
@ LeftHatX
Definition:
controllerEnums.h:220
L3
@ L3
Definition:
controllerEnums.h:97
HOME
@ HOME
Definition:
controllerEnums.h:170
Off
@ Off
Definition:
controllerEnums.h:69
aX
@ aX
Definition:
controllerEnums.h:235
MINUS
@ MINUS
Definition:
controllerEnums.h:169
PS
@ PS
Definition:
controllerEnums.h:105
LED3
@ LED3
Definition:
controllerEnums.h:36
ZL
@ ZL
Definition:
controllerEnums.h:181
Red
@ Red
Definition:
controllerEnums.h:52
Lightblue
@ Lightblue
Definition:
controllerEnums.h:61
ButtonEnum
ButtonEnum
Definition:
controllerEnums.h:78
LEFT
@ LEFT
Definition:
controllerEnums.h:84
RumbleLow
@ RumbleLow
Definition:
controllerEnums.h:74
AnalogHatEnum
AnalogHatEnum
Definition:
controllerEnums.h:218
LeftHatY
@ LeftHatY
Definition:
controllerEnums.h:222
gY
@ gY
Definition:
controllerEnums.h:238
RightHatX
@ RightHatX
Definition:
controllerEnums.h:224
mYmove
@ mYmove
Definition:
controllerEnums.h:262
OPTIONS
@ OPTIONS
Definition:
controllerEnums.h:126
START
@ START
Definition:
controllerEnums.h:95
Generated by
1.8.17