Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining/Elapsed timer calculation for generic clock #125

Open
marius-meissner opened this issue Feb 24, 2022 · 2 comments
Open

Remaining/Elapsed timer calculation for generic clock #125

marius-meissner opened this issue Feb 24, 2022 · 2 comments

Comments

@marius-meissner
Copy link

marius-meissner commented Feb 24, 2022

The following example is failing by unsatisfied trait bounds:

use embedded_time::{Clock};
use embedded_time::duration::{Microseconds};

fn test<C: Clock>(clock: C)
{
    let duration = Microseconds::new(100);
    let timer = clock.new_timer(duration).start().unwrap();
    timer.remaining();
}

Are there further trait bound required? I tried already some compiler suggestions, without success.
I would be very grateful for a brief hint in the right direction. Maybe this information could help others later on.

Thanks in advance!

Version: v0.12.1 @ rustc 1.60.0-nightly (88fb06a1f 2022-02-05)

@rmja
Copy link

rmja commented Jan 6, 2023

Year, I have the same problem...

@rmja
Copy link

rmja commented Jan 6, 2023

I guess you need:

fn test<C: Clock>(clock: C) where C::T: Into<u32> {
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants