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

GPIO: embedded-hal 1.0 compatibility #148

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Conversation

Finomnis
Copy link
Contributor

No description provided.

@Finomnis Finomnis mentioned this pull request Dec 21, 2023
6 tasks
@Finomnis Finomnis marked this pull request as ready for review December 21, 2023 22:21
Copy link
Member

@mciantyre mciantyre left a comment

Choose a reason for hiding this comment

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

Could you share a minimum example that's fixed by 64c3af9? Or, could you help me understand why we need this fix?

64c3af9 adds critical sections inside routines that (indirectly) require a &mut Port<...> exclusive reference. By requiring the exclusive reference, we've made it the user's responsibility to avoid this race condition. If they're sharing their Port object across execution contexts, they'll need to wrap it in something like critical_section::Mutex.

Cargo.toml Outdated Show resolved Hide resolved
src/common/gpio.rs Outdated Show resolved Hide resolved
@Finomnis
Copy link
Contributor Author

Finomnis commented Dec 23, 2023

Could you share a minimum example that's fixed by 64c3af9? Or, could you help me understand why we need this fix?

64c3af9 adds critical sections inside routines that (indirectly) require a &mut Port<...> exclusive reference. By requiring the exclusive reference, we've made it the user's responsibility to avoid this race condition. If they're sharing their Port object across execution contexts, they'll need to wrap it in something like critical_section::Mutex.

You might be right, this might have been an oversight on my part. I might have carried over some thoughts from LPSPI, where it will be necessary that an interrupt disables itself upon getting fired, making this critical section necessary there.

I will revert that change.

@Finomnis
Copy link
Contributor Author

@mciantyre Ready for more reviews. Any leftover criticism/comments?

Otherwise I'd like to merge this as a base for the other eh1 implementations. Especially as it's only a non-breaking minor change.

@Finomnis
Copy link
Contributor Author

Finomnis commented Jan 8, 2024

@mciantyre Ping :)
Or do you want to wait for the eh-1 release?

@Finomnis
Copy link
Contributor Author

@mciantyre Ready for review again. Now update to eh-1.0 release.

Copy link
Member

@mciantyre mciantyre left a comment

Choose a reason for hiding this comment

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

I rebased onto commits that fix clippy warnings in other code, simplified the history, and added a CHANGELOG entry.

I dropped the MSRV recommendation. It's not clear why we should target 1.60, or why it's necessary to adopt an MSRV for this PR. And without a CI job, I'm afraid it would be difficult to maintain the MSRV ourselves. If you have a need for an MSRV, we can discuss in a separate issue.

@mciantyre mciantyre merged commit 15f1795 into imxrt-rs:main Jan 19, 2024
31 checks passed
@Finomnis Finomnis deleted the eh1-gpio branch January 19, 2024 19:37
@Finomnis
Copy link
Contributor Author

I rebased onto commits that fix clippy warnings in other code, simplified the history, and added a CHANGELOG entry.

I dropped the MSRV recommendation. It's not clear why we should target 1.60, or why it's necessary to adopt an MSRV for this PR. And without a CI job, I'm afraid it would be difficult to maintain the MSRV ourselves. If you have a need for an MSRV, we can discuss in a separate issue.

A agree with all of your points.

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