diff options
author | Damien George <damien.p.george@gmail.com> | 2015-04-13 16:59:05 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-04-13 16:59:05 +0100 |
commit | b1f68685ec462bcde572455c262cb78a53112816 (patch) | |
tree | 9f320ba8e128e1888dcf68a049b52791b31ad0df /stmhal/usbdev/class | |
parent | 99f718407336bf2bd1c07035399e9809f72d4586 (diff) | |
download | micropython-b1f68685ec462bcde572455c262cb78a53112816.tar.gz micropython-b1f68685ec462bcde572455c262cb78a53112816.zip |
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.
Diffstat (limited to 'stmhal/usbdev/class')
-rw-r--r-- | stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h | 1 | ||||
-rw-r--r-- | stmhal/usbdev/class/src/usbd_cdc_msc_hid.c | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h index 7bf2cf955d..bc9d0d21a6 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 8af2124dc0..bbb666861b 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; } |