Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_Usb_JoyMouse Nucleo_usbmouse ELEC350_1-referral-2018-usb-hid USBJoystick_HelloWorld2_wip ... more
This library contains all mbed usb device library (mbed-os\features\unsupported\USBDevice).
Revision 4:50ec00aa4515, committed 2017-03-28
- Comitter:
- frq08711@LMECWL0871.LME.ST.COM
- Date:
- Tue Mar 28 11:00:57 2017 +0200
- Branch:
- master
- Parent:
- 3:d9c7334e2183
- Commit message:
- update for 5.4.2
Changed in this revision
--- a/USBAudio/USBAudio.cpp Wed Feb 15 09:48:15 2017 +0100
+++ b/USBAudio/USBAudio.cpp Tue Mar 28 11:00:57 2017 +0200
@@ -113,9 +113,13 @@
return true;
}
-void USBAudio::writeSync(uint8_t *buf)
+void USBAudio::writeSync(uint8_t *buf, AudioSampleCorrectType jitter_nb)
{
- USBDevice::writeNB(EPISO_IN, buf, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
+ if ((jitter_nb != RemoveOneSample) && (jitter_nb != AddOneSample)) {
+ jitter_nb = NoCorrection;
+ }
+ /* each sample is 2 bytes */
+ USBDevice::writeNB(EPISO_IN, buf, PACKET_SIZE_ISO_OUT + jitter_nb *(this->channel_nb_out*2), PACKET_SIZE_ISO_OUT+this->channel_nb_out*2);
}
uint32_t USBAudio::readSync(uint8_t *buf)
@@ -195,7 +199,7 @@
// Configure isochronous endpoint
realiseEndpoint(EPISO_OUT, PACKET_SIZE_ISO_IN, ISOCHRONOUS);
- realiseEndpoint(EPISO_IN, PACKET_SIZE_ISO_OUT, ISOCHRONOUS);
+ realiseEndpoint(EPISO_IN, PACKET_SIZE_ISO_OUT+this->channel_nb_out*2, ISOCHRONOUS);
// activate readings on this endpoint
readStart(EPISO_OUT, PACKET_SIZE_ISO_IN);
@@ -597,8 +601,8 @@
ENDPOINT_DESCRIPTOR, // bDescriptorType
PHY_TO_DESC(EPISO_IN), // bEndpointAddress
E_ISOCHRONOUS, // bmAttributes
- (uint8_t)(LSB(PACKET_SIZE_ISO_OUT)), // wMaxPacketSize
- (uint8_t)(MSB(PACKET_SIZE_ISO_OUT)), // wMaxPacketSize
+ (uint8_t)(LSB(PACKET_SIZE_ISO_OUT+channel_nb_out*2)), // wMaxPacketSize
+ (uint8_t)(MSB(PACKET_SIZE_ISO_OUT+channel_nb_out*2)), // wMaxPacketSize
0x01, // bInterval
0x00, // bRefresh
0x00, // bSynchAddress
--- a/USBAudio/USBAudio.h Wed Feb 15 09:48:15 2017 +0100
+++ b/USBAudio/USBAudio.h Tue Mar 28 11:00:57 2017 +0200
@@ -123,11 +123,18 @@
*/
bool write(uint8_t * buf);
+ /** Audio Jitter value*/
+ enum AudioSampleCorrectType {
+ RemoveOneSample = -1,
+ NoCorrection = 0,
+ AddOneSample = 1
+ };
/**
* Write packet in endpoint fifo. assuming tx fifo is empty
* @param buf pointer on the audio packet which will be sent
- */
- void writeSync(uint8_t *buf);
+ * @param jitter_nb : AudioSampleCorrecttype
+ **/
+ void writeSync(uint8_t *buf, AudioSampleCorrectType jitter_nb = NoCorrection );
/**
* Write and read an audio packet at the same time (on the same frame)
--- a/USBDevice/TARGET_STM/USBHAL_STM32F303ZE.h Wed Feb 15 09:48:15 2017 +0100
+++ b/USBDevice/TARGET_STM/USBHAL_STM32F303ZE.h Tue Mar 28 11:00:57 2017 +0200
@@ -61,7 +61,6 @@
USBHAL *obj= priv->inst;
uint32_t sofnum = (hpcd->Instance->FNR) & USB_FNR_FN;
void (USBHAL::*func)(int frame) = priv->sof;
- /* fix me call with same frame number */
(obj->*func)(sofnum);
}
@@ -112,16 +111,15 @@
__HAL_RCC_SYSCFG_CLK_ENABLE();
hpcd.State = HAL_PCD_STATE_RESET;
HAL_PCD_Init(&hpcd);
- /* hardcoded size of FIFO according definition*/
- HAL_PCDEx_PMAConfig(&hpcd , 0x00 , PCD_SNG_BUF, 0x30);
- HAL_PCDEx_PMAConfig(&hpcd , 0x80 , PCD_SNG_BUF, 0x70);
-#if 1
- HAL_PCDEx_PMAConfig(&hpcd , 0x3, PCD_DBL_BUF, 0x018000b0);
-#else
- HAL_PCDEx_PMAConfig(&hpcd , 0x3, PCD_SNG_BUF, 0x180);
-#endif
- HAL_PCDEx_PMAConfig(&hpcd , 0x83, PCD_SNG_BUF, 0xb0);
- NVIC_SetVector(USBHAL_IRQn,(uint32_t)&_usbisr);
+ /* hardcoded size of FIFO according definition */
+ HAL_PCDEx_PMAConfig(&hpcd , 0x00, PCD_SNG_BUF, 0x30);
+ HAL_PCDEx_PMAConfig(&hpcd , 0x80, PCD_SNG_BUF, 0x70);
+ HAL_PCDEx_PMAConfig(&hpcd , 0x01, PCD_SNG_BUF, 0x90);
+ HAL_PCDEx_PMAConfig(&hpcd , 0x81, PCD_SNG_BUF, 0xb0);
+ HAL_PCDEx_PMAConfig(&hpcd , 0x02, PCD_SNG_BUF, 0x100);
+ HAL_PCDEx_PMAConfig(&hpcd , 0x82, PCD_SNG_BUF, 0x120);
+
+ NVIC_SetVector(USBHAL_IRQn,(uint32_t)&_usbisr);
NVIC_SetPriority(USBHAL_IRQn, 1);
HAL_PCD_Start(&hpcd);
}
--- a/USBDevice/TARGET_STM/USBHAL_STM32L476VG.h Wed Feb 15 09:48:15 2017 +0100
+++ b/USBDevice/TARGET_STM/USBHAL_STM32L476VG.h Tue Mar 28 11:00:57 2017 +0200
@@ -131,7 +131,7 @@
/* bulk/int 64 bytes in FS */
HAL_PCDEx_SetTxFiFo(&hpcd, 0, (MAX_PACKET_SIZE_EP0/4)+1);
/* bulk/int bytes in FS */
- HAL_PCDEx_SetTxFiFo(&hpcd, 1, (MAX_PACKET_SIZE_EP1/4));
+ HAL_PCDEx_SetTxFiFo(&hpcd, 1, (MAX_PACKET_SIZE_EP1/4)+1);
HAL_PCDEx_SetTxFiFo(&hpcd, 2, (MAX_PACKET_SIZE_EP2/4));
/* ISOchronous */
HAL_PCDEx_SetTxFiFo(&hpcd, 3, (MAX_PACKET_SIZE_EP3/4));
--- a/USBDevice/TARGET_STM/USBHAL_STM_144_64pins.h Wed Feb 15 09:48:15 2017 +0100
+++ b/USBDevice/TARGET_STM/USBHAL_STM_144_64pins.h Tue Mar 28 11:00:57 2017 +0200
@@ -121,7 +121,7 @@
/* bulk/int 64 bytes in FS */
HAL_PCDEx_SetTxFiFo(&hpcd, 0, (MAX_PACKET_SIZE_EP0/4)+1);
/* bulk/int bytes in FS */
- HAL_PCDEx_SetTxFiFo(&hpcd, 1, (MAX_PACKET_SIZE_EP1/4));
+ HAL_PCDEx_SetTxFiFo(&hpcd, 1, (MAX_PACKET_SIZE_EP1/4)+1);
HAL_PCDEx_SetTxFiFo(&hpcd, 2, (MAX_PACKET_SIZE_EP2/4));
/* ISOchronous */
HAL_PCDEx_SetTxFiFo(&hpcd, 3, (MAX_PACKET_SIZE_EP3/4));
--- a/USBDevice/USBHAL.h Wed Feb 15 09:48:15 2017 +0100 +++ b/USBDevice/USBHAL.h Tue Mar 28 11:00:57 2017 +0200 @@ -21,7 +21,7 @@ #include "mbed.h" #include "USBEndpoints.h" -#include "toolchain.h" +#include "mbed_toolchain.h" //#ifdef __GNUC__ //#define __packed __attribute__ ((__packed__))
--- a/USBHID/USBHID.cpp Wed Feb 15 09:48:15 2017 +0100
+++ b/USBHID/USBHID.cpp Tue Mar 28 11:00:57 2017 +0200
@@ -199,20 +199,23 @@
uint8_t * USBHID::reportDesc() {
static uint8_t reportDescriptor[] = {
- 0x06, LSB(0xFFAB), MSB(0xFFAB),
- 0x0A, LSB(0x0200), MSB(0x0200),
- 0xA1, 0x01, // Collection 0x01
- 0x75, 0x08, // report size = 8 bits
- 0x15, 0x00, // logical minimum = 0
- 0x26, 0xFF, 0x00, // logical maximum = 255
- 0x95, input_length, // report count
- 0x09, 0x01, // usage
- 0x81, 0x02, // Input (array)
- 0x95, output_length,// report count
- 0x09, 0x02, // usage
- 0x91, 0x02, // Output (array)
- 0xC0 // end collection
+ USAGE_PAGE(2), LSB(0xFFAB), MSB(0xFFAB),
+ USAGE(2), LSB(0x0200), MSB(0x0200),
+ COLLECTION(1), 0x01, // Collection (Application)
+
+ REPORT_SIZE(1), 0x08, // 8 bits
+ LOGICAL_MINIMUM(1), 0x00,
+ LOGICAL_MAXIMUM(1), 0xFF,
+ REPORT_COUNT(1), input_length,
+ USAGE(1), 0x01,
+ INPUT(1), 0x02, // Data, Var, Abs
+
+ REPORT_COUNT(1), output_length,
+ USAGE(1), 0x02,
+ OUTPUT(1), 0x02, // Data, Var, Abs
+
+ END_COLLECTION(0),
};
reportLength = sizeof(reportDescriptor);
return reportDescriptor;
@@ -226,51 +229,51 @@
uint8_t * USBHID::configurationDesc() {
static uint8_t configurationDescriptor[] = {
- CONFIGURATION_DESCRIPTOR_LENGTH,// bLength
- CONFIGURATION_DESCRIPTOR, // bDescriptorType
- LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
- MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
- 0x01, // bNumInterfaces
- DEFAULT_CONFIGURATION, // bConfigurationValue
- 0x00, // iConfiguration
- C_RESERVED | C_SELF_POWERED, // bmAttributes
- C_POWER(0), // bMaxPower
+ CONFIGURATION_DESCRIPTOR_LENGTH, // bLength
+ CONFIGURATION_DESCRIPTOR, // bDescriptorType
+ LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
+ MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
+ 0x01, // bNumInterfaces
+ DEFAULT_CONFIGURATION, // bConfigurationValue
+ 0x00, // iConfiguration
+ C_RESERVED | C_SELF_POWERED, // bmAttributes
+ C_POWER(0), // bMaxPower
- INTERFACE_DESCRIPTOR_LENGTH, // bLength
- INTERFACE_DESCRIPTOR, // bDescriptorType
- 0x00, // bInterfaceNumber
- 0x00, // bAlternateSetting
- 0x02, // bNumEndpoints
- HID_CLASS, // bInterfaceClass
- HID_SUBCLASS_NONE, // bInterfaceSubClass
- HID_PROTOCOL_NONE, // bInterfaceProtocol
- 0x00, // iInterface
+ INTERFACE_DESCRIPTOR_LENGTH, // bLength
+ INTERFACE_DESCRIPTOR, // bDescriptorType
+ 0x00, // bInterfaceNumber
+ 0x00, // bAlternateSetting
+ 0x02, // bNumEndpoints
+ HID_CLASS, // bInterfaceClass
+ HID_SUBCLASS_NONE, // bInterfaceSubClass
+ HID_PROTOCOL_NONE, // bInterfaceProtocol
+ 0x00, // iInterface
- HID_DESCRIPTOR_LENGTH, // bLength
- HID_DESCRIPTOR, // bDescriptorType
- LSB(HID_VERSION_1_11), // bcdHID (LSB)
- MSB(HID_VERSION_1_11), // bcdHID (MSB)
- 0x00, // bCountryCode
- 0x01, // bNumDescriptors
- REPORT_DESCRIPTOR, // bDescriptorType
- (uint8_t)(LSB(this->reportDescLength())), // wDescriptorLength (LSB)
- (uint8_t)(MSB(this->reportDescLength())), // wDescriptorLength (MSB)
+ HID_DESCRIPTOR_LENGTH, // bLength
+ HID_DESCRIPTOR, // bDescriptorType
+ LSB(HID_VERSION_1_11), // bcdHID (LSB)
+ MSB(HID_VERSION_1_11), // bcdHID (MSB)
+ 0x00, // bCountryCode
+ 0x01, // bNumDescriptors
+ REPORT_DESCRIPTOR, // bDescriptorType
+ (uint8_t)(LSB(reportDescLength())), // wDescriptorLength (LSB)
+ (uint8_t)(MSB(reportDescLength())), // wDescriptorLength (MSB)
- ENDPOINT_DESCRIPTOR_LENGTH, // bLength
- ENDPOINT_DESCRIPTOR, // bDescriptorType
- PHY_TO_DESC(EPINT_IN), // bEndpointAddress
- E_INTERRUPT, // bmAttributes
- LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
- MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
- 1, // bInterval (milliseconds)
+ ENDPOINT_DESCRIPTOR_LENGTH, // bLength
+ ENDPOINT_DESCRIPTOR, // bDescriptorType
+ PHY_TO_DESC(EPINT_IN), // bEndpointAddress
+ E_INTERRUPT, // bmAttributes
+ LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
+ MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
+ 1, // bInterval (milliseconds)
- ENDPOINT_DESCRIPTOR_LENGTH, // bLength
- ENDPOINT_DESCRIPTOR, // bDescriptorType
- PHY_TO_DESC(EPINT_OUT), // bEndpointAddress
- E_INTERRUPT, // bmAttributes
- LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
- MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
- 1, // bInterval (milliseconds)
+ ENDPOINT_DESCRIPTOR_LENGTH, // bLength
+ ENDPOINT_DESCRIPTOR, // bDescriptorType
+ PHY_TO_DESC(EPINT_OUT), // bEndpointAddress
+ E_INTERRUPT, // bmAttributes
+ LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
+ MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
+ 1, // bInterval (milliseconds)
};
return configurationDescriptor;
}
--- a/USBHID/USBHID_Types.h Wed Feb 15 09:48:15 2017 +0100 +++ b/USBHID/USBHID_Types.h Tue Mar 28 11:00:57 2017 +0200 @@ -25,9 +25,12 @@ #define HID_VERSION_1_11 (0x0111) /* HID Class */ -#define HID_CLASS (3) -#define HID_SUBCLASS_NONE (0) -#define HID_PROTOCOL_NONE (0) +#define HID_CLASS (3) +#define HID_SUBCLASS_NONE (0) +#define HID_SUBCLASS_BOOT (1) +#define HID_PROTOCOL_NONE (0) +#define HID_PROTOCOL_KEYBOARD (1) +#define HID_PROTOCOL_MOUSE (2) /* Descriptors */ #define HID_DESCRIPTOR (33)
--- a/USBHID/USBKeyboard.cpp Wed Feb 15 09:48:15 2017 +0100
+++ b/USBHID/USBKeyboard.cpp Tue Mar 28 11:00:57 2017 +0200
@@ -503,51 +503,51 @@
uint8_t * USBKeyboard::configurationDesc() {
static uint8_t configurationDescriptor[] = {
- CONFIGURATION_DESCRIPTOR_LENGTH,// bLength
- CONFIGURATION_DESCRIPTOR, // bDescriptorType
- LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
- MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
- 0x01, // bNumInterfaces
- DEFAULT_CONFIGURATION, // bConfigurationValue
- 0x00, // iConfiguration
- C_RESERVED | C_SELF_POWERED, // bmAttributes
- C_POWER(0), // bMaxPowerHello World from Mbed
+ CONFIGURATION_DESCRIPTOR_LENGTH, // bLength
+ CONFIGURATION_DESCRIPTOR, // bDescriptorType
+ LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
+ MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
+ 0x01, // bNumInterfaces
+ DEFAULT_CONFIGURATION, // bConfigurationValue
+ 0x00, // iConfiguration
+ C_RESERVED | C_SELF_POWERED, // bmAttributes
+ C_POWER(0), // bMaxPower
- INTERFACE_DESCRIPTOR_LENGTH, // bLength
- INTERFACE_DESCRIPTOR, // bDescriptorType
- 0x00, // bInterfaceNumber
- 0x00, // bAlternateSetting
- 0x02, // bNumEndpoints
- HID_CLASS, // bInterfaceClass
- 1, // bInterfaceSubClass
- 1, // bInterfaceProtocol (keyboard)
- 0x00, // iInterface
+ INTERFACE_DESCRIPTOR_LENGTH, // bLength
+ INTERFACE_DESCRIPTOR, // bDescriptorType
+ 0x00, // bInterfaceNumber
+ 0x00, // bAlternateSetting
+ 0x02, // bNumEndpoints
+ HID_CLASS, // bInterfaceClass
+ HID_SUBCLASS_BOOT, // bInterfaceSubClass
+ HID_PROTOCOL_KEYBOARD, // bInterfaceProtocol
+ 0x00, // iInterface
- HID_DESCRIPTOR_LENGTH, // bLength
- HID_DESCRIPTOR, // bDescriptorType
- LSB(HID_VERSION_1_11), // bcdHID (LSB)
- MSB(HID_VERSION_1_11), // bcdHID (MSB)
- 0x00, // bCountryCode
- 0x01, // bNumDescriptors
- REPORT_DESCRIPTOR, // bDescriptorType
- (uint8_t)(LSB(reportDescLength())), // wDescriptorLength (LSB)
- (uint8_t)(MSB(reportDescLength())), // wDescriptorLength (MSB)
+ HID_DESCRIPTOR_LENGTH, // bLength
+ HID_DESCRIPTOR, // bDescriptorType
+ LSB(HID_VERSION_1_11), // bcdHID (LSB)
+ MSB(HID_VERSION_1_11), // bcdHID (MSB)
+ 0x00, // bCountryCode
+ 0x01, // bNumDescriptors
+ REPORT_DESCRIPTOR, // bDescriptorType
+ (uint8_t)(LSB(reportDescLength())), // wDescriptorLength (LSB)
+ (uint8_t)(MSB(reportDescLength())), // wDescriptorLength (MSB)
- ENDPOINT_DESCRIPTOR_LENGTH, // bLength
- ENDPOINT_DESCRIPTOR, // bDescriptorType
- PHY_TO_DESC(EPINT_IN), // bEndpointAddress
- E_INTERRUPT, // bmAttributes
- LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
- MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
- 1, // bInterval (milliseconds)
+ ENDPOINT_DESCRIPTOR_LENGTH, // bLength
+ ENDPOINT_DESCRIPTOR, // bDescriptorType
+ PHY_TO_DESC(EPINT_IN), // bEndpointAddress
+ E_INTERRUPT, // bmAttributes
+ LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
+ MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
+ 1, // bInterval (milliseconds)
- ENDPOINT_DESCRIPTOR_LENGTH, // bLength
- ENDPOINT_DESCRIPTOR, // bDescriptorType
- PHY_TO_DESC(EPINT_OUT), // bEndpointAddress
- E_INTERRUPT, // bmAttributes
- LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
- MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
- 1, // bInterval (milliseconds)
+ ENDPOINT_DESCRIPTOR_LENGTH, // bLength
+ ENDPOINT_DESCRIPTOR, // bDescriptorType
+ PHY_TO_DESC(EPINT_OUT), // bEndpointAddress
+ E_INTERRUPT, // bmAttributes
+ LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
+ MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
+ 1, // bInterval (milliseconds)
};
return configurationDescriptor;
}
--- a/USBHID/USBMouse.cpp Wed Feb 15 09:48:15 2017 +0100
+++ b/USBHID/USBMouse.cpp Tue Mar 28 11:00:57 2017 +0200
@@ -142,7 +142,6 @@
return reportDescriptor;
} else if (mouse_type == ABS_MOUSE) {
static uint8_t reportDescriptor[] = {
-
USAGE_PAGE(1), 0x01, // Generic Desktop
USAGE(1), 0x02, // Mouse
COLLECTION(1), 0x01, // Application
@@ -195,51 +194,51 @@
uint8_t * USBMouse::configurationDesc() {
static uint8_t configurationDescriptor[] = {
- CONFIGURATION_DESCRIPTOR_LENGTH,// bLength
- CONFIGURATION_DESCRIPTOR, // bDescriptorType
- LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
- MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
- 0x01, // bNumInterfaces
- DEFAULT_CONFIGURATION, // bConfigurationValue
- 0x00, // iConfiguration
- C_RESERVED | C_SELF_POWERED, // bmAttributes
- C_POWER(0), // bMaxPowerHello World from Mbed
+ CONFIGURATION_DESCRIPTOR_LENGTH, // bLength
+ CONFIGURATION_DESCRIPTOR, // bDescriptorType
+ LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
+ MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
+ 0x01, // bNumInterfaces
+ DEFAULT_CONFIGURATION, // bConfigurationValue
+ 0x00, // iConfiguration
+ C_RESERVED | C_SELF_POWERED, // bmAttributes
+ C_POWER(0), // bMaxPower
- INTERFACE_DESCRIPTOR_LENGTH, // bLength
- INTERFACE_DESCRIPTOR, // bDescriptorType
- 0x00, // bInterfaceNumber
- 0x00, // bAlternateSetting
- 0x02, // bNumEndpoints
- HID_CLASS, // bInterfaceClass
- 1, // bInterfaceSubClass
- 2, // bInterfaceProtocol (mouse)
- 0x00, // iInterface
+ INTERFACE_DESCRIPTOR_LENGTH, // bLength
+ INTERFACE_DESCRIPTOR, // bDescriptorType
+ 0x00, // bInterfaceNumber
+ 0x00, // bAlternateSetting
+ 0x02, // bNumEndpoints
+ HID_CLASS, // bInterfaceClass
+ HID_SUBCLASS_BOOT, // bInterfaceSubClass
+ HID_PROTOCOL_MOUSE, // bInterfaceProtocol
+ 0x00, // iInterface
- HID_DESCRIPTOR_LENGTH, // bLength
- HID_DESCRIPTOR, // bDescriptorType
- LSB(HID_VERSION_1_11), // bcdHID (LSB)
- MSB(HID_VERSION_1_11), // bcdHID (MSB)
- 0x00, // bCountryCode
- 0x01, // bNumDescriptors
- REPORT_DESCRIPTOR, // bDescriptorType
- (uint8_t)(LSB(reportDescLength())), // wDescriptorLength (LSB)
- (uint8_t)(MSB(reportDescLength())), // wDescriptorLength (MSB)
+ HID_DESCRIPTOR_LENGTH, // bLength
+ HID_DESCRIPTOR, // bDescriptorType
+ LSB(HID_VERSION_1_11), // bcdHID (LSB)
+ MSB(HID_VERSION_1_11), // bcdHID (MSB)
+ 0x00, // bCountryCode
+ 0x01, // bNumDescriptors
+ REPORT_DESCRIPTOR, // bDescriptorType
+ (uint8_t)(LSB(reportDescLength())), // wDescriptorLength (LSB)
+ (uint8_t)(MSB(reportDescLength())), // wDescriptorLength (MSB)
- ENDPOINT_DESCRIPTOR_LENGTH, // bLength
- ENDPOINT_DESCRIPTOR, // bDescriptorType
- PHY_TO_DESC(EPINT_IN), // bEndpointAddress
- E_INTERRUPT, // bmAttributes
- LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
- MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
- 1, // bInterval (milliseconds)
+ ENDPOINT_DESCRIPTOR_LENGTH, // bLength
+ ENDPOINT_DESCRIPTOR, // bDescriptorType
+ PHY_TO_DESC(EPINT_IN), // bEndpointAddress
+ E_INTERRUPT, // bmAttributes
+ LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
+ MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
+ 1, // bInterval (milliseconds)
- ENDPOINT_DESCRIPTOR_LENGTH, // bLength
- ENDPOINT_DESCRIPTOR, // bDescriptorType
- PHY_TO_DESC(EPINT_OUT), // bEndpointAddress
- E_INTERRUPT, // bmAttributes
- LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
- MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
- 1, // bInterval (milliseconds)
+ ENDPOINT_DESCRIPTOR_LENGTH, // bLength
+ ENDPOINT_DESCRIPTOR, // bDescriptorType
+ PHY_TO_DESC(EPINT_OUT), // bEndpointAddress
+ E_INTERRUPT, // bmAttributes
+ LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
+ MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
+ 1, // bInterval (milliseconds)
};
return configurationDescriptor;
}