Skip to content

Commit cc864f4

Browse files
committed
usb hid: Call machine.idle() instead of sleeping 50ms for timeouts.
50ms can be a lot of HID transfers! Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 0696abd commit cc864f4

File tree

1 file changed

+2
-1
lines changed
  • micropython/usb/usb-device-hid/usb/device

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#
66
# MIT license; Copyright (c) 2023 Angus Gratton
77
from micropython import const
8+
import machine
89
import struct
910
import time
1011
from .impl import Interface, Descriptor, split_bmRequestType
@@ -118,7 +119,7 @@ def send_report(self, report_data, timeout_ms=100):
118119
while self.busy():
119120
if time.ticks_diff(deadline, time.ticks_ms()) <= 0:
120121
return False
121-
time.sleep_ms(50)
122+
machine.idle()
122123
if not self.is_open():
123124
return False
124125
self.submit_xfer(self._int_ep, report_data)

0 commit comments

Comments
 (0)