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 intorust-embedded:masterfrom
mutex-traits-based implementations of SpiDevice and I2c#683Conversation
mutex-trait-based implementations of SpiDevice and I2cmutex-traits-based implementations of SpiDevice and I2c
|
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 |
| critical-section = { version = "1.0" } | ||
| defmt-03 = { package = "defmt", version = "0.3", optional = true } | ||
| portable-atomic = {version = "1.3", default-features = false, optional = true, features = ["require-cas"]} | ||
| mutex = "1.0" |
There was a problem hiding this comment.
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.
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