You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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