aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src/shared_bus/blocking
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-05-20 10:55:55 +0200
committerDario Nieuwenhuis <[email protected]>2024-05-20 10:56:43 +0200
commit31887b47bc7c7f72b707c3195c119dec58a38dce (patch)
tree7e2d2a5c39dded24e432c3568a57639942f1981c /embassy-embedded-hal/src/shared_bus/blocking
parentd64f46ff9e81149bf386ca9ffb85950ac293edf1 (diff)
embassy-embedded-hal: remove Word generic for blocking SpiDeviceWithConfig.
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/blocking')
-rw-r--r--embassy-embedded-hal/src/shared_bus/blocking/spi.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
index 3be1276e5..eb9c0c4f4 100644
--- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
+++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
@@ -96,22 +96,16 @@ where
96/// This is like [`SpiDevice`], with an additional bus configuration that's applied 96/// This is like [`SpiDevice`], with an additional bus configuration that's applied
97/// to the bus before each use using [`SetConfig`]. This allows different 97/// to the bus before each use using [`SetConfig`]. This allows different
98/// devices on the same bus to use different communication settings. 98/// devices on the same bus to use different communication settings.
99pub struct SpiDeviceWithConfig<'a, M: RawMutex, BUS: SetConfig, CS, Word: Copy + 'static = u8> { 99pub struct SpiDeviceWithConfig<'a, M: RawMutex, BUS: SetConfig, CS> {
100 bus: &'a Mutex<M, RefCell<BUS>>, 100 bus: &'a Mutex<M, RefCell<BUS>>,
101 cs: CS, 101 cs: CS,
102 config: BUS::Config, 102 config: BUS::Config,
103 _word: core::marker::PhantomData<Word>,
104} 103}
105 104
106impl<'a, M: RawMutex, BUS: SetConfig, CS> SpiDeviceWithConfig<'a, M, BUS, CS> { 105impl<'a, M: RawMutex, BUS: SetConfig, CS> SpiDeviceWithConfig<'a, M, BUS, CS> {
107 /// Create a new `SpiDeviceWithConfig`. 106 /// Create a new `SpiDeviceWithConfig`.
108 pub fn new(bus: &'a Mutex<M, RefCell<BUS>>, cs: CS, config: BUS::Config) -> Self { 107 pub fn new(bus: &'a Mutex<M, RefCell<BUS>>, cs: CS, config: BUS::Config) -> Self {
109 Self { 108 Self { bus, cs, config }
110 bus,
111 cs,
112 config,
113 _word: core::marker::PhantomData,
114 }
115 } 109 }
116 110
117 /// Change the device's config at runtime 111 /// Change the device's config at runtime
@@ -120,17 +114,16 @@ impl<'a, M: RawMutex, BUS: SetConfig, CS> SpiDeviceWithConfig<'a, M, BUS, CS> {
120 } 114 }
121} 115}
122 116
123impl<'a, M, BUS, CS, Word> spi::ErrorType for SpiDeviceWithConfig<'a, M, BUS, CS, Word> 117impl<'a, M, BUS, CS> spi::ErrorType for SpiDeviceWithConfig<'a, M, BUS, CS>
124where 118where
125 M: RawMutex, 119 M: RawMutex,
126 BUS: spi::ErrorType + SetConfig, 120 BUS: spi::ErrorType + SetConfig,
127 CS: OutputPin, 121 CS: OutputPin,
128 Word: Copy + 'static,
129{ 122{
130 type Error = SpiDeviceError<BUS::Error, CS::Error>; 123 type Error = SpiDeviceError<BUS::Error, CS::Error>;
131} 124}
132 125
133impl<BUS, M, CS, Word> embedded_hal_1::spi::SpiDevice<Word> for SpiDeviceWithConfig<'_, M, BUS, CS, Word> 126impl<BUS, M, CS, Word> embedded_hal_1::spi::SpiDevice<Word> for SpiDeviceWithConfig<'_, M, BUS, CS>
134where 127where
135 M: RawMutex, 128 M: RawMutex,
136 BUS: SpiBus<Word> + SetConfig, 129 BUS: SpiBus<Word> + SetConfig,