Struct shared_bus::proxy::BusManager
source · Expand description
A manager for managing a shared bus.
The manager owns the actual peripheral and hands out proxies which can be used by your devices.
When creating a bus manager you need to specify which mutex type should be used.
Examples
// For example:
// let i2c = I2c::i2c1(dp.I2C1, (scl, sda), 90.khz(), clocks, &mut rcc.apb1);
let manager = BusManager::<std::sync::Mutex<_>, _>::new(i2c);
// You can now acquire bus handles:
let mut handle1 = manager.acquire();
let mut mydevice = MyDevice::new(manager.acquire());
Implementations
sourceimpl<M: BusMutex<RefCell<T>>, T> BusManager<M, T>
impl<M: BusMutex<RefCell<T>>, T> BusManager<M, T>
sourcepub fn new(d: T) -> BusManager<M, T>
pub fn new(d: T) -> BusManager<M, T>
Create a new manager for a bus peripheral d
.
When creating the manager you need to specify which mutex type should be used:
let manager = BusManager::<std::sync::Mutex<_>, _>::new(bus);
Auto Trait Implementations
impl<M, T> RefUnwindSafe for BusManager<M, T>where
M: RefUnwindSafe,
T: RefUnwindSafe,
impl<M, T> Send for BusManager<M, T>where
M: Send,
T: Send,
impl<M, T> Sync for BusManager<M, T>where
M: Sync,
T: Sync,
impl<M, T> Unpin for BusManager<M, T>where
M: Unpin,
T: Unpin,
impl<M, T> UnwindSafe for BusManager<M, T>where
M: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more