Expand description

Blocking shared SPI bus

Example (nrf52)

use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice;
use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex};

static SPI_BUS: StaticCell<NoopMutex<RefCell<Spim<SPI3>>>> = StaticCell::new();
let spi = Spim::new_txonly(p.SPI3, Irqs, p.P0_15, p.P0_18, Config::default());
let spi_bus = NoopMutex::new(RefCell::new(spi));
let spi_bus = SPI_BUS.init(spi_bus);

// Device 1, using embedded-hal compatible driver for ST7735 LCD display
let cs_pin1 = Output::new(p.P0_24, Level::Low, OutputDrive::Standard);
let spi_dev1 = SpiDevice::new(spi_bus, cs_pin1);
let display1 = ST7735::new(spi_dev1, dc1, rst1, Default::default(), false, 160, 128);

Structs