Skip to content

Commit 1217358

Browse files
author
kolten
committed
usb-device-hid: enable configuring the bInterval on hid devices.
Signed-off-by: kolten <koltenpearson@fastmail.com>
1 parent c266d30 commit 1217358

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

micropython/bluetooth/aioble/examples/l2cap_file_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
_CONTROL_CHARACTERISTIC_UUID = bluetooth.UUID("0492fcec-7194-11eb-9439-0242ac130003")
3434

3535
# How frequently to send advertising beacons.
36-
_ADV_INTERVAL_MS = 250_000
36+
_ADV_INTERVAL_US = 250_000
3737

3838

3939
_COMMAND_SEND = const(0)
@@ -162,7 +162,7 @@ async def peripheral_task():
162162
while True:
163163
print("Waiting for connection")
164164
connection = await aioble.advertise(
165-
_ADV_INTERVAL_MS,
165+
_ADV_INTERVAL_US,
166166
name="mpy-file",
167167
services=[_FILE_SERVICE_UUID],
168168
)

micropython/usb/usb-device-hid/usb/device/hid.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
set_report_buf=None,
6565
protocol=_INTERFACE_PROTOCOL_NONE,
6666
interface_str=None,
67+
binterval=8,
6768
):
6869
# Construct a new HID interface.
6970
#
@@ -91,6 +92,7 @@ def __init__(
9192
self._set_report_buf = set_report_buf
9293
self.protocol = protocol
9394
self.interface_str = interface_str
95+
self.binterval = binterval
9496

9597
self._int_ep = None # set during enumeration
9698

@@ -150,7 +152,7 @@ def desc_cfg(self, desc, itf_num, ep_num, strs):
150152
# Add the typical single USB interrupt endpoint descriptor associated
151153
# with a HID interface.
152154
self._int_ep = ep_num | _EP_IN_FLAG
153-
desc.endpoint(self._int_ep, "interrupt", 8, 8)
155+
desc.endpoint(self._int_ep, "interrupt", 8, self.binterval)
154156

155157
self.idle_rate = 0
156158

0 commit comments

Comments
 (0)