Skip to content

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

Merged
bors[bot] merged 2 commits into
rust-embedded:masterfrom
Dirbaio:i2c-shared-bus
Mar 28, 2023
Merged

bus/i2c: add RefCell, CriticalSection and Mutex shared bus implementations.#445
bors[bot] merged 2 commits into
rust-embedded:masterfrom
Dirbaio:i2c-shared-bus

Conversation

@Dirbaio

@Dirbaio Dirbaio commented Mar 14, 2023

Copy link
Copy Markdown
Member

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

@eldruin eldruin left a comment

Copy link
Copy Markdown
Member

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?

Comment thread embedded-hal-bus/src/i2c/critical_section.rs
Comment thread embedded-hal-bus/src/i2c/mutex.rs Outdated
Comment thread embedded-hal-bus/src/i2c/mutex.rs Outdated
Comment thread embedded-hal-bus/src/i2c/mutex.rs Outdated
Comment thread embedded-hal-bus/src/i2c/mutex.rs
Comment thread embedded-hal-bus/src/i2c/refcell.rs Outdated
Comment thread embedded-hal-bus/src/i2c/refcell.rs
Comment thread embedded-hal-bus/src/i2c/critical_section.rs Outdated
@Dirbaio

Dirbaio commented Mar 28, 2023

Copy link
Copy Markdown
Member Author

@eldruin done

@eldruin eldruin left a comment

Copy link
Copy Markdown
Member

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.

2 participants