USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 const uint8_t PS3_REPORT_BUFFER[] PROGMEM = {
25  0x00, 0x00, 0x00, 0x00, 0x00,
26  0x00, 0x00, 0x00, 0x00, 0x00,
27  0xff, 0x27, 0x10, 0x00, 0x32,
28  0xff, 0x27, 0x10, 0x00, 0x32,
29  0xff, 0x27, 0x10, 0x00, 0x32,
30  0xff, 0x27, 0x10, 0x00, 0x32,
31  0x00, 0x00, 0x00, 0x00, 0x00,
32  0x00, 0x00, 0x00, 0x00, 0x00,
33  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
34 };
35 
37 #define PS3_REPORT_BUFFER_SIZE 48
38 
40 #define MOVE_REPORT_BUFFER_SIZE 7
41 
43 const uint8_t LEDS[] PROGMEM = {
44  0x01, // LED1
45  0x02, // LED2
46  0x04, // LED3
47  0x08, // LED4
48 
49  0x09, // LED5
50  0x0A, // LED6
51  0x0C, // LED7
52  0x0D, // LED8
53  0x0E, // LED9
54  0x0F // LED10
55 };
56 
62 const uint32_t 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 
93 const uint8_t ANALOGBUTTONS[] PROGMEM = {
94  23, // UP_ANALOG
95  24, // RIGHT_ANALOG
96  25, // DOWN_ANALOG
97  26, // LEFT_ANALOG
98  0, 0, 0, 0, // Skip SELECT, L3, R3 and START
99 
100  27, // L2_ANALOG
101  28, // R2_ANALOG
102  29, // L1_ANALOG
103  30, // R1_ANALOG
104  31, // TRIANGLE_ANALOG
105  32, // CIRCLE_ANALOG
106  33, // CROSS_ANALOG
107  34, // SQUARE_ANALOG
108  0, 0, // Skip PS and MOVE
109 
110  // Playstation Move Controller
111  15 // T_ANALOG - Both at byte 14 (last reading) and byte 15 (current reading)
112 };
113 
115 enum Colors {
117  Red = 0xFF0000,
119  Green = 0xFF00,
121  Blue = 0xFF,
122 
124  Yellow = 0xFFEB04,
126  Lightblue = 0xFFFF,
128  Purble = 0xFF00FF,
129 
131  White = 0xFFFFFF,
133  Off = 0x00,
134 };
135 
141 enum Sensor {
143  aX = 50,
145  aY = 52,
147  aZ = 54,
149  gZ = 56,
150 
152  aXmove = 28,
154  aZmove = 30,
156  aYmove = 32,
157 
159  gXmove = 40,
161  gZmove = 42,
163  gYmove = 44,
164 
166  tempMove = 46,
167 
169  mXmove = 47,
171  mZmove = 49,
173  mYmove = 50,
174 };
175 
177 enum Angle {
178  Pitch = 0x01,
179  Roll = 0x02,
180 };
181 
182 enum Status {
183  // Note that the location is shiftet 9 when it's connected via USB
184  // Byte location | bit location
185  Plugged = (38 << 8) | 0x02,
186  Unplugged = (38 << 8) | 0x03,
187 
188  Charging = (39 << 8) | 0xEE,
189  NotCharging = (39 << 8) | 0xF1,
190  Shutdown = (39 << 8) | 0x01,
191  Dying = (39 << 8) | 0x02,
192  Low = (39 << 8) | 0x03,
193  High = (39 << 8) | 0x04,
194  Full = (39 << 8) | 0x05,
195 
196  MoveCharging = (21 << 8) | 0xEE,
197  MoveNotCharging = (21 << 8) | 0xF1,
198  MoveShutdown = (21 << 8) | 0x01,
199  MoveDying = (21 << 8) | 0x02,
200  MoveLow = (21 << 8) | 0x03,
201  MoveHigh = (21 << 8) | 0x04,
202  MoveFull = (21 << 8) | 0x05,
203 
204  CableRumble = (40 << 8) | 0x10, //Opperating by USB and rumble is turned on
205  Cable = (40 << 8) | 0x12, //Opperating by USB and rumble is turned off
206  BluetoothRumble = (40 << 8) | 0x14, //Opperating by bluetooth and rumble is turned on
207  Bluetooth = (40 << 8) | 0x16, //Opperating by bluetooth and rumble is turned off
208 };
209 
210 enum Rumble {
211  RumbleHigh = 0x10,
212  RumbleLow = 0x20,
213 };
214 
215 #endif