Skip to content

Commit 60a3c09

Browse files
author
Jonathan Pallant (42 Technology)
committed
Move the event resets closer to where we check the events.
1 parent bd0f7d8 commit 60a3c09

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nrf-hal-common/src/uarte.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ where
179179
// before any DMA action has started.
180180
compiler_fence(SeqCst);
181181

182-
// Reset the events.
183-
self.0.events_endtx.reset();
184-
182+
185183
// Set up the DMA write.
186184
self.0.txd.ptr.write(|w|
187185
// We're giving the register a pointer to the stack. Since we're
@@ -200,11 +198,15 @@ where
200198
// values.
201199
unsafe { w.maxcnt().bits(tx_buffer.len() as _) });
202200

201+
// Reset the event
202+
self.0.events_endtx.reset();
203+
203204
// Start UARTE Transmit transaction.
204205
self.0.tasks_starttx.write(|w|
205206
// `1` is a valid value to write to task registers.
206207
unsafe { w.bits(1) });
207208

209+
208210
// Wait for transmission to end.
209211
while self.0.events_endtx.read().bits() == 0 {
210212
// TODO: Do something here which uses less power. Like `wfi`.
@@ -215,6 +217,9 @@ where
215217
// after all possible DMA actions have completed.
216218
compiler_fence(SeqCst);
217219

220+
// Reset the event
221+
self.0.events_txstopped.reset();
222+
218223
// Lower power consumption by disabling the transmitter once we're
219224
// finished.
220225
self.0.tasks_stoptx.write(|w|

0 commit comments

Comments
 (0)