embedded_interfaces/
spi.rs

1#[maybe_async_cfg::maybe(
2    idents(hal(sync = "embedded_hal", async = "embedded_hal_async"), Codec),
3    sync(feature = "sync"),
4    async(feature = "async")
5)]
6/// This represents an SPI device on an SPI bus.
7pub struct SpiDevice<I>
8where
9    I: hal::spi::r#SpiDevice,
10{
11    /// Spi interface
12    pub interface: I,
13}
14
15#[maybe_async_cfg::maybe(
16    idents(hal(sync = "embedded_hal", async = "embedded_hal_async"), Codec),
17    sync(feature = "sync"),
18    async(feature = "async")
19)]
20impl<I> SpiDevice<I>
21where
22    I: hal::spi::r#SpiDevice,
23{
24    /// Create a new I2cDevice from an interface
25    pub fn new(interface: I) -> Self {
26        Self { interface }
27    }
28}