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

bus/i2c: add RefCell, CriticalSection and Mutex shared bus implementations. #445

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Mar 14, 2023

Requires #440

Same as #443 but for I2C.

This adds a few bus sharing implementations, with varying tradeoffs:

  • RefCellDevice: single thread only
  • CriticalSectionDevice: thread-safe, coarse locking, nostd.
  • MutexDevice: thread-safe, fine-grained locking, std only.

@Dirbaio Dirbaio requested a review from a team as a code owner March 14, 2023 23:58
@eldruin eldruin added this to the v1.0.0 milestone Mar 15, 2023
@eldruin eldruin mentioned this pull request Mar 15, 2023
@Dirbaio Dirbaio force-pushed the i2c-shared-bus branch 2 times, most recently from 99b652f to 6b0b7dc Compare March 16, 2023 15:32
Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

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

It looks generally good to me, thank you!
Could you add some more information about the std feature to the lib.rs?

embedded-hal-bus/src/i2c/critical_section.rs Show resolved Hide resolved
embedded-hal-bus/src/i2c/mutex.rs Outdated Show resolved Hide resolved
embedded-hal-bus/src/i2c/mutex.rs Outdated Show resolved Hide resolved
embedded-hal-bus/src/i2c/mutex.rs Outdated Show resolved Hide resolved
embedded-hal-bus/src/i2c/mutex.rs Show resolved Hide resolved
embedded-hal-bus/src/i2c/refcell.rs Outdated Show resolved Hide resolved
embedded-hal-bus/src/i2c/refcell.rs Show resolved Hide resolved
embedded-hal-bus/src/i2c/critical_section.rs Outdated Show resolved Hide resolved
@Dirbaio
Copy link
Member Author

Dirbaio commented Mar 28, 2023

@eldruin done

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!
bors r+

@bors bors bot merged commit a0f2426 into rust-embedded:master Mar 28, 2023
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