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
// L1, // listed under Playstation buttons
147
// R1, // listed under Playstation buttons
148
// L2, // listed under Playstation buttons
149
// R2, // listed under Playstation buttons
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
,
184
};
185
186
inline
constexpr int8_t
ButtonIndex
(
ButtonEnum
key) {
187
// using a chained ternary in place of a switch for constexpr on older compilers
188
return
189
(key ==
UP
|| key ==
RED
) ? 0 :
190
(key ==
RIGHT
|| key ==
YELLOW
) ? 1 :
191
(key ==
DOWN
|| key ==
GREEN
) ? 2 :
192
(key ==
LEFT
|| key ==
ORANGE
) ? 3 :
193
(key ==
SELECT
|| key ==
SHARE
|| key ==
BACK
|| key ==
VIEW
|| key ==
BLUE
|| key ==
CREATE
) ? 4 :
194
(key ==
START
|| key ==
OPTIONS
|| key ==
MENU
|| key ==
PLUS
) ? 5 :
195
(key ==
L3
|| key ==
TWO
) ? 6 :
196
(key ==
R3
|| key ==
ONE
) ? 7 :
197
(key ==
L2
|| key ==
MINUS
|| key ==
BLACK
) ? 8 :
198
(key ==
R2
|| key ==
HOME
|| key ==
WHITE
) ? 9 :
199
(key ==
L1
|| key ==
Z
) ? 10 :
200
(key ==
R1
|| key ==
C
) ? 11 :
201
(key ==
TRIANGLE
|| key ==
B
) ? 12 :
202
(key ==
CIRCLE
|| key ==
A
) ? 13 :
203
(key ==
CROSS
|| key ==
X
) ? 14 :
204
(key ==
SQUARE
|| key ==
Y
) ? 15 :
205
(key ==
L
|| key ==
PS
|| key ==
XBOX
) ? 16 :
206
(key ==
R
|| key ==
MOVE
|| key ==
TOUCHPAD
|| key ==
SYNC
) ? 17 :
207
(key ==
ZL
|| key ==
T
|| key ==
MICROPHONE
) ? 18 :
208
(key ==
ZR
) ? 19 :
209
-1;
// not a match
210
}
211
213
enum
AnalogHatEnum
{
215
LeftHatX
= 0,
217
LeftHatY
= 1,
219
RightHatX
= 2,
221
RightHatY
= 3,
222
};
223
228
enum
SensorEnum
{
230
aX
= 50,
aY
= 52,
aZ
= 54,
232
gZ
= 56,
233
gX
,
gY
,
// These are not available on the PS3 controller
234
236
aXmove
= 28,
238
aZmove
= 30,
240
aYmove
= 32,
241
243
gXmove
= 40,
245
gZmove
= 42,
247
gYmove
= 44,
248
250
tempMove
= 46,
251
253
mXmove
= 47,
255
mZmove
= 49,
257
mYmove
= 50,
258
};
259
261
enum
AngleEnum
{
262
Pitch
= 0x01,
263
Roll
= 0x02,
264
};
265
266
#endif
Purble
@ Purble
Definition:
controllerEnums.h:64
R3
@ R3
Definition:
controllerEnums.h:98
LED5
@ LED5
Definition:
controllerEnums.h:39
gYmove
@ gYmove
Definition:
controllerEnums.h:247
LED8
@ LED8
Definition:
controllerEnums.h:42
gX
@ gX
Definition:
controllerEnums.h:233
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:230
aYmove
@ aYmove
Definition:
controllerEnums.h:240
mZmove
@ mZmove
Definition:
controllerEnums.h:255
BLUE
@ BLUE
Definition:
controllerEnums.h:120
MENU
@ MENU
Definition:
controllerEnums.h:161
ButtonIndex
constexpr int8_t ButtonIndex(ButtonEnum key)
Definition:
controllerEnums.h:186
SensorEnum
SensorEnum
Definition:
controllerEnums.h:228
LED10
@ LED10
Definition:
controllerEnums.h:44
CROSS
@ CROSS
Definition:
controllerEnums.h:91
Y
@ Y
Definition:
controllerEnums.h:141
WHITE
@ WHITE
Definition:
controllerEnums.h:155
X
@ X
Definition:
controllerEnums.h:140
SYNC
@ SYNC
Definition:
controllerEnums.h:152
gZmove
@ gZmove
Definition:
controllerEnums.h:245
AngleEnum
AngleEnum
Definition:
controllerEnums.h:261
aXmove
@ aXmove
Definition:
controllerEnums.h:236
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:230
A
@ A
Definition:
controllerEnums.h:138
mXmove
@ mXmove
Definition:
controllerEnums.h:253
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
ONE
@ ONE
Definition:
controllerEnums.h:168
DOWN
@ DOWN
Definition:
controllerEnums.h:83
Pitch
@ Pitch
Definition:
controllerEnums.h:262
MOVE
@ MOVE
Definition:
controllerEnums.h:110
gXmove
@ gXmove
Definition:
controllerEnums.h:243
LED2
@ LED2
Definition:
controllerEnums.h:35
RightHatY
@ RightHatY
Definition:
controllerEnums.h:221
ALL
@ ALL
Definition:
controllerEnums.h:46
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:238
Roll
@ Roll
Definition:
controllerEnums.h:263
SELECT
@ SELECT
Definition:
controllerEnums.h:94
ZR
@ ZR
Definition:
controllerEnums.h:182
gZ
@ gZ
Definition:
controllerEnums.h:232
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:250
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:215
L3
@ L3
Definition:
controllerEnums.h:97
HOME
@ HOME
Definition:
controllerEnums.h:170
Off
@ Off
Definition:
controllerEnums.h:69
aX
@ aX
Definition:
controllerEnums.h:230
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:213
LeftHatY
@ LeftHatY
Definition:
controllerEnums.h:217
gY
@ gY
Definition:
controllerEnums.h:233
RightHatX
@ RightHatX
Definition:
controllerEnums.h:219
mYmove
@ mYmove
Definition:
controllerEnums.h:257
OPTIONS
@ OPTIONS
Definition:
controllerEnums.h:126
START
@ START
Definition:
controllerEnums.h:95
Generated by
1.8.17