Read rx amount outside of poll_fn
This commit is contained in:
parent
5afe01617a
commit
687dda106f
1 changed files with 4 additions and 3 deletions
|
@ -400,11 +400,10 @@ impl<'d, U: Instance, T: TimerInstance> ReadUntilIdle for UarteWithIdle<'d, U, T
|
||||||
trace!("startrx");
|
trace!("startrx");
|
||||||
r.tasks_startrx.write(|w| unsafe { w.bits(1) });
|
r.tasks_startrx.write(|w| unsafe { w.bits(1) });
|
||||||
|
|
||||||
let n: usize = poll_fn(|cx| {
|
poll_fn(|cx| {
|
||||||
s.endrx_waker.register(cx.waker());
|
s.endrx_waker.register(cx.waker());
|
||||||
if r.events_endrx.read().bits() != 0 {
|
if r.events_endrx.read().bits() != 0 {
|
||||||
let n: usize = r.rxd.amount.read().amount().bits() as usize;
|
return Poll::Ready(());
|
||||||
return Poll::Ready(n);
|
|
||||||
}
|
}
|
||||||
Poll::Pending
|
Poll::Pending
|
||||||
})
|
})
|
||||||
|
@ -412,6 +411,8 @@ impl<'d, U: Instance, T: TimerInstance> ReadUntilIdle for UarteWithIdle<'d, U, T
|
||||||
|
|
||||||
compiler_fence(Ordering::SeqCst);
|
compiler_fence(Ordering::SeqCst);
|
||||||
r.events_rxstarted.reset();
|
r.events_rxstarted.reset();
|
||||||
|
let n = r.rxd.amount.read().amount().bits() as usize;
|
||||||
|
|
||||||
// Stop timer
|
// Stop timer
|
||||||
rt.tasks_stop.write(|w| unsafe { w.bits(1) });
|
rt.tasks_stop.write(|w| unsafe { w.bits(1) });
|
||||||
drop.defuse();
|
drop.defuse();
|
||||||
|
|
Loading…
Reference in a new issue