diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs index e7e112b0a..7d383980d 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs @@ -28,13 +28,13 @@ use crate::shared_bus::SpiDeviceError; use crate::SetConfig; /// SPI device on a shared bus. -pub struct SpiDevice<'a, M: RawMutex, BUS, CS, Word> { +pub struct SpiDevice<'a, M: RawMutex, BUS, CS, Word: Copy + 'static = u8> { bus: &'a Mutex>, cs: CS, _word: core::marker::PhantomData, } -impl<'a, M: RawMutex, BUS, CS, Word> SpiDevice<'a, M, BUS, CS, Word> { +impl<'a, M: RawMutex, BUS, CS, Word: Copy + 'static> SpiDevice<'a, M, BUS, CS, Word> { /// Create a new `SpiDevice`. pub fn new(bus: &'a Mutex>, cs: CS) -> Self { Self { @@ -49,6 +49,7 @@ impl<'a, M: RawMutex, BUS, CS, Word> spi::ErrorType for SpiDevice<'a, M, BUS, CS where BUS: spi::ErrorType, CS: OutputPin, + Word: Copy + 'static, { type Error = SpiDeviceError; } @@ -102,6 +103,7 @@ where M: RawMutex, BUS: embedded_hal_02::blocking::spi::Transfer, CS: OutputPin, + Word: Copy + 'static, { type Error = SpiDeviceError; fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { @@ -122,6 +124,7 @@ where M: RawMutex, BUS: embedded_hal_02::blocking::spi::Write, CS: OutputPin, + Word: Copy + 'static, { type Error = SpiDeviceError; @@ -144,6 +147,7 @@ where M: RawMutex, BUS: embedded_hal_02::blocking::spi::Transfer, CS: OutputPin, + Word: Copy + 'static, { type Error = SpiDeviceError; fn transfer<'w>(&mut self, words: &'w mut [u16]) -> Result<&'w [u16], Self::Error> { @@ -164,6 +168,7 @@ where M: RawMutex, BUS: embedded_hal_02::blocking::spi::Write, CS: OutputPin, + Word: Copy + 'static, { type Error = SpiDeviceError; @@ -185,14 +190,14 @@ where /// This is like [`SpiDevice`], with an additional bus configuration that's applied /// to the bus before each use using [`SetConfig`]. This allows different /// devices on the same bus to use different communication settings. -pub struct SpiDeviceWithConfig<'a, M: RawMutex, BUS: SetConfig, CS, Word> { +pub struct SpiDeviceWithConfig<'a, M: RawMutex, BUS: SetConfig, CS, Word: Copy + 'static = u8> { bus: &'a Mutex>, cs: CS, config: BUS::Config, _word: core::marker::PhantomData, } -impl<'a, M: RawMutex, BUS: SetConfig, CS, Word> SpiDeviceWithConfig<'a, M, BUS, CS, Word> { +impl<'a, M: RawMutex, BUS: SetConfig, CS, Word: Copy + 'static> SpiDeviceWithConfig<'a, M, BUS, CS, Word> { /// Create a new `SpiDeviceWithConfig`. pub fn new(bus: &'a Mutex>, cs: CS, config: BUS::Config) -> Self { Self {