Replies: 2 comments
-
I have very similar questions. Looking through the documentation and example code there is no clear instruction on how to interact with endpoints directly. It might also help to look at earlier versions of vendor class implementation https://github.com/hathach/tinyusb/blob/0.16.0/src/class/vendor/vendor_device.c It seems earlier implementations has lower level approach that does not abstract away into streams. |
Beta Was this translation helpful? Give feedback.
-
Here is an example of trimmed vendor_device driver that I tried to implement this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm wondering how to realize the following: I want to create a custom USB device. It needs to be able to inform the host of certain changes via interrupt transfers, so the host won't need to poll. Looking at various sample code (though I haven't been able to find much concerning interrupts), it appears they are oriented around writing to endpoints as if it is a stream/queue and what is written is buffered etc. But I would prefer not buffering as I don't see my use case as being stream-oriented - the state could change in between the host sending interrupt transfers (if the host is slow or there's multiple transfers) and in that case the host doesn't need to see the intermediary updates, and there's no need for the device to buffer them. I would rather just have that my code controls exactly what the host will get when there's a transfer to the interrupt endpoint. How to do that in TinyUSB? Is there a way to either provide a callback (like for contorl transfers) so I can control the response directly? Or a way to not 'add to a buffer' but rather 'set what should the buffer content be now (overriding previous content). More detailed background: What I would like is not a queue but rather that the device has a message box that is queried by thehost, and where there can be 0 or 1 pending messages. If the host asks and there's none it will get a NAK. If it tasks and there's one, it will get that one (and it will expire). From the device perspective, when there's a state update it will either put it in the message box or, if there's a message already, it will be updated with the new information - but the old message will be gone.
Beta Was this translation helpful? Give feedback.
All reactions