#ifndef _USB_DESCRIPTOR_HID_H_
#define _USB_DESCRIPTOR_HID_H_
//----------------------------------------------------------------------------
///
/// \brief  USB device descriptor
///
///         See implementation files for further information.
//
/// \date   2018025
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Includes-----------------------------------------------------------------


//---Own------------------------------


#include <biwak/usb_defines.h>


//---Defines------------------------------------------------------------------

// hexdump -Cv /sys/bus/usb/devices/3-4.2.3/descriptors

#define HID_EPIN_ADDR                  0x81
#define HID_EPIN_SIZE                  0x8
#define HID_EPOUT_SIZE                 0x8

/* USB HID device HS Configuration Descriptor */
__ALIGN_BEGIN static uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_END =
    {
        0x09,                                               /* bLength: Configuration Descriptor size */
        USB_DESC_TYPE_CONFIGURATION,                        /* bDescriptorType: Configuration */
        USB_HID_CONFIG_DESC_SIZ,                            /* wTotalLength: Bytes returned */
        0x00,
        0x01,                                               /* bNumInterfaces: 1 interface */
        0x01,                                               /* bConfigurationValue: Configuration value */
        0x00,                                               /* iConfiguration: Index of string descriptor describing the configuration */
#if (USBD_SELF_POWERED == 1U)
        0xE0,                                               /* bmAttributes: Bus Powered according to user configuration */
#else
        0xA0,                                               /* bmAttributes: Bus Powered according to user configuration */
#endif
        USBD_MAX_POWER,                                     /* MaxPower 100 mA: this current is used for detecting Vbus */
        
        /************** Descriptor of Joystick Mouse interface ****************/
        /* 09 */
        0x09,                                               /* bLength: Interface Descriptor size */
        USB_DESC_TYPE_INTERFACE,                            /* bDescriptorType: Interface descriptor type */
        0x00,                                               /* bInterfaceNumber: Number of Interface */
        0x00,                                               /* bAlternateSetting: Alternate setting */
        0x01,                                               /* bNumEndpoints */
        0x03,                                               /* bInterfaceClass: HID */
        0x01,                                               /* bInterfaceSubClass : 1=BOOT, 0=no boot */
        0x01,                                               /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
        0,                                                  /* iInterface: Index of string descriptor */
        /******************** Descriptor of Joystick Mouse HID ********************/
        /* 18 */
        0x09,                                               /* bLength: HID Descriptor size */
        HID_DESCRIPTOR_TYPE,                                /* bDescriptorType: HID */
        0x11,                                               /* bcdHID: HID Class Spec release number */
        0x01,
        0x00,                                               /* bCountryCode: Hardware target country */
        0x01,                                               /* bNumDescriptors: Number of HID class descriptors to follow */
        0x22,                                               /* bDescriptorType */
        HID_MOUSE_REPORT_DESC_SIZE,                         /* wItemLength: Total length of Report descriptor */
        0x00,
        /******************** Descriptor of Mouse endpoint ********************/
        /* 27 */
        0x07,                                               /* bLength: Endpoint Descriptor size */
        USB_DESC_TYPE_ENDPOINT,                             /* bDescriptorType: */
        
        HID_EPIN_ADDR,                                      /* bEndpointAddress: Endpoint Address (IN) */
        0x03,                                               /* bmAttributes: Interrupt endpoint */
        HID_EPIN_SIZE,                                      /* wMaxPacketSize: 4 Byte max */
        0x00,
        HID_HS_BINTERVAL,                                   /* bInterval: Polling Interval */
        /* 34 */
};


//---fin----------------------------------------------------------------------
#endif // ? ! _USB_DESCRIPTOR_HID_H_
