Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UsbHostMAX3421E_Hello
PS3Enums.h
00001 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved. 00002 00003 This software may be distributed and modified under the terms of the GNU 00004 General Public License version 2 (GPL2) as published by the Free Software 00005 Foundation and appearing in the file GPL2.TXT included in the packaging of 00006 this file. Please note that GPL2 Section 2[b] requires that all works based 00007 on this software must also be made publicly available under the terms of 00008 the GPL2 ("Copyleft"). 00009 00010 Contact information 00011 ------------------- 00012 00013 Kristian Lauszus, TKJ Electronics 00014 Web : http://www.tkjelectronics.com 00015 e-mail : kristianl@tkjelectronics.com 00016 */ 00017 00018 #ifndef _ps3enums_h 00019 #define _ps3enums_h 00020 00021 #include "controllerEnums.h" 00022 00023 /** Size of the output report buffer for the Dualshock and Navigation controllers */ 00024 #define PS3_REPORT_BUFFER_SIZE 48 00025 00026 /** Report buffer for all PS3 commands */ 00027 const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE] PROGMEM = { 00028 0x00, 0x00, 0x00, 0x00, 0x00, 00029 0x00, 0x00, 0x00, 0x00, 0x00, 00030 0xff, 0x27, 0x10, 0x00, 0x32, 00031 0xff, 0x27, 0x10, 0x00, 0x32, 00032 0xff, 0x27, 0x10, 0x00, 0x32, 00033 0xff, 0x27, 0x10, 0x00, 0x32, 00034 0x00, 0x00, 0x00, 0x00, 0x00, 00035 0x00, 0x00, 0x00, 0x00, 0x00, 00036 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 00037 }; 00038 00039 /** Size of the output report buffer for the Move Controller */ 00040 #define MOVE_REPORT_BUFFER_SIZE 7 00041 00042 /** Used to set the LEDs on the controllers */ 00043 const uint8_t PS3_LEDS[] PROGMEM = { 00044 0x00, // OFF 00045 0x01, // LED1 00046 0x02, // LED2 00047 0x04, // LED3 00048 0x08, // LED4 00049 00050 0x09, // LED5 00051 0x0A, // LED6 00052 0x0C, // LED7 00053 0x0D, // LED8 00054 0x0E, // LED9 00055 0x0F, // LED10 00056 }; 00057 00058 /** 00059 * Buttons on the controllers. 00060 * <B>Note:</B> that the location is shifted 9 when it's connected via USB. 00061 */ 00062 const uint32_t PS3_BUTTONS[] PROGMEM = { 00063 0x10, // UP 00064 0x20, // RIGHT 00065 0x40, // DOWN 00066 0x80, // LEFT 00067 00068 0x01, // SELECT 00069 0x08, // START 00070 0x02, // L3 00071 0x04, // R3 00072 00073 0x0100, // L2 00074 0x0200, // R2 00075 0x0400, // L1 00076 0x0800, // R1 00077 00078 0x1000, // TRIANGLE 00079 0x2000, // CIRCLE 00080 0x4000, // CROSS 00081 0x8000, // SQUARE 00082 00083 0x010000, // PS 00084 0x080000, // MOVE - covers 12 bits - we only need to read the top 8 00085 0x100000, // T - covers 12 bits - we only need to read the top 8 00086 }; 00087 00088 /** 00089 * Analog buttons on the controllers. 00090 * <B>Note:</B> that the location is shifted 9 when it's connected via USB. 00091 */ 00092 const uint8_t PS3_ANALOG_BUTTONS[] PROGMEM = { 00093 23, // UP_ANALOG 00094 24, // RIGHT_ANALOG 00095 25, // DOWN_ANALOG 00096 26, // LEFT_ANALOG 00097 0, 0, 0, 0, // Skip SELECT, L3, R3 and START 00098 00099 27, // L2_ANALOG 00100 28, // R2_ANALOG 00101 29, // L1_ANALOG 00102 30, // R1_ANALOG 00103 31, // TRIANGLE_ANALOG 00104 32, // CIRCLE_ANALOG 00105 33, // CROSS_ANALOG 00106 34, // SQUARE_ANALOG 00107 0, 0, // Skip PS and MOVE 00108 00109 // Playstation Move Controller 00110 15, // T_ANALOG - Both at byte 14 (last reading) and byte 15 (current reading) 00111 }; 00112 00113 enum StatusEnum { 00114 // Note that the location is shifted 9 when it's connected via USB 00115 // Byte location | bit location 00116 Plugged = (38 << 8) | 0x02, 00117 Unplugged = (38 << 8) | 0x03, 00118 00119 Charging = (39 << 8) | 0xEE, 00120 NotCharging = (39 << 8) | 0xF1, 00121 Shutdown = (39 << 8) | 0x01, 00122 Dying = (39 << 8) | 0x02, 00123 Low = (39 << 8) | 0x03, 00124 High = (39 << 8) | 0x04, 00125 Full = (39 << 8) | 0x05, 00126 00127 MoveCharging = (21 << 8) | 0xEE, 00128 MoveNotCharging = (21 << 8) | 0xF1, 00129 MoveShutdown = (21 << 8) | 0x01, 00130 MoveDying = (21 << 8) | 0x02, 00131 MoveLow = (21 << 8) | 0x03, 00132 MoveHigh = (21 << 8) | 0x04, 00133 MoveFull = (21 << 8) | 0x05, 00134 00135 CableRumble = (40 << 8) | 0x10, // Operating by USB and rumble is turned on 00136 Cable = (40 << 8) | 0x12, // Operating by USB and rumble is turned off 00137 BluetoothRumble = (40 << 8) | 0x14, // Operating by Bluetooth and rumble is turned on 00138 Bluetooth = (40 << 8) | 0x16, // Operating by Bluetooth and rumble is turned off 00139 }; 00140 00141 #endif
Generated on Tue Jul 12 2022 18:12:04 by
1.7.2