diff options
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/spi.rs')
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/spi.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/spi.rs b/embassy-embedded-hal/src/shared_bus/spi.rs index 04378c330..8e3762e68 100644 --- a/embassy-embedded-hal/src/shared_bus/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/spi.rs | |||
| @@ -112,30 +112,31 @@ where | |||
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | pub struct SpiBusDeviceWithConfig<'a, M: RawMutex, BUS, CS, C> { | 115 | pub struct SpiBusDeviceWithConfig<'a, M: RawMutex, BUS: SetConfig, CS> { |
| 116 | bus: &'a Mutex<M, BUS>, | 116 | bus: &'a Mutex<M, BUS>, |
| 117 | cs: CS, | 117 | cs: CS, |
| 118 | config: C, | 118 | config: BUS::Config, |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | impl<'a, M: RawMutex, BUS, CS, C> SpiBusDeviceWithConfig<'a, M, BUS, CS, C> { | 121 | impl<'a, M: RawMutex, BUS: SetConfig, CS> SpiBusDeviceWithConfig<'a, M, BUS, CS> { |
| 122 | pub fn new(bus: &'a Mutex<M, BUS>, cs: CS, config: C) -> Self { | 122 | pub fn new(bus: &'a Mutex<M, BUS>, cs: CS, config: BUS::Config) -> Self { |
| 123 | Self { bus, cs, config } | 123 | Self { bus, cs, config } |
| 124 | } | 124 | } |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | impl<'a, M: RawMutex, BUS, CS, C> spi::ErrorType for SpiBusDeviceWithConfig<'a, M, BUS, CS, C> | 127 | impl<'a, M, BUS, CS> spi::ErrorType for SpiBusDeviceWithConfig<'a, M, BUS, CS> |
| 128 | where | 128 | where |
| 129 | BUS: spi::ErrorType, | 129 | BUS: spi::ErrorType + SetConfig, |
| 130 | CS: OutputPin, | 130 | CS: OutputPin, |
| 131 | M: RawMutex, | ||
| 131 | { | 132 | { |
| 132 | type Error = SpiBusDeviceError<BUS::Error, CS::Error>; | 133 | type Error = SpiBusDeviceError<BUS::Error, CS::Error>; |
| 133 | } | 134 | } |
| 134 | 135 | ||
| 135 | impl<M, BUS, CS, C> spi::SpiDevice for SpiBusDeviceWithConfig<'_, M, BUS, CS, C> | 136 | impl<M, BUS, CS> spi::SpiDevice for SpiBusDeviceWithConfig<'_, M, BUS, CS> |
| 136 | where | 137 | where |
| 137 | M: RawMutex + 'static, | 138 | M: RawMutex + 'static, |
| 138 | BUS: spi::SpiBusFlush + SetConfig<C> + 'static, | 139 | BUS: spi::SpiBusFlush + SetConfig + 'static, |
| 139 | CS: OutputPin, | 140 | CS: OutputPin, |
| 140 | { | 141 | { |
| 141 | type Bus = BUS; | 142 | type Bus = BUS; |
