abcminiuser / lufa

LUFA - the Lightweight USB Framework for AVRs.
http://www.lufa-lib.org
1.04k stars 325 forks source link

WebUSB Demo and BOS Platform support #101

Closed riggs closed 7 years ago

riggs commented 7 years ago

Slightly different approach to WebUSB than https://github.com/abcminiuser/lufa/pull/91 that is more in the style of the rest of LUFA.

Personally, I think it's more readable (and, thus, maintainable) as well, but that just opinion. The tradeoff is a slight memory performance hit (unless someone else wants to figure out which magic combination of pgm_read_byte calls is necessary to deal with memcpy from nested structs in PROGMEM).

I isolated WebUSBDevice.h & BOSDescriptors.h in order to allow them to be baked back into the framework code, though I couldn't figure out how to actually hook them in. Also, there's code in Descriptors.c to generate the return bytes for a BOS request that might make more sense in BOSDescriptors.c (which doesn't exist), but I left it where it is for now because I know that works.

riggs commented 7 years ago

Some further notes: I based the demo on GenericHID, because that's what the device I migrated to WebUSB was based on. Also, I'm creating an library/extension to WebUSB to allow for easy HID device migration (by adding another platform descriptor & WebUSB descriptor), at which point a GenericHID-based demo is appropriate.