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

Introduce PinGuard and reconnecting an output signal to a different pin now clears previous connections #3012

Merged
merged 10 commits into from
Jan 23, 2025

Conversation

JurajSadel
Copy link
Contributor

closes #2928

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

Thanks! I have some surface level comments for now, I'll did into the meat a bit shortly.

@JurajSadel JurajSadel marked this pull request as draft January 21, 2025 16:35
crate::into_mapped_ref!(mosi);
mosi.enable_output(false);

self.driver().info.mosi.connect_to(&mut mosi);
self.pins.mosi_pin = OutputConnection::connect_with_guard(mosi, self.driver().info.mosi);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not quite happy that we need to pass in the peripheral signal here. :/ We could do OutputConnection::connect_with_guard(mosi, &mut self.pins.mosi_pin) instead, but whether that's better is another question.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what we can do better here, either we store the signal or the pin directly into State right? Unless I'm missing something (which is likely).

If it's a case of storing the pin or signal, imo storing the signal is fine here.

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't want to store anything in State, since we don't drop State 😅 My issue is just that we have to pass the signal, which comes with a possibility of passing in the wrong signal. It's not a big deal I guess.

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's on us to pass the right signal, as long as a user can't mess this up we can make this nicer for us later.

@bugadani
Copy link
Contributor

Funnily enough, the failed test or the original push demonstrates that the PR works 🙃

@bugadani bugadani marked this pull request as ready for review January 22, 2025 14:41
Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

Was excluding RTS on purpose? If it was it's a bit inconsistent

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

LGTM

@playfulFence playfulFence requested a review from MabezDev January 23, 2025 13:31
Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

Reconnecting an output signal to a different pin does not clear previous connections
4 participants