PS2 has 2 more axes: Z and Rz
So Descriptors.c has to be modified:
Replace
0x09, 0x30, /* Usage (X) */
0x09, 0x31, /* Usage (Y) */
0x15, 0x9c, /* Logical Minimum (-100) */
0x25, 0x64, /* Logical Maximum (100) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x02, /* Report Count (2) */
by
0x09, 0x30, /* Usage (X) */
0x09, 0x31, /* Usage (Y) */
0x09, 0x32, /* Usage (Z) */
0x09, 0x35, /* Usage (Rz) */
0x15, 0x9c, /* Logical Minimum (-100) */
0x25, 0x64, /* Logical Maximum (100) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x04, /* Report Count (4) */
And change the data structure:
in Joystick.h
Replace
typedef struct
{
int8_t X; /**< Current absolute joystick X position, as a signed 8-bit integer */
int8_t Y; /**< Current absolute joystick Y position, as a signed 8-bit integer */
uint8_t Button; /**< Bit mask of the currently pressed joystick buttons */
} USB_JoystickReport_Data_t;
by:
typedef struct
{
int8_t X; /**< Current absolute joystick X position, as a signed 8-bit integer */
int8_t Y; /**< Current absolute joystick Y position, as a signed 8-bit integer */
int8_t Z; /**< Current absolute joystick Z position, as a signed 8-bit integer */
int8_t Rz; /**< Current absolute joystick Rz position, as a signed 8-bit integer */
uint8_t Button; /**< Bit mask of the currently pressed joystick buttons */
} USB_JoystickReport_Data_t;
I think it's the only thing to modify to see the 8u2 as a 4 axes joystick.
The code that is used to manage serial communication between 8u2 and arduino has to be updated to.