-
Notifications
You must be signed in to change notification settings - Fork 269
Add mutex-traits-based implementations of SpiDevice and I2c#683
Add mutex-traits-based implementations of SpiDevice and I2c #683JalonWong wants to merge 1 commit into
mutex-traits-based implementations of SpiDevice and I2c #683Conversation
mutex-trait-based implementations of SpiDevice and I2c (削除ここまで)mutex-traits-based implementations of SpiDevice and I2c (追記ここまで)
a7162d8 to
d0bd938
Compare
FeldrinH
commented
Aug 21, 2025
What exactly are the mutex/mutex-trait crates? I took a quick peek at them and they don't really seem to be used by anything in the ecosystem and are maintained under the tosc-rs GitHub organization (which I have never heard of before), rather than rust-embedded.
@FeldrinH
There is a mutex-trait under rust-embedded, but it's archived. It recommends the mutex-traits. I found it decent, so I suggest that you consider bringing it into the ecosystem.
d0bd938 to
0428d58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused:
The mutex crate itself contains the following explanation of the relationship between mutex and mutex-traits:
The mutex-traits crate should be used by library crates that want to be generic over different ways of exclusive access.
The mutex crate should be used by applications that need to select which implementation is appropriate for their use case.
As embedded-hal-bus is a library, shouldn't it depend on mutex-traits?
But then, I don't get how code like MutexTraitsDevice implementations should be written without using the mutex crate. So this is more likely a documentation issue in mutex and mutex-traits (or just me being particularly slow today) than an actual issue with this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mutex-traits is used in the library that wants to provide a mutex implementation. For example a RTOS library. embedded-hal-bus should use mutex crate.
Fix #119