Greetings,
I am currently developing a custom gamepad for mobile devices which consists of :
- 9 Buttons,
- x2 Analog Joysticks,
- Bluetooth HC05 (Flashed with RN42 firmware),
- Leonardo Pro Micro Arduino ATMEGA32U4 5V 16MHz.
After accessing the Command mode via serial monitor, I managed to set the Bluetooth device as an HID gamepad type device and the rest of configurations.
I found out that RN42 has a preset of its own set of report scans and as far as I understand are not modifiable? Could someone correct me if I am wrong?
The problem is that the scans that I send via Serial1.write have a limitation for 16 buttons and 2 joysticks, the second joystick is being limited to Z and X axis. D-PAD (POV) is missing as well. What I need is a full range of available buttons like in popular Playstation or Xbox controllers.
Gamepad properties on Windows 10
After unsuccessful attempts using available libraries such as BPLib, I managed to send the scans like this:
void JoystickInput(byte ST_BTN, byte ND_BTN, byte L_X, byte L_Y, byte R_X, byte R_Y) {
Serial1.write((byte)0xFD); // HID raw report descriptor
Serial1.write((byte)0x6); // Length
Serial1.write((byte)R_X); // Right X Axis
Serial1.write((byte)R_Y); // Right Y Axis
Serial1.write((byte)L_X); // Left X Axis
Serial1.write((byte)L_Y); // Left Y Axis
Serial1.write((byte)ST_BTN & 0xFF); // first 8 buttons
Serial1.write((byte)ND_BTN & 0xFF); // second 8 buttons
}
Importantly, I need access to D-PAD and Y rotation. Is there any way to send scans to the host while still being identified as a gamepad on different devices? If it is possible to do it by modifying the descriptor, could someone point me in the right direction how to do it? Thank you in advance.