docs.rs failed to build shared-bus-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
shared-bus-0.3.1
shared-bus
shared-bus is a crate to allow sharing bus peripherals safely between multiple devices.
Typical usage of this crate might look like this:
extern crate shared_bus;
// Create your bus peripheral as usual:
let i2c = i2c1;
let manager = new;
// You can now acquire bus handles:
let mut handle = manager.acquire;
// handle implements `i2c::{Read, Write, WriteRead}`, depending on the
// implementations of the underlying peripheral
let mut mydevice = new;
Mutex Implementation
To do its job, shared-bus needs a mutex. Because each platform has its own
mutex type, shared-bus uses an abstraction: BusMutex
. This type
needs to be implemented for your platforms mutex type to allow using this
crate.
- If
std
is available, activate thestd
feature to enable the implementation ofBusMutex
forstd::sync::Mutex
. - If your device used
cortex-m
, activate thecortexm
feature to enable the implementation ofBusMutex
forcortex_m::interrupt::Mutex
. - If neither is the case, you need to implement a mutex yourself:
extern crate shared_bus;
extern crate cortex_m;
// You need a newtype because you can't implement foreign traits on
// foreign types.
;
type MyBusManager<L, P> = BusManager;
I am welcoming patches containing mutex implementations for other platforms!
License
shared-bus is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.