PaulStoffregen / USBHost_t36

USB Host Library for Teensy 3.6 and 4.0
165 stars 85 forks source link

USBHub_t36 JoystickController with PS4 D-PAD buttons not working #47

Open julianmorrison opened 3 years ago

julianmorrison commented 3 years ago

I am using version from master at PaulStoffregen/USBHost_t36 on a Teensy 4.1 and all works OK with PS4 connected via wired USB connection (great work btw). This is a branded PS4 controller I inherited from my son who now has a PS5. All OK except D-PAD buttons which are not changing any bits in call to joystick1.getButtons(). I discovered them in axis[9] so have mapped these to my PS4 buttons object using a similar schema to that used in the Bluetooth HID joystick parser: // N N/E E S/E S S/W W N/W static const uint32_t dpad_to_buttons[] = {0x10000, 0x30000, 0x20000, 0x60000, 0x40000, 0xC0000, 0x80000, 0x90000}; if (dpadAxis < (uint16_t)PS4Button::DpadOff) _buttons |= dpad_to_buttons[dpadAxis];