I've got the new stack working with the USB_DEVICE_CONFIG_USE_TASK option enabled. My understanding of its operation is this: Set USB_DEVICE_CONFIG_USE_TASK=1 in your USB device configuration to configure the USB stack to use a dedicated task to process USB events. You must create an OS task that calls USB_DeviceKhciTaskFunction() in a loop, and this function blocks indefinitely while waiting for messages from the USB ISR. (This is important in case the user was planning to try to do anything else in that task loop.) The USB stack makes all callbacks from this task.
Is that correct? It'd still be nice to have a little more discussion on the architecture and the flow of messages, but I think this is the essential information I was looking for.
You've also provided an example of one of my most frequent complaints about the documentation:
If USB_DEVICE_CONFIG_USE_TASK is 0 , it means CPU is in interrupted mode when USB Callback is servicing.
I can't imagine how difficult it must be to write technical documentation in a non-native language - I can barely ask for directions in any language other than English - but an experienced tech writer once gave me an easy piece of advice that lots of native speakers overlook: When describing an action, say who does what to whom.
To say "If x is 0, it means..." doesn't say who sets x. The same words could describe a status bit rather than a configuration setting. The phrase "it means" sounds more likely to describe a status than an action. That's why my phrasing was "Set USB_DEVICE_CONFIG_USE_TASK=1 in your USB configuration to...", so the reader knows they're the one who sets it and what the result will be.
I think using active voice and imperative mood ("do this" vs "this is to be done") sounds rude or demanding in some languages, but honestly I'd be fine with the documentation calling me names and mocking my fashion choices as long as the important parts were clear and unambiguous. :smileywink:
Even if there was a community-maintained wiki or something, that might be a start. I'd be happy to share my notes there, where they might do some good for others, rather than complain about it here.
Thanks,
Scott