Anyone try using the puck as a USB HID Joystick? #3768
Replies: 8 comments
-
Posted at 2021-06-30 by @gfwilliams Yes, I believe it has been implemented for bangle.js, just not as a module. See: https://github.com/espruino/BangleApps/blob/master/apps/boot/hid_info.txt And it gets used like this: https://github.com/espruino/BangleApps/blob/master/apps/hidjoystick/app.js#L11 So you should just be able to piece those two bits together - let me know if you need a hand though! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-30 by DrewS Amazing!!!! I'll give it a shot and report back. Thx! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-30 by DrewS Ok - I have some incremental progress. Below is my modified js for the puck. I'm testing it in OpenEmu on my Mac. The puck shows up as a joystick (sometimes as 'unknown' and sometimes as 'Puck.js 80b6'). Once I got Y axis analog input triggering, but no buttons and nothing on the x axis. I also still get the message "BLE Connected, queueing BLE restart for later" in the IDE, but I seem to always get that even when using the BLE Keyboard HID. I've pretty aggressively been disconnecting the puck from bluetooth after flashing it with my program, so I think the bluetooth stack is automatically restarting in HID mode (which seems to be reflected in the device showing up in OpenEMU's joystick list). That said, my workflow could still be wrong here. Anyway, let me know if you spot anything obviously incorrect. Thx again!
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-07-01 by @gfwilliams Ok, great! Is OpenEmu running on the same Mac you're developing with?
I think this is because there's not enough space in advertising for the HID information and the name. There are ways around this but probably you see 'Puck.js 80b6' just because the Mac remembered the name from before.
Yes, that sounds perfect. Only thing I'd say is:
Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-07-01 by DrewS Awesome tips -thx! Responses:
yup!
Done
Ahh - didn't realize that could cause issues. Removed.
Done - great suggestion. I have it flashing blue when it starts the sendHID function, red when NRF.sendHIDReport() is successful, and green when it's sending a button press. With those changes it does expose something weird. When I connect via the IDE, I can flash the device and see both the red and blue LEDs blinking. When I disconnect from the IDE and only connect via the mac bluetooth menu, I only ever see the blue led blinking. So NRF.sendHIDReport() never seems to be successful, unless I connect via the IDE... Does that add up to anything obviously incorrect?
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-07-02 by @gfwilliams Hmm - that is odd - I can't see anything obvious. You could try I'm not sure how technical you are, but the easy way to debug is to attach a USB-TTL converter as in http://www.espruino.com/Puck.js#serial-console so you can see what's going on even when you are connected by Bluetooth |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-07-05 by DrewS Thanks Gordon - I've been away from my computer but will give these a shot and follow up later this week. Much appreciated! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-07-08 by DrewS Ok, tried the uart:false flag but no luck there. I did look more deeply into the serial-console as well, but (perhaps not surprisingly) it's a bit of a stretch for my technical level. I'll see how far I can get using the BLE keyboard input module instead for now. Thx again for all the help. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2021-06-30 by DrewS
I'm loving the BLE Keyboard HID input that's supported by the puck (this one), but I'd like to use analog joystick input along with the various button presses.
Has anyone tried making a joystick HID input module?
Beta Was this translation helpful? Give feedback.
All reactions