EmbeddedNim / picostdlib

Nim wrapper for the raspberry pi stdlib
MIT License
70 stars 11 forks source link

Get TinyUSB (hid and cdc devices) working #38

Closed auxym closed 2 years ago

auxym commented 2 years ago

Just wanted to mention that I'm working on this, so effort doesn't get duplicated too much.

WIP is here: https://github.com/auxym/picostdlib/blob/tinyusb/src/picostdlib/tusb.nim

I don't currently plan to work on other device classes (MSC, midi, audio, etc) or USB host.

auxym commented 2 years ago

So, I have HID and CDC working nicely, I even think the code is looking not too bad.

I looked at implementing usb_descriptors.c and it's just too macro-heavy, would have to be re-written from scratch as Nim macros, I'll leave that to someone better than me at macros (hm). tusb_config.h is a bunch of #defines that set options for tinyusb. Eventually I guess we could generate this from nim using templating (strformat or nimja etc), but for now I plan to leave these two files in C. They are "config" and don't implement any app logic.

So, my plan for now is clean-up an example and add docstrings where it makes sense, then submit a PR.