embassy icon indicating copy to clipboard operation
embassy copied to clipboard

small tweak for USB HID reader

Open robamu opened this issue 3 months ago • 2 comments

Allows running from a mutable reference, which was useful for stuffing the reader into local RTICv2 resources. I could not send it to a task by value because the reader is not sendable.

robamu avatar Nov 19 '25 15:11 robamu

this is a limitation in RTIC that doesn't affect embassy-executor. RTIC folks are working on it, see https://github.com/rtic-rs/rtic/pull/1116 https://github.com/rtic-rs/rtic/pull/1108

We shouldn't add workarounds in the public API for this limitation. The problem with allowing &mut is you can cancel the runner then restart it, which can break it if you do it halfway through a transfer.

Dirbaio avatar Nov 19 '25 16:11 Dirbaio

Oh, that is good to know. I have not thought of this case. So this becomes potentially problematic if you just save the future, drop it and then re-run the run method?

Just out of curiosity: Is this not problematic for all runners with the run(&mut self) -> ! style that already exist, or are those runners specifically designed to allow this? I have seen several of those in the code base.

robamu avatar Nov 19 '25 22:11 robamu