Hacker News new | ask | show | jobs
by stonecharioteer 2217 days ago
Haha that's amazing. What's the latency on this though? I always assumed firmware written in python would be slow for a use case like a keyboard.
1 comments

It is a bit slow. It takes 4 ms to scan the matrix once right now. With some optimizations, it may be faster.
Would Numpy be of use? Haven't looked at the source yet, but for a keyboard, 4 ms per matrix would be noticeably laggy, especially if you add debouncing (is that even a thing in keyboards?)
It's a microcontroller. It has maybe 512k of storage and 128k of memory. The Numpy package probably is ~100Mb

The controller is running CircuitPython which is a fork of MicroPython - a tiny re-implementation Python for microcontrollers.

Valid point! Might still be able to get a speed up if you can write and import your own C code though.
The best usb keyboard should have 1ms latency due to USB HID interrupt interval. 4 ms is not that bad.
Yeah, read it as 4ms per row at first. Should be fine for general use, and rather impressive as is :)
How would 4ms be noticeably laggy?
I read it first as 4ms per row, but yeah 4ms per scan wouldn't be too bad. There is of course additional time taken for communication etc, which might take another 4-10ms, which could make it almost a frame behind. Not terrible still.