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

Waveform generation trait #43

Open
Kixunil opened this issue Feb 24, 2018 · 0 comments
Open

Waveform generation trait #43

Kixunil opened this issue Feb 24, 2018 · 0 comments

Comments

@Kixunil
Copy link

Kixunil commented Feb 24, 2018

I'd like to propose a waveform generation trait. This would be useful for efficient bitbanging, PWM, etc.

I will begin with simple sketch and we will see where it will lead.

pub struct Microseconds(/*What should go here? Maybe `pub u32` is fine?*/);

pub enum PinState {
    High,
    Low,
}

pub trait WaveGen {
    fn generate<I: Clone + IntoIterator<Item=Microseconds>>(&mut self, pin: Pin, initial_state: PinState, delays: I, repeat_count: u32);
}

The implementor should set the pin into state defined by initial_state, then wait for duration specified by item from delays and toggle the pin after each item.

I'd love to implement some drivers for wireless sockets I have.

peckpeck pushed a commit to peckpeck/embedded-hal that referenced this issue Nov 10, 2022
50: Embedded hal 1.0.0 alpha.3 r=ryankurte a=eldruin

Builds on and superseeds rust-embedded#43 and rust-embedded#48.

Co-authored-by: Diego Barrios Romero <[email protected]>
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