HID Gamepad for the Bangle

Posted on
  • I see there is an HID keyboard module for the Bangle, but none for a gamepad apparently.

    If I wanted to implement that, is this still my best bet, or is there something better now?

    As a side question: I see in the code for the hidkbd app for example that there is neither a call to require("ble_hid_keyboard") nor to NRF.setServices() as in all the documentation I can find on the subject. There is only ever the NRF.SendHIDReport(). Apparently that works, but why?

    Thanks.

  • Hi! There is actually a joystick implementation that might do you? https://github.com/espruino/BangleApps/b­lob/master/apps/hidjoystick/app.js

    So you'd just have to set up/down/left/right using X/Y values, but that should work fine?

    With Bangle.js it's a little more complicated as the Bangle always wants to have the HID services set up. You could just use NRF.setServices in your app, but then it'd only work if you ran the app and then paired the Bangle with another device, which is less than ideal.

    So what happens is the relevant report descriptors are set in the bootloader code, and configurable from the settings app: https://github.com/espruino/BangleApps/b­lob/master/apps/boot/boot0.js#L7

    Then when the app runs, it can check to see if HID is enabled, and if not it'll prompt the user: https://github.com/espruino/BangleApps/b­lob/master/apps/hidjoystick/app.js#L65

  • Ah okay, I get it now. I didn't see the settings also had a "Joystick" setting.

    Yes, the hidjoystick app should work fine for me!

    Thanks.

  • Okay, so I tried the hidjoystick app. Just a heads up for anyone else trying this, after changing the HID setting to "Joystick" it seems I had to completely disconnect (read: unplug the BT dongle) and reconnect the Bangle for it to be recognized as joystick, before it was still seen as keyboard. Now it works fine.

  • On Linux you can "simply" restart the bluetooth service. The discussion about that is here: https://github.com/espruino/BangleApps/i­ssues/349

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

HID Gamepad for the Bangle

Posted by Avatar for Sebastian @Sebastian

Actions