1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
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
13 Kristian Lauszus, TKJ Electronics
14 Web : http://www.tkjelectronics.com
15 e-mail : kristianl@tkjelectronics.com
21 #include "controllerEnums.h"
23 /** Size of the output report buffer for the Dualshock and Navigation controllers */
24 #define PS3_REPORT_BUFFER_SIZE 48
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
39 /** Size of the output report buffer for the Move Controller */
40 #define MOVE_REPORT_BUFFER_SIZE 7
42 /** Used to set the LEDs on the controllers */
43 const uint8_t PS3_LEDS[] PROGMEM = {
59 * Buttons on the controllers.
60 * <B>Note:</B> that the location is shifted 9 when it's connected via USB.
62 const uint32_t PS3_BUTTONS[] PROGMEM = {
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
89 * Analog buttons on the controllers.
90 * <B>Note:</B> that the location is shifted 9 when it's connected via USB.
92 const uint8_t PS3_ANALOG_BUTTONS[] PROGMEM = {
97 0, 0, 0, 0, // Skip SELECT, L3, R3 and START
103 31, // TRIANGLE_ANALOG
107 0, 0, // Skip PS and MOVE
109 // Playstation Move Controller
110 15, // T_ANALOG - Both at byte 14 (last reading) and byte 15 (current reading)
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,
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,
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,
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