Browse Source

@mjs513 changes for Space

main
Kurt Eckhardt 5 years ago
parent
commit
4deeb89add
2 changed files with 7 additions and 4 deletions
  1. +2
    -2
      USBHost_t36.h
  2. +5
    -2
      joystick.cpp

+ 2
- 2
USBHost_t36.h View File

@@ -27,7 +27,7 @@
#include <stdint.h>

#if !defined(__MK66FX1M0__) && !defined(__IMXRT1052__) && !defined(__IMXRT1062__)
#error "USBHost_t36 only works with Teensy 3.6. Please select it in Tools > Boards"
#error "USBHost_t36 only works with Teensy 3.6 or Teensy 4.x. Please select it in Tools > Boards"
#endif
#include "utility/imxrt_usbhs.h"

@@ -915,7 +915,7 @@ public:
bool setLEDs(uint8_t lr, uint8_t lg, uint8_t lb); // sets Leds,
bool inline setLEDs(uint32_t leds) {return setLEDs((leds >> 16) & 0xff, (leds >> 8) & 0xff, leds & 0xff);} // sets Leds - passing one arg for all leds
enum { STANDARD_AXIS_COUNT = 10, ADDITIONAL_AXIS_COUNT = 54, TOTAL_AXIS_COUNT = (STANDARD_AXIS_COUNT+ADDITIONAL_AXIS_COUNT) };
typedef enum { UNKNOWN=0, PS3, PS4, XBOXONE, XBOX360, PS3_MOTION} joytype_t;
typedef enum { UNKNOWN=0, PS3, PS4, XBOXONE, XBOX360, PS3_MOTION, SpaceNav} joytype_t;
joytype_t joystickType() {return joystickType_;}

// PS3 pair function. hack, requires that it be connect4ed by USB and we have the address of the Bluetooth dongle...

+ 5
- 2
joystick.cpp View File

@@ -43,7 +43,9 @@ JoystickController::product_vendor_mapping_t JoystickController::pid_vid_mapping
{ 0x054C, 0x0268, PS3, true},
{ 0x054C, 0x042F, PS3, true}, // PS3 Navigation controller
{ 0x054C, 0x03D5, PS3_MOTION, true}, // PS3 Motion controller
{ 0x054C, 0x05C4, PS4, true}, {0x054C, 0x09CC, PS4, true }
{ 0x054C, 0x05C4, PS4, true}, {0x054C, 0x09CC, PS4, true },
{ 0x046D, 0xC626, SpaceNav, true}, // 3d Connextion Space Navigator, 0x10008
{ 0x046D, 0xC628, SpaceNav, true} // 3d Connextion Space Navigator, 0x10008
};


@@ -331,7 +333,7 @@ bool JoystickController::transmitPS3MotionUserFeedbackMsg() {
hidclaim_t JoystickController::claim_collection(USBHIDParser *driver, Device_t *dev, uint32_t topusage)
{
// only claim Desktop/Joystick and Desktop/Gamepad
if (topusage != 0x10004 && topusage != 0x10005) return CLAIM_NO;
if (topusage != 0x10004 && topusage != 0x10005 && topusage != 0x10008) return CLAIM_NO;
// only claim from one physical device
if (mydevice != NULL && dev != mydevice) return CLAIM_NO;

@@ -389,6 +391,7 @@ void JoystickController::hid_input_begin(uint32_t topusage, uint32_t type, int l

void JoystickController::hid_input_data(uint32_t usage, int32_t value)
{
DBGPrintf("joystickType_=%d\n", joystickType_);
DBGPrintf("Joystick: usage=%X, value=%d\n", usage, value);
uint32_t usage_page = usage >> 16;
usage &= 0xFFFF;

Loading…
Cancel
Save