aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-nrf/src/spis.rs45
1 files changed, 4 insertions, 41 deletions
diff --git a/embassy-nrf/src/spis.rs b/embassy-nrf/src/spis.rs
index 212825121..e695ba6b7 100644
--- a/embassy-nrf/src/spis.rs
+++ b/embassy-nrf/src/spis.rs
@@ -169,47 +169,10 @@ impl<'d, T: Instance> Spis<'d, T> {
169 // Enable SPIS instance. 169 // Enable SPIS instance.
170 r.enable.write(|w| w.enable().enabled()); 170 r.enable.write(|w| w.enable().enabled());
171 171
172 // Configure mode. 172 let mut spis = Self { _p: spis };
173 let mode = config.mode;
174 r.config.write(|w| {
175 match mode {
176 MODE_0 => {
177 w.order().msb_first();
178 w.cpol().active_high();
179 w.cpha().leading();
180 }
181 MODE_1 => {
182 w.order().msb_first();
183 w.cpol().active_high();
184 w.cpha().trailing();
185 }
186 MODE_2 => {
187 w.order().msb_first();
188 w.cpol().active_low();
189 w.cpha().leading();
190 }
191 MODE_3 => {
192 w.order().msb_first();
193 w.cpol().active_low();
194 w.cpha().trailing();
195 }
196 }
197 173
198 w 174 // Apply runtime peripheral configuration
199 }); 175 Self::set_config(&mut spis, &config);
200
201 // Set over-read character.
202 let orc = config.orc;
203 r.orc.write(|w| unsafe { w.orc().bits(orc) });
204
205 // Set default character.
206 let def = config.def;
207 r.def.write(|w| unsafe { w.def().bits(def) });
208
209 // Configure auto-acquire on 'transfer end' event.
210 if config.auto_acquire {
211 r.shorts.write(|w| w.end_acquire().bit(true));
212 }
213 176
214 // Disable all events interrupts. 177 // Disable all events interrupts.
215 r.intenclr.write(|w| unsafe { w.bits(0xFFFF_FFFF) }); 178 r.intenclr.write(|w| unsafe { w.bits(0xFFFF_FFFF) });
@@ -217,7 +180,7 @@ impl<'d, T: Instance> Spis<'d, T> {
217 T::Interrupt::unpend(); 180 T::Interrupt::unpend();
218 unsafe { T::Interrupt::enable() }; 181 unsafe { T::Interrupt::enable() };
219 182
220 Self { _p: spis } 183 spis
221 } 184 }
222 185
223 fn prepare(&mut self, rx: *mut [u8], tx: *const [u8]) -> Result<(), Error> { 186 fn prepare(&mut self, rx: *mut [u8], tx: *const [u8]) -> Result<(), Error> {