Skip to content

[Lab] Unhelpful tip in the the SPI lab at ex 5

The tip says to use this code snippet:

// Import the Trait in order to be able to use imu_spi.transfer()
use embedded_hal_1::spi::SpiDevice as _;

let mut imu_spi = SpiDeviceWithConfig::new(&spi_bus, imu_cs, imu_config);
// Note: you no longer need to manually set the chip select pin when using imu_spi.transfer()

But it does not show how to actually transfer the chip select, or how to manage the merging of an async and blocking spi initialization.

When searching in the embassy repo (for ex: spi_display.rs) you can't find the method for transferring without manual chip selection or with 2 chip selects (when .transfer actually appears). When searching in the rust docs you can't find an example for this method. When searching the imu_spi & SpiDeviceWithConfig combination in the google search bar there's no results.

I don't necessarily have a better solution, but I know that no one in my time slot was able to figure out this exercise and the time spent looking online to understand what the hint was trying to say did not help.