You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* Copyright (C) 2012 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 : [email protected]
  13. */
  14. #ifndef _ps3enums_h
  15. #define _ps3enums_h
  16. #include "controllerEnums.h"
  17. /** Size of the output report buffer for the Dualshock and Navigation controllers */
  18. #define PS3_REPORT_BUFFER_SIZE 48
  19. /** Report buffer for all PS3 commands */
  20. const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE] PROGMEM = {
  21. 0x00, 0x00, 0x00, 0x00, 0x00,
  22. 0x00, 0x00, 0x00, 0x00, 0x00,
  23. 0xff, 0x27, 0x10, 0x00, 0x32,
  24. 0xff, 0x27, 0x10, 0x00, 0x32,
  25. 0xff, 0x27, 0x10, 0x00, 0x32,
  26. 0xff, 0x27, 0x10, 0x00, 0x32,
  27. 0x00, 0x00, 0x00, 0x00, 0x00,
  28. 0x00, 0x00, 0x00, 0x00, 0x00,
  29. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  30. };
  31. /** Size of the output report buffer for the Move Controller */
  32. #define MOVE_REPORT_BUFFER_SIZE 7
  33. /** Used to set the LEDs on the controllers */
  34. const uint8_t PS3_LEDS[] PROGMEM = {
  35. 0x00, // OFF
  36. 0x01, // LED1
  37. 0x02, // LED2
  38. 0x04, // LED3
  39. 0x08, // LED4
  40. 0x09, // LED5
  41. 0x0A, // LED6
  42. 0x0C, // LED7
  43. 0x0D, // LED8
  44. 0x0E, // LED9
  45. 0x0F, // LED10
  46. };
  47. /**
  48. * Buttons on the controllers.
  49. * <B>Note:</B> that the location is shifted 9 when it's connected via USB.
  50. */
  51. const uint32_t PS3_BUTTONS[] PROGMEM = {
  52. 0x10, // UP
  53. 0x20, // RIGHT
  54. 0x40, // DOWN
  55. 0x80, // LEFT
  56. 0x01, // SELECT
  57. 0x08, // START
  58. 0x02, // L3
  59. 0x04, // R3
  60. 0x0100, // L2
  61. 0x0200, // R2
  62. 0x0400, // L1
  63. 0x0800, // R1
  64. 0x1000, // TRIANGLE
  65. 0x2000, // CIRCLE
  66. 0x4000, // CROSS
  67. 0x8000, // SQUARE
  68. 0x010000, // PS
  69. 0x080000, // MOVE - covers 12 bits - we only need to read the top 8
  70. 0x100000, // T - covers 12 bits - we only need to read the top 8
  71. };
  72. /**
  73. * Analog buttons on the controllers.
  74. * <B>Note:</B> that the location is shifted 9 when it's connected via USB.
  75. */
  76. const uint8_t PS3_ANALOG_BUTTONS[] PROGMEM = {
  77. 23, // UP_ANALOG
  78. 24, // RIGHT_ANALOG
  79. 25, // DOWN_ANALOG
  80. 26, // LEFT_ANALOG
  81. 0, 0, 0, 0, // Skip SELECT, L3, R3 and START
  82. 27, // L2_ANALOG
  83. 28, // R2_ANALOG
  84. 29, // L1_ANALOG
  85. 30, // R1_ANALOG
  86. 31, // TRIANGLE_ANALOG
  87. 32, // CIRCLE_ANALOG
  88. 33, // CROSS_ANALOG
  89. 34, // SQUARE_ANALOG
  90. 0, 0, // Skip PS and MOVE
  91. // Playstation Move Controller
  92. 15, // T_ANALOG - Both at byte 14 (last reading) and byte 15 (current reading)
  93. };
  94. enum StatusEnum {
  95. // Note that the location is shifted 9 when it's connected via USB
  96. // Byte location | bit location
  97. Plugged = (38 << 8) | 0x02,
  98. Unplugged = (38 << 8) | 0x03,
  99. Charging = (39 << 8) | 0xEE,
  100. NotCharging = (39 << 8) | 0xF1,
  101. Shutdown = (39 << 8) | 0x01,
  102. Dying = (39 << 8) | 0x02,
  103. Low = (39 << 8) | 0x03,
  104. High = (39 << 8) | 0x04,
  105. Full = (39 << 8) | 0x05,
  106. MoveCharging = (21 << 8) | 0xEE,
  107. MoveNotCharging = (21 << 8) | 0xF1,
  108. MoveShutdown = (21 << 8) | 0x01,
  109. MoveDying = (21 << 8) | 0x02,
  110. MoveLow = (21 << 8) | 0x03,
  111. MoveHigh = (21 << 8) | 0x04,
  112. MoveFull = (21 << 8) | 0x05,
  113. CableRumble = (40 << 8) | 0x10, // Operating by USB and rumble is turned on
  114. Cable = (40 << 8) | 0x12, // Operating by USB and rumble is turned off
  115. BluetoothRumble = (40 << 8) | 0x14, // Operating by Bluetooth and rumble is turned on
  116. Bluetooth = (40 << 8) | 0x16, // Operating by Bluetooth and rumble is turned off
  117. };
  118. #endif