SpiProxy in shared_bus - Rust (original) (raw)

pub struct SpiProxy<'a, M> { /* private fields */ }

Expand description

Proxy type for SPI bus sharing.

The SpiProxy implements all (blocking) SPI traits so it can be passed to drivers instead of the bus instance. An SpiProxy is created by calling BusManager::acquire_spi().

Note: The SpiProxy can only be used for sharing withing a single task/thread. This is due to drivers usually managing the chip-select pin manually which would be inherently racy in a concurrent environment (because the mutex is locked only after asserting CS). To ensure safe usage, a SpiProxy can only be created when using BusManagerSimple and is !Send.