• a quick update on "fixing stuff": it seems I can get the buttons to appear but not in a reliable manner ( I'd say if I'm fast enough plugging the usb cable ? this is weird .. ) and while code shouldn't work ?!
    could this in part come from not waiting enough on init or within the main while loop ?
    also, it could also come from the page I'm using for my tests ( http://html5gamepad.com/ ), but since it worked great until now, I bet the error in in my messy code ;p

    /* ==== main.c ==== */
    // still trying .. and 'sometimes' works with "#define HID_EPIN_SIZE 0x04" in "usbd_hid.h" ?! ;D
      //uint8_t bufferHID[6] = {0, 0, 0, 0, 0};
      uint8_t bufferHID[6] = {0, 0, 0, 0, 0, 0}; // nope ?!
      //uint8_t bufferHID[6] = {}; // gives 'implicit declaration ..' but works ? ..
      //uint8_t bufferHID[6];
      bufferHID[0] = (gamepadHID.buttons & 0xFF);
      bufferHID[1] = ( (gamepadHID.buttons >> 8) & 0xFF);
      bufferHID[2] = gamepadHID.left_x;
      bufferHID[3] = gamepadHID.left_y;
      bufferHID[4] = gamepadHID.right_x;
      bufferHID[5] = gamepadHID.right_y;
      USBD_HID_SendReport(&hUsbDeviceFS, &bufferHID, sizeof(bufferHID));
      //USBD_HID_SendReport(&hUsbDeviceFS, &bufferHID, sizeof(struct gamepadHID_t));
    
      //USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t));
      HAL_Delay(30);
    
    /* ==== usbd_hid.h ==== */
    [#define](https://forum.espruino.com/sea­rch/?q=%23define) HID_EPIN_SIZE                 0x04 // shouldn't be enough, right ?
    
About

Avatar for stephaneAG @stephaneAG started