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

Use embedded-hal as HAL #35

Open
f-bro opened this issue Jun 16, 2017 · 1 comment
Open

Use embedded-hal as HAL #35

f-bro opened this issue Jun 16, 2017 · 1 comment

Comments

@f-bro
Copy link
Member

f-bro commented Jun 16, 2017

We could use https://github.com/japaric/embedded-hal for our hal implementation.

The problem is that the functions of the traits only get &self and not &mut self. I think it makes more sense to use &mut self, because you "change" the timer when you call pause()...
For example:

pub trait Timer {
    /// A time unit that can be converted into a human time unit (e.g. seconds)
    type Time;

    /// Returns the current timeout
    fn get_timeout(&self) -> Self::Time;

    /// Pauses the timer
    fn pause(&self);

    /// Restarts the timer count to zero
    fn restart(&self);

    /// Resumes the timer count
    fn resume(&self);

    /// Sets a new timeout
    fn set_timeout<T>(&self, timeout: T)
    where
        T: Into<Self::Time>;

    /// "Waits" until the timer times out
    fn wait(&self) -> nb::Result<(), !>;
}
@f-bro
Copy link
Member Author

f-bro commented Jun 21, 2017

I added a PR to fix the &mut self problem: rust-embedded/embedded-hal#16

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

1 participant