Help with HID library #13068
-
I apologize if this is the wrong place, but my question spans a couple of the categories, so I thought this was the most relevant. I am building a keyboard with a Pi Pico and am trying to use the usb_hid library. I was originally using circuitpython, but some of my hardware uses micropython's machine library. The HID library in micropython doesn't seem to have all the features I need. I found that with circuitpython's Blinka, I am able to get usb_hid in micropython, but several dependencies are causing problems (atexit, typing, stat, fnmatch, etc). I would appreciate help either getting the libraries I need into my micropython lib or getting machine to work with circuitpython. Thanks. I am using micropython 1.21 and circuitpython 8.2.7. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
(CircuitPython core developer here). What are you using |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response! The other thing I was interested in with micropython was precompiling for speed since key presses were sometimes missed when I was using CircuitPython. If that can be done with CircuitPython, then we can move this to the CircuitPython area as you suggested. |
Beta Was this translation helpful? Give feedback.
I2C and Pin of course have analogues in CircuitPython, so that should be easy. Note that
adafruit_bus_device
manages locking the I2C bus when it's in use. I suggest you look at a CircuitPython library that's similar to the I2C device you have. Or maybe there is already a CircuitPython library. If you're not sure, say what it is.As for keypresses, have you seen
keypad
? https://learn.adafruit.com/key-pad-matrix-scanning-in-circuitpythonWe have
supervisor.ticks_ms()
instead oftime.ticks_ms()
, and we also have theadafruit_ticks
library. Also notekeypad
includes timestamps for each key transition.