Takumi Odashima / ArduinoUsbHostShield

Dependents:   USBHOST_PS5

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers controllerEnums.h Source File

controllerEnums.h

00001 /* Copyright (C) 2013 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 _controllerenums_h
00019 #define _controllerenums_h
00020 
00021 #if defined(ESP32)
00022 #undef PS
00023 #endif
00024 
00025 /**
00026  * This header file is used to store different enums for the controllers,
00027  * This is necessary so all the different libraries can be used at once.
00028  */
00029 
00030 /** Enum used to turn on the LEDs on the different controllers. */
00031 enum LEDEnum {
00032         OFF = 0,
00033 #ifndef RBL_NRF51822
00034         CONTROLLER_LED1 = 1,
00035         CONTROLLER_LED2 = 2,
00036         CONTROLLER_LED3 = 3,
00037         CONTROLLER_LED4 = 4,
00038 #endif
00039         CONTROLLER_LED5 = 5,
00040         CONTROLLER_LED6 = 6,
00041         CONTROLLER_LED7 = 7,
00042         CONTROLLER_LED8 = 8,
00043         CONTROLLER_LED9 = 9,
00044         CONTROLLER_LED10 = 10,
00045         /** Used to blink all LEDs on the Xbox controller */
00046         ALL = 5,
00047 };
00048 
00049 /** Used to set the colors of the Move and PS4 controller. */
00050 enum ColorsEnum {
00051         /** r = 255, g = 0, b = 0 */
00052         Red = 0xFF0000,
00053         /** r = 0, g = 255, b = 0 */
00054         Green = 0xFF00,
00055         /** r = 0, g = 0, b = 255 */
00056         Blue = 0xFF,
00057 
00058         /** r = 255, g = 235, b = 4 */
00059         Yellow = 0xFFEB04,
00060         /** r = 0, g = 255, b = 255 */
00061         Lightblue = 0xFFFF,
00062         /** r = 255, g = 0, b = 255 */
00063         Purple = 0xFF00FF,
00064         Purble = 0xFF00FF,
00065 
00066         /** r = 255, g = 255, b = 255 */
00067         White = 0xFFFFFF,
00068         /** r = 0, g = 0, b = 0 */
00069         Off = 0x00,
00070 };
00071 
00072 enum RumbleEnum {
00073         RumbleHigh = 0x10,
00074         RumbleLow = 0x20,
00075 };
00076 
00077 /** This enum is used to read all the different buttons on the different controllers */
00078 enum ButtonEnum {
00079         /**@{*/
00080         /** These buttons are available on all the the controllers */
00081         UP = 0,
00082         RIGHT = 1,
00083         DOWN = 2,
00084         LEFT = 3,
00085         /**@}*/
00086 
00087         /**@{*/
00088         /** Wii buttons */
00089         PLUS = 5,
00090         TWO = 6,
00091         ONE = 7,
00092         MINUS = 8,
00093         HOME = 9,
00094         Z = 10,
00095         C = 11,
00096         B = 12,
00097         A = 13,
00098         /**@}*/
00099 
00100         /**@{*/
00101         /** These are only available on the Wii U Pro Controller */
00102         L = 16,
00103         R = 17,
00104         ZL = 18,
00105         ZR = 19,
00106         /**@}*/
00107 
00108         /**@{*/
00109         /** PS3 controllers buttons */
00110         SELECT = 4,
00111         START = 5,
00112         L3 = 6,
00113         R3 = 7,
00114 
00115         L2 = 8,
00116         R2 = 9,
00117         L1 = 10,
00118         R1 = 11,
00119         TRIANGLE = 12,
00120         CIRCLE = 13,
00121         CROSS = 14,
00122         SQUARE = 15,
00123 
00124         PS = 16,
00125 
00126         MOVE = 17, // Covers 12 bits - we only need to read the top 8
00127         T = 18, // Covers 12 bits - we only need to read the top 8
00128         /**@}*/
00129 
00130         /** PS4 controllers buttons - SHARE and OPTIONS are present instead of SELECT and START */
00131         SHARE = 4,
00132         OPTIONS = 5,
00133         TOUCHPAD = 17,
00134         /**@}*/
00135 
00136         /**@{*/
00137         /** Xbox buttons */
00138         BACK = 4,
00139         X = 14,
00140         Y = 15,
00141         XBOX = 16,
00142         SYNC = 17,
00143         BLACK = 8, // Available on the original Xbox controller
00144         WHITE = 9, // Available on the original Xbox controller
00145         /**@}*/
00146 
00147         /** PS Buzz controllers */
00148         RED = 0,
00149         YELLOW = 1,
00150         GREEN = 2,
00151         ORANGE = 3,
00152         BLUE = 4,
00153         /**@}*/
00154 };
00155 
00156 /** Joysticks on the PS3 and Xbox controllers. */
00157 enum AnalogHatEnum {
00158         /** Left joystick x-axis */
00159         LeftHatX = 0,
00160         /** Left joystick y-axis */
00161         LeftHatY = 1,
00162         /** Right joystick x-axis */
00163         RightHatX = 2,
00164         /** Right joystick y-axis */
00165         RightHatY = 3,
00166 };
00167 
00168 /**
00169  * Sensors inside the Sixaxis Dualshock 3, Move controller and PS4 controller.
00170  * <B>Note:</B> that the location is shifted 9 when it's connected via USB on the PS3 controller.
00171  */
00172 enum SensorEnum {
00173         /** Accelerometer values */
00174         aX = 50, aY = 52, aZ = 54,
00175         /** Gyro z-axis */
00176         gZ = 56,
00177         gX, gY, // These are not available on the PS3 controller
00178 
00179         /** Accelerometer x-axis */
00180         aXmove = 28,
00181         /** Accelerometer z-axis */
00182         aZmove = 30,
00183         /** Accelerometer y-axis */
00184         aYmove = 32,
00185 
00186         /** Gyro x-axis */
00187         gXmove = 40,
00188         /** Gyro z-axis */
00189         gZmove = 42,
00190         /** Gyro y-axis */
00191         gYmove = 44,
00192 
00193         /** Temperature sensor */
00194         tempMove = 46,
00195 
00196         /** Magnetometer x-axis */
00197         mXmove = 47,
00198         /** Magnetometer z-axis */
00199         mZmove = 49,
00200         /** Magnetometer y-axis */
00201         mYmove = 50,
00202 };
00203 
00204 /** Used to get the angle calculated using the PS3 controller and PS4 controller. */
00205 enum AngleEnum {
00206         Pitch = 0x01,
00207         Roll = 0x02,
00208 };
00209 
00210 #endif
00211