#include "usb_hid_desc.h"

#if 1//USB_DEVICE_TYPE & BIT(2)

//usb config descriptor
AT(.usbdev.com.table)
const u8 desc_config_hid[USB_HID_CFG_SIZE] = {
    0x09,
    USB_DESC_TYPE_CFG,
    L_BYTE(USB_HID_CFG_SIZE),
    H_BYTE(USB_HID_CFG_SIZE),
    0x01,
    0x01,
    0x00,
    0xa0,
    0x32,

    0x09,
    USB_DESC_TYPE_IF,
    0x00,
    0x00,
    0x01,
    0x03,
    0x01,
    0x01,
    0,

    0x09,
    HID_DESC_TYPE,
    L_BYTE(HID_VERSION_BCD),
    H_BYTE(HID_VERSION_BCD),
    0x00,
    0x01,
    0x22,
    L_BYTE(HID_REPORT_SIZE),
    H_BYTE(HID_REPORT_SIZE),

    0x07,
    USB_DESC_TYPE_EP,
    HID_IN_EP | 0x80,
    0x03,
    L_BYTE(HID_IN_PACKET),
    H_BYTE(HID_IN_PACKET),
    0x14,
};

//usb config descriptor
AT(.usbdev.com.table)
const uint8_t desc_hid_report[HID_REPORT_SIZE] = {
    0x05, 0x01,
    0x09, 0x06,
    0xa1, 0x01,
    0x05, 0x07,
    0x19, 0xe0,
    0x29, 0xe7,
    0x15, 0x00,
    0x25, 0x01,
    0x75, 0x01,
    0x95, 0x08,
    0x81, 0x02,
    0x95, 0x01,
    0x75, 0x08,
    0x81, 0x03,
    0x95, 0x05,
    0x75, 0x01,
    0x05, 0x08,
    0x19, 0x01,
    0x29, 0x05,
    0x91, 0x02,
    0x95, 0x01,
    0x75, 0x03,
    0x91, 0x03,
    0x95, 0x06,
    0x75, 0x08,
    0x15, 0x00,
    0x25, 0xFF,
    0x05, 0x07,
    0x19, 0x00,
    0x29, 0x65,
    0x81, 0x00,
    0xc0,
};

u8 *usb_get_config_descriptor(u8 *length)
{
    *length = sizeof(desc_config_hid);
    return (u8 *)desc_config_hid;
}

u8 *usb_get_hid_config_descriptor(u8 *length)
{
    *length = 9;
    return (u8 *)desc_config_hid + 0x12;
}

u8 *usb_get_hid_report_descriptor(u8 *length)
{
    *length = sizeof(desc_hid_report);
    return (u8 *)desc_hid_report;
}

#endif // USB_DEVICE_TYPE & BIT(2)
