diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-01-13 23:56:25 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-01-13 23:56:39 +0100 |
| commit | 7997687f3b4c8f679ae458ee28cd338ed9e44b2e (patch) | |
| tree | 9d31efb45bd909a249f6ff61f066c4638b0832f9 /embassy-nrf/src/buffered_uarte.rs | |
| parent | 6eec3d8acca1a4c6a853d0b65e43ec0a0f5c5c27 (diff) | |
nrf: impl embedded-hal 1.0 and embedded-hal-async traits.
Diffstat (limited to 'embassy-nrf/src/buffered_uarte.rs')
| -rw-r--r-- | embassy-nrf/src/buffered_uarte.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index 45e8afc4b..2880c84f6 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs | |||
| @@ -213,9 +213,6 @@ impl<'d, U: UarteInstance, T: TimerInstance> AsyncBufRead for BufferedUarte<'d, | |||
| 213 | cx: &mut Context<'_>, | 213 | cx: &mut Context<'_>, |
| 214 | ) -> Poll<embassy::io::Result<&[u8]>> { | 214 | ) -> Poll<embassy::io::Result<&[u8]>> { |
| 215 | self.inner.with(|state| { | 215 | self.inner.with(|state| { |
| 216 | // Conservative compiler fence to prevent optimizations that do not | ||
| 217 | // take in to account actions by DMA. The fence has been placed here, | ||
| 218 | // before any DMA action has started | ||
| 219 | compiler_fence(Ordering::SeqCst); | 216 | compiler_fence(Ordering::SeqCst); |
| 220 | trace!("poll_read"); | 217 | trace!("poll_read"); |
| 221 | 218 | ||
| @@ -265,9 +262,6 @@ impl<'d, U: UarteInstance, T: TimerInstance> AsyncWrite for BufferedUarte<'d, U, | |||
| 265 | 262 | ||
| 266 | trace!("poll_write: queued {:?}", n); | 263 | trace!("poll_write: queued {:?}", n); |
| 267 | 264 | ||
| 268 | // Conservative compiler fence to prevent optimizations that do not | ||
| 269 | // take in to account actions by DMA. The fence has been placed here, | ||
| 270 | // before any DMA action has started | ||
| 271 | compiler_fence(Ordering::SeqCst); | 265 | compiler_fence(Ordering::SeqCst); |
| 272 | 266 | ||
| 273 | Poll::Ready(Ok(n)) | 267 | Poll::Ready(Ok(n)) |
| @@ -347,9 +341,7 @@ impl<'a, U: UarteInstance, T: TimerInstance> PeripheralState for StateInner<'a, | |||
| 347 | trace!(" irq_rx: buf {:?} {:?}", buf.as_ptr() as u32, buf.len()); | 341 | trace!(" irq_rx: buf {:?} {:?}", buf.as_ptr() as u32, buf.len()); |
| 348 | 342 | ||
| 349 | // Start UARTE Receive transaction | 343 | // Start UARTE Receive transaction |
| 350 | r.tasks_startrx.write(|w| | 344 | r.tasks_startrx.write(|w| unsafe { w.bits(1) }); |
| 351 | // `1` is a valid value to write to task registers. | ||
| 352 | unsafe { w.bits(1) }); | ||
| 353 | } | 345 | } |
| 354 | break; | 346 | break; |
| 355 | } | 347 | } |
| @@ -397,9 +389,7 @@ impl<'a, U: UarteInstance, T: TimerInstance> PeripheralState for StateInner<'a, | |||
| 397 | unsafe { w.maxcnt().bits(buf.len() as _) }); | 389 | unsafe { w.maxcnt().bits(buf.len() as _) }); |
| 398 | 390 | ||
| 399 | // Start UARTE Transmit transaction | 391 | // Start UARTE Transmit transaction |
| 400 | r.tasks_starttx.write(|w| | 392 | r.tasks_starttx.write(|w| unsafe { w.bits(1) }); |
| 401 | // `1` is a valid value to write to task registers. | ||
| 402 | unsafe { w.bits(1) }); | ||
| 403 | } | 393 | } |
| 404 | break; | 394 | break; |
| 405 | } | 395 | } |
