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

e-h-bus: Adding AtomicDevice for I2C and SPI bus sharing in multiple interrupt contexts #579

Closed

Conversation

ryan-summers
Copy link
Contributor

@ryan-summers ryan-summers commented Mar 7, 2024

This PR adds a primitive for sharing an I2C or SPI bus across multiple threads where the synchronization scheme is managed externally (i.e. RTIC sync resources).

The user is returned an Error::Busy if they ever attempt to pre-empt usage of the bus.

CC @Dirbaio as we were talking about this in the Matrix channel yesterday.

@ryan-summers ryan-summers requested a review from a team as a code owner March 7, 2024 09:39
}
}

unsafe impl<'a, T> Send for AtomicDevice<'a, T> {}
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 would expect this to be impl Sync, but for some reason if I only do Sync, my test application complains that the AtomicDevice cannot be shared across threads safely.

@ryan-summers ryan-summers changed the title e-h-bus/i2c: Adding AtomicDevice for I2C bus sharing e-h-bus: Adding AtomicDevice for I2C and SPI bus sharing in multiple interrupt contexts Mar 11, 2024
@Dirbaio
Copy link
Member

Dirbaio commented Apr 23, 2024

you didn't check "allow maintainers to push", i've pushed some fixes to #593

@Dirbaio Dirbaio closed this Apr 23, 2024
@ryan-summers
Copy link
Contributor Author

Thanks for taking this over and pushing it through! :)

I didn't see the maintainer allow button, my bad.

@ryan-summers ryan-summers deleted the feature/hal-bus-mutex branch April 23, 2024 20:16
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.

None yet

2 participants