Fixed conflict between PS3 and PS4 libraries

This commit is contained in:
Kristian Lauszus 2014-01-18 22:50:05 +01:00
parent da2ee95445
commit 681c668448
3 changed files with 43 additions and 54 deletions

View file

@ -56,8 +56,7 @@ const uint8_t PS3_LEDS[] PROGMEM = {
};
/**
* Buttons on the controllers
*
* Buttons on the controllers.
* <B>Note:</B> that the location is shifted 9 when it's connected via USB.
*/
const uint32_t PS3_BUTTONS[] PROGMEM = {
@ -87,8 +86,7 @@ const uint32_t PS3_BUTTONS[] PROGMEM = {
};
/**
* Analog buttons on the controllers
*
* Analog buttons on the controllers.
* <B>Note:</B> that the location is shifted 9 when it's connected via USB.
*/
const uint8_t PS3_ANALOG_BUTTONS[] PROGMEM = {
@ -134,46 +132,6 @@ enum ColorsEnum {
Off = 0x00,
};
/**
* Sensors inside the Sixaxis Dualshock 3 and Move controller.
*
* <B>Note:</B> that the location is shifted 9 when it's connected via USB.
*/
enum SensorEnum {
/** Accelerometer x-axis */
aX = 50,
/** Accelerometer y-axis */
aY = 52,
/** Accelerometer z-axis */
aZ = 54,
/** Gyro z-axis */
gZ = 56,
/** Accelerometer x-axis */
aXmove = 28,
/** Accelerometer z-axis */
aZmove = 30,
/** Accelerometer y-axis */
aYmove = 32,
/** Gyro x-axis */
gXmove = 40,
/** Gyro z-axis */
gZmove = 42,
/** Gyro y-axis */
gYmove = 44,
/** Temperature sensor */
tempMove = 46,
/** Magnetometer x-axis */
mXmove = 47,
/** Magnetometer z-axis */
mZmove = 49,
/** Magnetometer y-axis */
mYmove = 50,
};
enum StatusEnum {
// Note that the location is shifted 9 when it's connected via USB
// Byte location | bit location

View file

@ -121,11 +121,6 @@ enum DPADEnum {
DPAD_OFF = 0x8,
};
enum PS4SensorEnum {
gX, gY, gZ, /** Gyro values */
aX, aY, aZ, /** Accelerometer values */
};
/** This class parses all the data sent by the PS4 controller */
class PS4Parser {
public:
@ -191,8 +186,8 @@ public:
return (atan2(ps4Data.accX, ps4Data.accZ) + PI) * RAD_TO_DEG;
};
int16_t getSensor(PS4SensorEnum a) {
switch(a) {
int16_t getSensor(SensorEnum s) {
switch(s) {
case gX:
return ps4Data.gyroX;
case gY:

View file

@ -18,9 +18,9 @@
#ifndef _controllerenums_h
#define _controllerenums_h
/*
This header file is used to store different enums for the controllers,
This is necessary so all the different libraries can be used at once
/**
* This header file is used to store different enums for the controllers,
* This is necessary so all the different libraries can be used at once.
*/
/** Enum used to turn on the LEDs on the different controllers. */
@ -124,6 +124,42 @@ enum AnalogHatEnum {
RightHatY = 3,
};
/**
* Sensors inside the Sixaxis Dualshock 3, Move controller and PS4 controller.
* <B>Note:</B> that the location is shifted 9 when it's connected via USB on the PS3 controller.
*/
enum SensorEnum {
/** Accelerometer values */
aX = 50, aY = 52, aZ = 54,
/** Gyro z-axis */
gZ = 56,
gX, gY, // These are not available on the PS3 controller
/** Accelerometer x-axis */
aXmove = 28,
/** Accelerometer z-axis */
aZmove = 30,
/** Accelerometer y-axis */
aYmove = 32,
/** Gyro x-axis */
gXmove = 40,
/** Gyro z-axis */
gZmove = 42,
/** Gyro y-axis */
gYmove = 44,
/** Temperature sensor */
tempMove = 46,
/** Magnetometer x-axis */
mXmove = 47,
/** Magnetometer z-axis */
mZmove = 49,
/** Magnetometer y-axis */
mYmove = 50,
};
/** Used to get the angle calculated using the PS3 controller and PS4 controller. */
enum AngleEnum {
Pitch = 0x01,