dlkj/usbd-human-interface-device

Can I include portions of keyboard_nkro in a showcase example in rp-hal?

Closed this issue · 2 comments

Hi! I was looking to add USB keyboard support to the showcase example for the adafruit macropad BSP, before I discovered you've already done a lot of what I wanted to do in the nkro keyboard example.
Rather than re-implement all of it, mind if I borrow some of this code and provide a link in the header comment crediting you and linking back to the example?

Also: wish I found this example earlier, might have saved me a few hours debugging why the display wasn't working (I was using the wrong driver - very obvious in hindsight).

dlkj commented

Yes, happy for you to use the code from the examples. I also have a set of system by systems demos for the macropad: https://github.com/dlkj/macropad-rust/tree/main/cross/app/src, but they are are bit out of date and I was just still picking up embedded rust at the time I wrote them.

The rotary encoder is also worth implementing as getting that right is non-trivial. You'll probably need to use a timer interrupt... but that will make the example much more complex.

Happy to collaborate on this with you or you can just cc me on the pull request and I'll assign any code you use to rp-hal explicitly so there isn't a risk of tainting the rp-hal project IP.

I also have a set of system by systems demos for the macropad

Oh cool! Looks like I've got some reading to do

that will make the example much more complex

While I am trying to keep the HAL and BSP examples simple where possible, I think we should be willing to accept complexity where necessary.
Rotary encoder driver should probably end up in the BSP itself (either directly or as an external crate dep) so that will eat some of the complexity cost, maybe it won't be too bad.

If it ends up being too much we can settle for simpler functionality and link to external projects like yours instead.
I should probably make a start on an Awesome RP2040 Rust page anyway, as there's a number of nice projects that are better examples of usage for PAC/HAL/BSP crates than I could write.