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

Added the possibility to configure PWM as open drain output #84

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NandoBongers
Copy link
Contributor

No description provided.

src/pwm.rs Outdated
PF9<Alternate<AF3>>,

#[cfg(feature = "pwm-open-drain")]
PA2<AlternateOD<AF9>>,
Copy link
Contributor

@usbalbin usbalbin Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about changing the pin! macro so that we only need to specify pin and alternate function here? The macro would then generate the things both for Alternate and AlternateOD. This would avoid some repetition, not sure if it is worth the extra complexity though. Just a thought :) ...

So instead of having to specify

PA2<Alternate<AF9>>,
PA2<AlternateOD<AF9>>,

, something like this would suffice

 PA2: AF9,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a good suggestion. I will pick this up after the Christmas holidays. Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the pin macro as you suggested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! :)

(BRK2: #[ $( $pmeta:meta )* ] $PINBRK2:ident, $ALTBRK2:ty, $TIMX:ty) => {
$( #[ $pmeta ] )*
impl FaultPins<$TIMX> for $PINBRK2<Alternate<$ALTBRK2>> {
const INPUT: BreakInput = BreakInput::BreakIn;
Copy link
Contributor

@usbalbin usbalbin Jul 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed to

Suggested change
const INPUT: BreakInput = BreakInput::BreakIn;
const INPUT: BreakInput = BreakInput::BreakIn2;

?

@usbalbin
Copy link
Contributor

usbalbin commented Jul 27, 2024

What about going as far as something like this?

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