Page 1 of 1

REQUEST: Gamepad HID Demo

Posted: Thu Apr 12, 2018 3:46 pm
by Oheyoo
Hello,
can somebody point me towards the correct piece of Documentation or Code to simulate a Gamepad over Bluetooth?
There are examples for Keyboards and Mice out there, however I can't seem to get a Gamepad-Demo working, especially since the Documentation on this is so sparse.
I was really expecting the Software/Documentation to be more mature, considering how easy the USB equivalent is on an Arduino Leonardo.

Re: REQUEST: Gamepad HID Demo

Posted: Mon Apr 16, 2018 5:46 pm
by chegewara
Hi,
sorry if my documentation dont meet your expectations, but i thought so example code will be enough. Its very easy to build gamepad with just as little code changes. Its enough to change reportMap, add interrupts for buttons and build proper structure according to reportMap. But if you havent seen it before then here is example:
https://github.com/nkolban/esp32-snippe ... Device.cpp

and you are welcome to open issue with questions on github, i will help as much as i can.

Or you can try with this stack:
https://github.com/bluekitchen/btstack/ ... er/example

Re: REQUEST: Gamepad HID Demo

Posted: Wed Dec 04, 2019 9:59 pm
by NemethS
Hi,

Im thinking about a gamecontroller for a simulator game.
I have an code which turns the esp32 into a BLE HID gamepad, win10 can connect to it, appears in devices.
The base of a code came from a keyboard example, i've changed the HID descriptor ( and some other thing :D ), but i dont know the way how to send the controller data back to PC.
I had a previous try with arduino, but the esp32 bluetooth functionality fits more to my expectation.

On the arduino version i just had to write the data structure to the serial port, but im not sure here how i can send it.

Attached the esp32 code, if someone could enlighten me i would be thankfull :D

------------------------------------
#define NUM_BUTTONS 40 // you don't need to change this value
#define NUM_AXES 8 // 6 axes to UNO, and 8 to MEGA. If you are using UNO, don't need to change this value.
typedef struct joyReport_t {
int16_t axis[NUM_AXES];
uint8_t button[(NUM_BUTTONS+7)/8]; // 8 buttons per byte
} joyReport_t;

joyReport_t joyReport;

------------------------------------

void sendJoyReport(struct joyReport_t *report)
{
#ifndef DEBUG
Serial.write((uint8_t *)report, sizeof(joyReport_t)); i need this part to convert esp32 BLE HID compatible
#else
.
.
.

-------------------------------------

Many thanx if anybody wasting time on me!

Al3x