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

Add internal_pull_down() method #399

Merged
merged 1 commit into from
Dec 19, 2021
Merged

Conversation

Windfisch
Copy link
Contributor

PR #266 has added a internal_pull_up() function. This PR adds internal_pull_down() for symmetry reasons

@burrbull
Copy link
Contributor

burrbull commented Dec 9, 2021

Change to self also this one then:

pub fn internal_pull_up(&mut self, on: bool) {

Is this relevant to other modes. Alternate<OpenDrain, A> for example?

@Windfisch
Copy link
Contributor Author

Windfisch commented Dec 9, 2021

I have done the opposite, using the pub fn (&mut self, on: bool) -> () signature everywhere, instead of the pointless "taking Self, returning Self", because in no case there was a change in the type state.

One might want to think about whether type-stating this pull-up/down resistor state, but for now, I'd leave it. If we do this, we can easily change it back with only minor modifications needed in user code. Also, no feature I am aware of actually requires the pins in one particular pullup/down state, to typestating it might actually cause more harm than good.

Does that look good to you?

@Windfisch
Copy link
Contributor Author

Windfisch commented Dec 9, 2021

Ignore what I wrote above. I will be doing it the other way round, as originally requested, using the "self-consume and returning Self", because this enables us to do things like

let scl = gpiob
.pb8
.into_alternate()
.internal_pull_up(true)
.set_open_drain();
let sda = gpiob
.pb9
.into_alternate()
.internal_pull_up(true)
.set_open_drain();

@Windfisch Windfisch force-pushed the internal_pull_down branch 2 times, most recently from c1a2528 to 04aa233 Compare December 9, 2021 22:55
@burrbull
Copy link
Contributor

Merge conflict

@Windfisch
Copy link
Contributor Author

fixed (hopefully)

@Windfisch
Copy link
Contributor Author

@burrbull do you have time to review and merge this O:)?

@burrbull
Copy link
Contributor

@burrbull do you have time to review and merge this O:)?

LGTM, but, please rebase and squash instead of merge.

For symmetry with internal_pull_up().
@Windfisch
Copy link
Contributor Author

@burrbull there you go

@burrbull
Copy link
Contributor

bors r+

@bors bors bot merged commit 89e1dd4 into stm32-rs:master Dec 19, 2021
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

Successfully merging this pull request may close these issues.

2 participants