]> git.gir.st - tmk_keyboard.git/blob - protocol/usb_hid/USB_Host_Shield_2.0/PS3Enums.h
Squashed 'tmk_core/' changes from caca2c0..dc0e46e
[tmk_keyboard.git] / protocol / usb_hid / USB_Host_Shield_2.0 / PS3Enums.h
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
23 /** Size of the output report buffer for the Dualshock and Navigation controllers */
24 #define PS3_REPORT_BUFFER_SIZE 48
25
26 /** Report buffer for all PS3 commands */
27 const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE] PROGMEM = {
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
39 /** Size of the output report buffer for the Move Controller */
40 #define MOVE_REPORT_BUFFER_SIZE 7
41
42 /** Used to set the LEDs on the controllers */
43 const uint8_t PS3_LEDS[] PROGMEM = {
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
58 /**
59 * Buttons on the controllers.
60 * <B>Note:</B> that the location is shifted 9 when it's connected via USB.
61 */
62 const uint32_t PS3_BUTTONS[] PROGMEM = {
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
88 /**
89 * Analog buttons on the controllers.
90 * <B>Note:</B> that the location is shifted 9 when it's connected via USB.
91 */
92 const uint8_t PS3_ANALOG_BUTTONS[] PROGMEM = {
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
113 enum StatusEnum {
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
141 #endif
Imprint / Impressum