diff --git a/micropython/usb/usb-device-hid/usb/device/hid.py b/micropython/usb/usb-device-hid/usb/device/hid.py index 07664fb02..78f206978 100644 --- a/micropython/usb/usb-device-hid/usb/device/hid.py +++ b/micropython/usb/usb-device-hid/usb/device/hid.py @@ -64,6 +64,7 @@ def __init__( set_report_buf=None, protocol=_INTERFACE_PROTOCOL_NONE, interface_str=None, + binterval=8, ): # Construct a new HID interface. # @@ -85,12 +86,15 @@ def __init__( # - protocol can be set to a specific value as per HID v1.11 section 4.3 Protocols, p9. # # - interface_str is an optional string descriptor to associate with the HID USB interface. + # + # - binterval this is the polling rate the device will request the host use in milliseconds. super().__init__() self.report_descriptor = report_descriptor self.extra_descriptors = extra_descriptors self._set_report_buf = set_report_buf self.protocol = protocol self.interface_str = interface_str + self.binterval = binterval self._int_ep = None # set during enumeration @@ -150,7 +154,7 @@ def desc_cfg(self, desc, itf_num, ep_num, strs): # Add the typical single USB interrupt endpoint descriptor associated # with a HID interface. self._int_ep = ep_num | _EP_IN_FLAG - desc.endpoint(self._int_ep, "interrupt", 8, 8) + desc.endpoint(self._int_ep, "interrupt", 8, self.binterval) self.idle_rate = 0