USB Host Shield 2.0
Loading...
Searching...
No Matches
PS3Enums.h
Go to the documentation of this file.
1/* Copyright (C) 2012 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 _ps3enums_h
19#define _ps3enums_h
20
21#include "controllerEnums.h"
22
24#define PS3_REPORT_BUFFER_SIZE 48
25
28 0x00, 0x00, 0x00, 0x00, 0x00,
29 0x00, 0x00, 0x00, 0x00, 0x00,
30 0xff, 0x27, 0x10, 0x00, 0x32,
31 0xff, 0x27, 0x10, 0x00, 0x32,
32 0xff, 0x27, 0x10, 0x00, 0x32,
33 0xff, 0x27, 0x10, 0x00, 0x32,
34 0x00, 0x00, 0x00, 0x00, 0x00,
35 0x00, 0x00, 0x00, 0x00, 0x00,
36 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
37};
38
40#define MOVE_REPORT_BUFFER_SIZE 7
41
44 0x00, // OFF
45 0x01, // LED1
46 0x02, // LED2
47 0x04, // LED3
48 0x08, // LED4
49
50 0x09, // LED5
51 0x0A, // LED6
52 0x0C, // LED7
53 0x0D, // LED8
54 0x0E, // LED9
55 0x0F, // LED10
56};
57
63 0x10, // UP
64 0x20, // RIGHT
65 0x40, // DOWN
66 0x80, // LEFT
67
68 0x01, // SELECT
69 0x08, // START
70 0x02, // L3
71 0x04, // R3
72
73 0x0100, // L2
74 0x0200, // R2
75 0x0400, // L1
76 0x0800, // R1
77
78 0x1000, // TRIANGLE
79 0x2000, // CIRCLE
80 0x4000, // CROSS
81 0x8000, // SQUARE
82
83 0x010000, // PS
84 0x080000, // MOVE - covers 12 bits - we only need to read the top 8
85 0x100000, // T - covers 12 bits - we only need to read the top 8
86};
87
93 23, // UP_ANALOG
94 24, // RIGHT_ANALOG
95 25, // DOWN_ANALOG
96 26, // LEFT_ANALOG
97 0, 0, 0, 0, // Skip SELECT, L3, R3 and START
98
99 27, // L2_ANALOG
100 28, // R2_ANALOG
101 29, // L1_ANALOG
102 30, // R1_ANALOG
103 31, // TRIANGLE_ANALOG
104 32, // CIRCLE_ANALOG
105 33, // CROSS_ANALOG
106 34, // SQUARE_ANALOG
107 0, 0, // Skip PS and MOVE
108
109 // Playstation Move Controller
110 15, // T_ANALOG - Both at byte 14 (last reading) and byte 15 (current reading)
111};
112
114 // Note that the location is shifted 9 when it's connected via USB
115 // Byte location | bit location
116 Plugged = (38 << 8) | 0x02,
117 Unplugged = (38 << 8) | 0x03,
118
119 Charging = (39 << 8) | 0xEE,
120 NotCharging = (39 << 8) | 0xF1,
121 Shutdown = (39 << 8) | 0x01,
122 Dying = (39 << 8) | 0x02,
123 Low = (39 << 8) | 0x03,
124 High = (39 << 8) | 0x04,
125 Full = (39 << 8) | 0x05,
126
127 MoveCharging = (21 << 8) | 0xEE,
128 MoveNotCharging = (21 << 8) | 0xF1,
129 MoveShutdown = (21 << 8) | 0x01,
130 MoveDying = (21 << 8) | 0x02,
131 MoveLow = (21 << 8) | 0x03,
132 MoveHigh = (21 << 8) | 0x04,
133 MoveFull = (21 << 8) | 0x05,
134
135 CableRumble = (40 << 8) | 0x10, // Operating by USB and rumble is turned on
136 Cable = (40 << 8) | 0x12, // Operating by USB and rumble is turned off
137 BluetoothRumble = (40 << 8) | 0x14, // Operating by Bluetooth and rumble is turned on
138 Bluetooth = (40 << 8) | 0x16, // Operating by Bluetooth and rumble is turned off
139};
140
142 const int8_t index = ButtonIndex(b);
143 if ((uint8_t) index >= (sizeof(PS3_BUTTONS) / sizeof(PS3_BUTTONS[0]))) return -1;
144 return index;
145}
146
147#endif
#define PS3_REPORT_BUFFER_SIZE
Definition PS3Enums.h:24
int8_t getButtonIndexPS3(ButtonEnum b)
Definition PS3Enums.h:141
const uint8_t PS3_LEDS[]
Definition PS3Enums.h:43
const uint32_t PS3_BUTTONS[]
Definition PS3Enums.h:62
const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE]
Definition PS3Enums.h:27
const uint8_t PS3_ANALOG_BUTTONS[]
Definition PS3Enums.h:92
StatusEnum
Definition PS3Enums.h:113
@ MoveCharging
Definition PS3Enums.h:127
@ Cable
Definition PS3Enums.h:136
@ High
Definition PS3Enums.h:124
@ BluetoothRumble
Definition PS3Enums.h:137
@ MoveLow
Definition PS3Enums.h:131
@ Charging
Definition PS3Enums.h:119
@ CableRumble
Definition PS3Enums.h:135
@ Bluetooth
Definition PS3Enums.h:138
@ MoveDying
Definition PS3Enums.h:130
@ MoveHigh
Definition PS3Enums.h:132
@ Low
Definition PS3Enums.h:123
@ Shutdown
Definition PS3Enums.h:121
@ Full
Definition PS3Enums.h:125
@ MoveShutdown
Definition PS3Enums.h:129
@ Dying
Definition PS3Enums.h:122
@ MoveNotCharging
Definition PS3Enums.h:128
@ NotCharging
Definition PS3Enums.h:120
@ MoveFull
Definition PS3Enums.h:133
@ Unplugged
Definition PS3Enums.h:117
@ Plugged
Definition PS3Enums.h:116
constexpr int8_t ButtonIndex(ButtonEnum key)
ButtonEnum