Change number of buttons in TinyUSB Gamepad

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
xivzunedu
 
Posts: 31
Joined: Thu Aug 16, 2018 5:14 pm

Change number of buttons in TinyUSB Gamepad

Post by xivzunedu »

I'm using Adafruit's TinyUSB library for Arduino and I was wondering if there was a way to change the number of buttons reported to the host? Specifically, I want a desktop/laptop, etc. to think the USB device only has 16 buttons instead of 32. These 32 buttons seem to be defined in hid.h. Is there a way to change the number of buttons reported to my desktop without editing hid.h?

User avatar
hathach
 
Posts: 1270
Joined: Tue Apr 23, 2013 1:02 am

Re: Change number of buttons in TinyUSB Gamepad

Post by hathach »

the max buttons is dictated by the report descriptors, by default the template TUD_HID_REPORT_DESC_GAMEPAD() define 32 button, you could change it to 16 by copy and modify the both HID_USAGE_MAX() and HID_REPORT_COUNT() to take 16 instead of 32.

https://github.com/adafruit/Adafruit_Ti ... ice.h#L347

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”