PageRenderTime 48ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/controllerEnums.h

https://gitlab.com/joseangeljimenez/USB_Host_Shield_2.0
C Header | 206 lines | 108 code | 25 blank | 73 comment | 0 complexity | f502944f72a677124867fe66c2b91c73 MD5 | raw file
  1. /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. All rights reserved.
  2. This software may be distributed and modified under the terms of the GNU
  3. General Public License version 2 (GPL2) as published by the Free Software
  4. Foundation and appearing in the file GPL2.TXT included in the packaging of
  5. this file. Please note that GPL2 Section 2[b] requires that all works based
  6. on this software must also be made publicly available under the terms of
  7. the GPL2 ("Copyleft").
  8. Contact information
  9. -------------------
  10. Kristian Lauszus, TKJ Electronics
  11. Web : http://www.tkjelectronics.com
  12. e-mail : kristianl@tkjelectronics.com
  13. */
  14. #ifndef _controllerenums_h
  15. #define _controllerenums_h
  16. /**
  17. * This header file is used to store different enums for the controllers,
  18. * This is necessary so all the different libraries can be used at once.
  19. */
  20. /** Enum used to turn on the LEDs on the different controllers. */
  21. enum LEDEnum {
  22. OFF = 0,
  23. #ifndef RBL_NRF51822
  24. LED1 = 1,
  25. LED2 = 2,
  26. LED3 = 3,
  27. LED4 = 4,
  28. #endif
  29. LED5 = 5,
  30. LED6 = 6,
  31. LED7 = 7,
  32. LED8 = 8,
  33. LED9 = 9,
  34. LED10 = 10,
  35. /** Used to blink all LEDs on the Xbox controller */
  36. ALL = 5,
  37. };
  38. /** Used to set the colors of the Move and PS4 controller. */
  39. enum ColorsEnum {
  40. /** r = 255, g = 0, b = 0 */
  41. Red = 0xFF0000,
  42. /** r = 0, g = 255, b = 0 */
  43. Green = 0xFF00,
  44. /** r = 0, g = 0, b = 255 */
  45. Blue = 0xFF,
  46. /** r = 255, g = 235, b = 4 */
  47. Yellow = 0xFFEB04,
  48. /** r = 0, g = 255, b = 255 */
  49. Lightblue = 0xFFFF,
  50. /** r = 255, g = 0, b = 255 */
  51. Purple = 0xFF00FF,
  52. Purble = 0xFF00FF,
  53. /** r = 255, g = 255, b = 255 */
  54. White = 0xFFFFFF,
  55. /** r = 0, g = 0, b = 0 */
  56. Off = 0x00,
  57. };
  58. enum RumbleEnum {
  59. RumbleHigh = 0x10,
  60. RumbleLow = 0x20,
  61. };
  62. /** This enum is used to read all the different buttons on the different controllers */
  63. enum ButtonEnum {
  64. /**@{*/
  65. /** These buttons are available on all the the controllers */
  66. UP = 0,
  67. RIGHT = 1,
  68. DOWN = 2,
  69. LEFT = 3,
  70. /**@}*/
  71. /**@{*/
  72. /** Wii buttons */
  73. PLUS = 5,
  74. TWO = 6,
  75. ONE = 7,
  76. MINUS = 8,
  77. HOME = 9,
  78. Z = 10,
  79. C = 11,
  80. B = 12,
  81. A = 13,
  82. /**@}*/
  83. /**@{*/
  84. /** These are only available on the Wii U Pro Controller */
  85. L = 16,
  86. R = 17,
  87. ZL = 18,
  88. ZR = 19,
  89. /**@}*/
  90. /**@{*/
  91. /** PS3 controllers buttons */
  92. SELECT = 4,
  93. START = 5,
  94. L3 = 6,
  95. R3 = 7,
  96. L2 = 8,
  97. R2 = 9,
  98. L1 = 10,
  99. R1 = 11,
  100. TRIANGLE = 12,
  101. CIRCLE = 13,
  102. CROSS = 14,
  103. SQUARE = 15,
  104. PS = 16,
  105. MOVE = 17, // Covers 12 bits - we only need to read the top 8
  106. T = 18, // Covers 12 bits - we only need to read the top 8
  107. /**@}*/
  108. /** PS4 controllers buttons - SHARE and OPTIONS are present instead of SELECT and START */
  109. SHARE = 4,
  110. OPTIONS = 5,
  111. TOUCHPAD = 17,
  112. /**@}*/
  113. /**@{*/
  114. /** Xbox buttons */
  115. BACK = 4,
  116. X = 14,
  117. Y = 15,
  118. XBOX = 16,
  119. SYNC = 17,
  120. BLACK = 8, // Available on the original Xbox controller
  121. WHITE = 9, // Available on the original Xbox controller
  122. /**@}*/
  123. /** PS Buzz controllers */
  124. RED = 0,
  125. YELLOW = 1,
  126. GREEN = 2,
  127. ORANGE = 3,
  128. BLUE = 4,
  129. /**@}*/
  130. };
  131. /** Joysticks on the PS3 and Xbox controllers. */
  132. enum AnalogHatEnum {
  133. /** Left joystick x-axis */
  134. LeftHatX = 0,
  135. /** Left joystick y-axis */
  136. LeftHatY = 1,
  137. /** Right joystick x-axis */
  138. RightHatX = 2,
  139. /** Right joystick y-axis */
  140. RightHatY = 3,
  141. };
  142. /**
  143. * Sensors inside the Sixaxis Dualshock 3, Move controller and PS4 controller.
  144. * <B>Note:</B> that the location is shifted 9 when it's connected via USB on the PS3 controller.
  145. */
  146. enum SensorEnum {
  147. /** Accelerometer values */
  148. aX = 50, aY = 52, aZ = 54,
  149. /** Gyro z-axis */
  150. gZ = 56,
  151. gX, gY, // These are not available on the PS3 controller
  152. /** Accelerometer x-axis */
  153. aXmove = 28,
  154. /** Accelerometer z-axis */
  155. aZmove = 30,
  156. /** Accelerometer y-axis */
  157. aYmove = 32,
  158. /** Gyro x-axis */
  159. gXmove = 40,
  160. /** Gyro z-axis */
  161. gZmove = 42,
  162. /** Gyro y-axis */
  163. gYmove = 44,
  164. /** Temperature sensor */
  165. tempMove = 46,
  166. /** Magnetometer x-axis */
  167. mXmove = 47,
  168. /** Magnetometer z-axis */
  169. mZmove = 49,
  170. /** Magnetometer y-axis */
  171. mYmove = 50,
  172. };
  173. /** Used to get the angle calculated using the PS3 controller and PS4 controller. */
  174. enum AngleEnum {
  175. Pitch = 0x01,
  176. Roll = 0x02,
  177. };
  178. #endif