embassy
embassy copied to clipboard
stm32/i2cv2: remove blocking loops in async i2c.
Async and blocking currently share some "setup" code. This setup code needs to wait for some things, for example here:
https://github.com/embassy-rs/embassy/blob/a2d4bab2f8a4a9b994bc0289938a9f725950715f/embassy-stm32/src/i2c/v2.rs#L164
This waiting is done blockingly, it should be done asynchronously in async code. This means we can share less code, but that's fine.
Once this is done, async timeouts should be simplified to using with_timeout at the top level, instead of passing a check_timeout closure through everywhere. This will ensure user timeouts also behave nicely when they use with_timeout themselves instead of using the builtin timeouts, or select.
Hi, this sounds very good.
I just wondered why everything is async on Embassy except the I2C :thinking: :man_shrugging:
Similar blocking loops seem to be in v1 (eg for the L1).