mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Further tweaks to the HID update
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1156 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c46dcea73a
commit
d89cd43cd1
@ -15,7 +15,8 @@
|
|||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "usb_lib.h"
|
#include "usb_lib.h"
|
||||||
#include "pios_usb_desc.h"
|
#include "pios_usb.h"
|
||||||
|
#include "pios_usb_hid_desc.h"
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
@ -26,7 +27,7 @@
|
|||||||
/* Private functions ---------------------------------------------------------*/
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
/* USB Standard Device Descriptor */
|
/* USB Standard Device Descriptor */
|
||||||
const uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ_DEVICE_DESC] =
|
const uint8_t PIOS_HID_DeviceDescriptor[PIOS_HID_SIZ_DEVICE_DESC] =
|
||||||
{
|
{
|
||||||
0x12, /*bLength */
|
0x12, /*bLength */
|
||||||
USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
|
USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
|
||||||
@ -36,17 +37,17 @@ const uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ_DEVICE_DESC] =
|
|||||||
0x00, /*bDeviceSubClass*/
|
0x00, /*bDeviceSubClass*/
|
||||||
0x00, /*bDeviceProtocol*/
|
0x00, /*bDeviceProtocol*/
|
||||||
0x40, /*bMaxPacketSize40*/
|
0x40, /*bMaxPacketSize40*/
|
||||||
0x83, /*idVendor (0x0483)*/
|
(uint8_t)((PIOS_USB_VENDOR_ID) & 0xff), /*idVendor */
|
||||||
0x04,
|
(uint8_t)((PIOS_USB_VENDOR_ID) >> 8),
|
||||||
0x50, /*idProduct = 0x5750*/
|
(uint8_t)((PIOS_USB_PRODUCT_ID) & 0xff), /*idProduct */
|
||||||
0x57,
|
(uint8_t)((PIOS_USB_PRODUCT_ID) >> 8),
|
||||||
0x00, /*bcdDevice rel. 2.00*/
|
(uint8_t)((PIOS_USB_VERSION_ID) & 0xff), /*bcdDevice */
|
||||||
0x02,
|
(uint8_t)((PIOS_USB_VERSION_ID) >> 8),
|
||||||
1, /*Index of string descriptor describing
|
0x01, /*Index of string descriptor describing
|
||||||
manufacturer */
|
manufacturer */
|
||||||
2, /*Index of string descriptor describing
|
0x02, /*Index of string descriptor describing
|
||||||
product*/
|
product*/
|
||||||
3, /*Index of string descriptor describing the
|
0x03, /*Index of string descriptor describing the
|
||||||
device serial number */
|
device serial number */
|
||||||
0x01 /*bNumConfigurations*/
|
0x01 /*bNumConfigurations*/
|
||||||
}
|
}
|
||||||
@ -55,11 +56,11 @@ const uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ_DEVICE_DESC] =
|
|||||||
|
|
||||||
/* USB Configuration Descriptor */
|
/* USB Configuration Descriptor */
|
||||||
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
|
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
|
||||||
const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] =
|
const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC] =
|
||||||
{
|
{
|
||||||
0x09, /* bLength: Configuation Descriptor size */
|
0x09, /* bLength: Configuation Descriptor size */
|
||||||
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
|
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
|
||||||
CUSTOMHID_SIZ_CONFIG_DESC,
|
PIOS_HID_SIZ_CONFIG_DESC,
|
||||||
/* wTotalLength: Bytes returned */
|
/* wTotalLength: Bytes returned */
|
||||||
0x00,
|
0x00,
|
||||||
0x01, /* bNumInterfaces: 1 interface */
|
0x01, /* bNumInterfaces: 1 interface */
|
||||||
@ -89,7 +90,7 @@ const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] =
|
|||||||
0x00, /* bCountryCode: Hardware target country */
|
0x00, /* bCountryCode: Hardware target country */
|
||||||
0x01, /* bNumDescriptors: Number of HID class descriptors to follow */
|
0x01, /* bNumDescriptors: Number of HID class descriptors to follow */
|
||||||
0x22, /* bDescriptorType */
|
0x22, /* bDescriptorType */
|
||||||
CUSTOMHID_SIZ_REPORT_DESC,/* wItemLength: Total length of Report descriptor */
|
PIOS_HID_SIZ_REPORT_DESC,/* wItemLength: Total length of Report descriptor */
|
||||||
0x00,
|
0x00,
|
||||||
/******************** Descriptor of Custom HID endpoints ******************/
|
/******************** Descriptor of Custom HID endpoints ******************/
|
||||||
/* 27 */
|
/* 27 */
|
||||||
@ -115,7 +116,7 @@ const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] =
|
|||||||
/* 41 */
|
/* 41 */
|
||||||
}
|
}
|
||||||
; /* CustomHID_ConfigDescriptor */
|
; /* CustomHID_ConfigDescriptor */
|
||||||
const uint8_t CustomHID_ReportDescriptor[CUSTOMHID_SIZ_REPORT_DESC] =
|
const uint8_t PIOS_HID_ReportDescriptor[PIOS_HID_SIZ_REPORT_DESC] =
|
||||||
{
|
{
|
||||||
0x06, 0xFF, 0x00, /* USAGE_PAGE (Vendor Page: 0xFF00) */
|
0x06, 0xFF, 0x00, /* USAGE_PAGE (Vendor Page: 0xFF00) */
|
||||||
0x09, 0x01, /* USAGE (Demo Kit) */
|
0x09, 0x01, /* USAGE (Demo Kit) */
|
||||||
@ -234,36 +235,35 @@ const uint8_t CustomHID_ReportDescriptor[CUSTOMHID_SIZ_REPORT_DESC] =
|
|||||||
}; /* CustomHID_ReportDescriptor */
|
}; /* CustomHID_ReportDescriptor */
|
||||||
|
|
||||||
/* USB String Descriptors (optional) */
|
/* USB String Descriptors (optional) */
|
||||||
const uint8_t CustomHID_StringLangID[CUSTOMHID_SIZ_STRING_LANGID] =
|
const uint8_t PIOS_HID_StringLangID[PIOS_HID_SIZ_STRING_LANGID] =
|
||||||
{
|
{
|
||||||
CUSTOMHID_SIZ_STRING_LANGID,
|
PIOS_HID_SIZ_STRING_LANGID,
|
||||||
USB_STRING_DESCRIPTOR_TYPE,
|
USB_STRING_DESCRIPTOR_TYPE,
|
||||||
0x09,
|
0x09,
|
||||||
0x04
|
0x04
|
||||||
}
|
}
|
||||||
; /* LangID = 0x0409: U.S. English */
|
; /* LangID = 0x0409: U.S. English */
|
||||||
|
|
||||||
const uint8_t CustomHID_StringVendor[CUSTOMHID_SIZ_STRING_VENDOR] =
|
const uint8_t PIOS_HID_StringVendor[PIOS_HID_SIZ_STRING_VENDOR] =
|
||||||
{
|
{
|
||||||
CUSTOMHID_SIZ_STRING_VENDOR, /* Size of Vendor string */
|
PIOS_HID_SIZ_STRING_VENDOR, /* Size of Vendor string */
|
||||||
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType*/
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType*/
|
||||||
/* Manufacturer: "STMicroelectronics" */
|
/* Manufacturer: "STMicroelectronics" */
|
||||||
'S', 0, 'T', 0, 'M', 0, 'i', 0, 'c', 0, 'r', 0, 'o', 0, 'e', 0,
|
'o', 0, 'p', 0, 'e', 0, 'n', 0, 'p', 0, 'i', 0, 'l', 0, 'o', 0,
|
||||||
'l', 0, 'e', 0, 'c', 0, 't', 0, 'r', 0, 'o', 0, 'n', 0, 'i', 0,
|
't', 0, '.', 0, 'o', 0, 'r', 0, 'g', 0
|
||||||
'c', 0, 's', 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t CustomHID_StringProduct[CUSTOMHID_SIZ_STRING_PRODUCT] =
|
const uint8_t PIOS_HID_StringProduct[PIOS_HID_SIZ_STRING_PRODUCT] =
|
||||||
{
|
{
|
||||||
CUSTOMHID_SIZ_STRING_PRODUCT, /* bLength */
|
PIOS_HID_SIZ_STRING_PRODUCT, /* bLength */
|
||||||
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
||||||
'A', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, ' ', 0, 'C', 0,
|
'O', 0, 'p', 0, 'e', 0, 'n', 0, 'P', 0, 'i', 0, 'l', 0,
|
||||||
'u', 0, 's', 0, 't', 0, 'm', 0, ' ', 0, 'H', 0, 'I', 0,
|
'o', 0, 't', 0
|
||||||
'D', 0
|
|
||||||
};
|
};
|
||||||
uint8_t CustomHID_StringSerial[CUSTOMHID_SIZ_STRING_SERIAL] =
|
|
||||||
|
uint8_t PIOS_HID_StringSerial[PIOS_HID_SIZ_STRING_SERIAL] =
|
||||||
{
|
{
|
||||||
CUSTOMHID_SIZ_STRING_SERIAL, /* bLength */
|
PIOS_HID_SIZ_STRING_SERIAL, /* bLength */
|
||||||
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
||||||
'S', 0, 'T', 0, 'M', 0,'3', 0,'2', 0, '1', 0, '0', 0
|
'S', 0, 'T', 0, 'M', 0,'3', 0,'2', 0, '1', 0, '0', 0
|
||||||
};
|
};
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "usb_lib.h"
|
#include "usb_lib.h"
|
||||||
#include "pios_usb_pwr.h"
|
#include "pios_usb_hid_pwr.h"
|
||||||
#include "pios_usb_istr.h"
|
#include "pios_usb_hid_istr.h"
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
#include "usb_lib.h"
|
#include "usb_lib.h"
|
||||||
#include "usb_conf.h"
|
#include "usb_conf.h"
|
||||||
#include "pios_usb_prop.h"
|
#include "pios_usb_hid_prop.h"
|
||||||
#include "pios_usb_desc.h"
|
#include "pios_usb_hid_desc.h"
|
||||||
#include "pios_usb_pwr.h"
|
#include "pios_usb_hid_pwr.h"
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
@ -68,34 +68,34 @@ USER_STANDARD_REQUESTS User_Standard_Requests =
|
|||||||
|
|
||||||
ONE_DESCRIPTOR Device_Descriptor =
|
ONE_DESCRIPTOR Device_Descriptor =
|
||||||
{
|
{
|
||||||
(uint8_t*)CustomHID_DeviceDescriptor,
|
(uint8_t*)PIOS_HID_DeviceDescriptor,
|
||||||
CUSTOMHID_SIZ_DEVICE_DESC
|
PIOS_HID_SIZ_DEVICE_DESC
|
||||||
};
|
};
|
||||||
|
|
||||||
ONE_DESCRIPTOR Config_Descriptor =
|
ONE_DESCRIPTOR Config_Descriptor =
|
||||||
{
|
{
|
||||||
(uint8_t*)CustomHID_ConfigDescriptor,
|
(uint8_t*)PIOS_HID_ConfigDescriptor,
|
||||||
CUSTOMHID_SIZ_CONFIG_DESC
|
PIOS_HID_SIZ_CONFIG_DESC
|
||||||
};
|
};
|
||||||
|
|
||||||
ONE_DESCRIPTOR CustomHID_Report_Descriptor =
|
ONE_DESCRIPTOR PIOS_HID_Report_Descriptor =
|
||||||
{
|
{
|
||||||
(uint8_t *)CustomHID_ReportDescriptor,
|
(uint8_t *)PIOS_HID_ReportDescriptor,
|
||||||
CUSTOMHID_SIZ_REPORT_DESC
|
PIOS_HID_SIZ_REPORT_DESC
|
||||||
};
|
};
|
||||||
|
|
||||||
ONE_DESCRIPTOR CustomHID_Hid_Descriptor =
|
ONE_DESCRIPTOR PIOS_HID_Hid_Descriptor =
|
||||||
{
|
{
|
||||||
(uint8_t*)CustomHID_ConfigDescriptor + CUSTOMHID_OFF_HID_DESC,
|
(uint8_t*)PIOS_HID_ConfigDescriptor + PIOS_HID_OFF_HID_DESC,
|
||||||
CUSTOMHID_SIZ_HID_DESC
|
PIOS_HID_SIZ_HID_DESC
|
||||||
};
|
};
|
||||||
|
|
||||||
ONE_DESCRIPTOR String_Descriptor[4] =
|
ONE_DESCRIPTOR String_Descriptor[4] =
|
||||||
{
|
{
|
||||||
{(uint8_t*)CustomHID_StringLangID, CUSTOMHID_SIZ_STRING_LANGID},
|
{(uint8_t*)PIOS_HID_StringLangID, PIOS_HID_SIZ_STRING_LANGID},
|
||||||
{(uint8_t*)CustomHID_StringVendor, CUSTOMHID_SIZ_STRING_VENDOR},
|
{(uint8_t*)PIOS_HID_StringVendor, PIOS_HID_SIZ_STRING_VENDOR},
|
||||||
{(uint8_t*)CustomHID_StringProduct, CUSTOMHID_SIZ_STRING_PRODUCT},
|
{(uint8_t*)PIOS_HID_StringProduct, PIOS_HID_SIZ_STRING_PRODUCT},
|
||||||
{(uint8_t*)CustomHID_StringSerial, CUSTOMHID_SIZ_STRING_SERIAL}
|
{(uint8_t*)PIOS_HID_StringSerial, PIOS_HID_SIZ_STRING_SERIAL}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Extern variables ----------------------------------------------------------*/
|
/* Extern variables ----------------------------------------------------------*/
|
||||||
@ -140,7 +140,7 @@ void CustomHID_Reset(void)
|
|||||||
pInformation->Current_Interface = 0;/*the default Interface*/
|
pInformation->Current_Interface = 0;/*the default Interface*/
|
||||||
|
|
||||||
/* Current Feature initialization */
|
/* Current Feature initialization */
|
||||||
pInformation->Current_Feature = CustomHID_ConfigDescriptor[7];
|
pInformation->Current_Feature = PIOS_HID_ConfigDescriptor[7];
|
||||||
|
|
||||||
#ifdef STM32F10X_CL
|
#ifdef STM32F10X_CL
|
||||||
/* EP0 is already configured in DFU_Init() by USB_SIL_Init() function */
|
/* EP0 is already configured in DFU_Init() by USB_SIL_Init() function */
|
||||||
@ -350,7 +350,7 @@ uint8_t *CustomHID_GetStringDescriptor(uint16_t Length)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
uint8_t *CustomHID_GetReportDescriptor(uint16_t Length)
|
uint8_t *CustomHID_GetReportDescriptor(uint16_t Length)
|
||||||
{
|
{
|
||||||
return Standard_GetDescriptorData(Length, &CustomHID_Report_Descriptor);
|
return Standard_GetDescriptorData(Length, &PIOS_HID_Report_Descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -362,7 +362,7 @@ uint8_t *CustomHID_GetReportDescriptor(uint16_t Length)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
uint8_t *CustomHID_GetHIDDescriptor(uint16_t Length)
|
uint8_t *CustomHID_GetHIDDescriptor(uint16_t Length)
|
||||||
{
|
{
|
||||||
return Standard_GetDescriptorData(Length, &CustomHID_Hid_Descriptor);
|
return Standard_GetDescriptorData(Length, &PIOS_HID_Hid_Descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
#include "usb_lib.h"
|
#include "usb_lib.h"
|
||||||
#include "usb_conf.h"
|
#include "usb_conf.h"
|
||||||
#include "pios_usb_pwr.h"
|
#include "pios_usb_hid_pwr.h"
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
@ -29,27 +29,27 @@
|
|||||||
#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
|
#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
|
||||||
|
|
||||||
#define HID_DESCRIPTOR_TYPE 0x21
|
#define HID_DESCRIPTOR_TYPE 0x21
|
||||||
#define CUSTOMHID_SIZ_HID_DESC 0x09
|
#define PIOS_HID_SIZ_HID_DESC 0x09
|
||||||
#define CUSTOMHID_OFF_HID_DESC 0x12
|
#define PIOS_HID_OFF_HID_DESC 0x12
|
||||||
|
|
||||||
#define CUSTOMHID_SIZ_DEVICE_DESC 18
|
#define PIOS_HID_SIZ_DEVICE_DESC 18
|
||||||
#define CUSTOMHID_SIZ_CONFIG_DESC 41
|
#define PIOS_HID_SIZ_CONFIG_DESC 41
|
||||||
#define CUSTOMHID_SIZ_REPORT_DESC 163
|
#define PIOS_HID_SIZ_REPORT_DESC 163
|
||||||
#define CUSTOMHID_SIZ_STRING_LANGID 4
|
#define PIOS_HID_SIZ_STRING_LANGID 4
|
||||||
#define CUSTOMHID_SIZ_STRING_VENDOR 38
|
#define PIOS_HID_SIZ_STRING_VENDOR 28
|
||||||
#define CUSTOMHID_SIZ_STRING_PRODUCT 32
|
#define PIOS_HID_SIZ_STRING_PRODUCT 20
|
||||||
#define CUSTOMHID_SIZ_STRING_SERIAL 26
|
#define PIOS_HID_SIZ_STRING_SERIAL 26
|
||||||
|
|
||||||
#define STANDARD_ENDPOINT_DESC_SIZE 0x09
|
#define STANDARD_ENDPOINT_DESC_SIZE 0x09
|
||||||
|
|
||||||
/* Exported functions ------------------------------------------------------- */
|
/* Exported functions ------------------------------------------------------- */
|
||||||
extern const uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ_DEVICE_DESC];
|
extern const uint8_t PIOS_HID_DeviceDescriptor[PIOS_HID_SIZ_DEVICE_DESC];
|
||||||
extern const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC];
|
extern const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC];
|
||||||
extern const uint8_t CustomHID_ReportDescriptor[CUSTOMHID_SIZ_REPORT_DESC];
|
extern const uint8_t PIOS_HID_ReportDescriptor[PIOS_HID_SIZ_REPORT_DESC];
|
||||||
extern const uint8_t CustomHID_StringLangID[CUSTOMHID_SIZ_STRING_LANGID];
|
extern const uint8_t PIOS_HID_StringLangID[PIOS_HID_SIZ_STRING_LANGID];
|
||||||
extern const uint8_t CustomHID_StringVendor[CUSTOMHID_SIZ_STRING_VENDOR];
|
extern const uint8_t PIOS_HID_StringVendor[PIOS_HID_SIZ_STRING_VENDOR];
|
||||||
extern const uint8_t CustomHID_StringProduct[CUSTOMHID_SIZ_STRING_PRODUCT];
|
extern const uint8_t PIOS_HID_StringProduct[PIOS_HID_SIZ_STRING_PRODUCT];
|
||||||
extern uint8_t CustomHID_StringSerial[CUSTOMHID_SIZ_STRING_SERIAL];
|
extern uint8_t PIOS_HID_StringSerial[PIOS_HID_SIZ_STRING_SERIAL];
|
||||||
|
|
||||||
#endif /* __USB_DESC_H */
|
#endif /* __USB_DESC_H */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user