obdev / v-usb

A Firmware-Only USB implementation for Atmel's AVR Microcontrollers
1.22k stars 244 forks source link

usbFunctionSetup's caller should be able to read out of PROGMEM #10

Closed sowbug closed 7 years ago

sowbug commented 9 years ago

WinUSB and WebUSB requests are likely to be static and thus stored in PROGMEM, but usbFunctionSetup() has no built-in facility for handling responses stored in flash. While it's reasonably straightforward to implement usbFunctionRead() to return data out of flash, it seems like the sort of thing that many developers will eventually write themselves, and everyone's will be approximately the same.

Feature request: make it possible for usbFunctionSetup() to return with usbMsgPtr set to a PROGMEM address, and a global flag somewhere can indicate that it's a flash address, and then usbdrv.c can handle the rest.

starkjohann commented 7 years ago

Added feature. See documentation for usbMsgFlags.

sowbug commented 7 years ago

Awesome, thanks! I'll give it a try in my project (https://github.com/sowbug/weblight).