rtic
rtic copied to clipboard
Relax spawn_after parameter
With RTIC 1.0 if you use embedded_time
on your Monotonic
impl any call to task::spawn_after(...)
has to put a .into()
after the time type.
task::spawn_after(Milliseconds(250).into())
This is because the implementation of Monotonic
requires using embedded_time::duration::Generic
for the Duration
associated type. This PR changes the bounds on the spawn_after
function to take any type that can be converted into the target duration type. Removing the need to type all the into()
s.
There are some backward-compatibility concerns since any code that previously used .into() will now fail the type inference. I'm also not sure how this affects the type inference for any Monotonic
using fugit
since I don't have a firmware repo to test with that.
This seems fine to me. But it would be good to check if this had any negative effects such as increased size when the concrete type is not available anymore and must go through a trait. Both for embedded time and fugit.
Also, could you add a changelog line so it passes CI?
Sure thing! I've pushed the update.
Was there any size increase when using embedded time or fugit in this way?
Ping @ZoeyR
fugit will not work with Into