From b1f68685ec462bcde572455c262cb78a53112816 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 13 Apr 2015 16:59:05 +0100 Subject: stmhal: In USB HID driver, make polling interval configurable. When setting usb_mode to "HID", hid config object now has polling-interval (in ms) as the 4th element. It mmust now be a 5-tuple of the form: (subclass, protocol, max_packet_len, polling_interval, report_desc) The mouse and keyboard defaults have polling interval at 8ms. --- stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h | 1 + stmhal/usbdev/class/src/usbd_cdc_msc_hid.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'stmhal/usbdev') diff --git a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h index 7bf2cf955..bc9d0d21a 100644 --- a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h +++ b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h @@ -44,6 +44,7 @@ typedef struct _USBD_HID_ModeInfoTypeDef { uint8_t subclass; // 0=no sub class, 1=boot uint8_t protocol; // 0=none, 1=keyboard, 2=mouse uint8_t max_packet_len; // only support up to 255 + uint8_t polling_interval; // in units of 1ms uint8_t report_desc_len; const uint8_t *report_desc; } USBD_HID_ModeInfoTypeDef; diff --git a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c index 8af2124dc..bbb666861 100644 --- a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c +++ b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c @@ -38,6 +38,7 @@ #define HID_DESC_OFFSET_REPORT_DESC_LEN (16) #define HID_DESC_OFFSET_MAX_PACKET_LO (22) #define HID_DESC_OFFSET_MAX_PACKET_HI (23) +#define HID_DESC_OFFSET_POLLING_INTERVAL (24) #define HID_SUBDESC_LEN (9) #define CDC_IFACE_NUM_ALONE (0) @@ -605,6 +606,7 @@ int USBD_SelectMode(uint32_t mode, USBD_HID_ModeInfoTypeDef *hid_info) { hid_desc[HID_DESC_OFFSET_REPORT_DESC_LEN] = hid_info->report_desc_len; hid_desc[HID_DESC_OFFSET_MAX_PACKET_LO] = hid_info->max_packet_len; hid_desc[HID_DESC_OFFSET_MAX_PACKET_HI] = 0; + hid_desc[HID_DESC_OFFSET_POLLING_INTERVAL] = hid_info->polling_interval; hid_report_desc = hid_info->report_desc; } -- cgit v1.2.3