diff options
| author | Ruben De Smet <[email protected]> | 2023-08-11 11:58:22 +0200 |
|---|---|---|
| committer | Ruben De Smet <[email protected]> | 2023-08-22 16:58:31 +0200 |
| commit | c39671266e21dd9e35e60cc680453cd5c38162db (patch) | |
| tree | 895dbbcefb90af1fd65c8844c1e5785a909b0671 | |
| parent | b1ec460b9af131ef80fcafd79a7f63aa326aaf94 (diff) | |
Deprecate *recv* in favor of *receive*
| -rw-r--r-- | embassy-stm32-wpan/src/mac/driver.rs | 4 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/runner.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/can/bxcan.rs | 4 | ||||
| -rw-r--r-- | embassy-sync/src/channel.rs | 88 | ||||
| -rw-r--r-- | examples/nrf52840/src/bin/channel.rs | 2 | ||||
| -rw-r--r-- | examples/nrf52840/src/bin/channel_sender_receiver.rs | 2 | ||||
| -rw-r--r-- | examples/nrf52840/src/bin/uart_split.rs | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/lora_p2p_send_multicore.rs | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/multicore.rs | 2 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/button_events.rs | 4 | ||||
| -rw-r--r-- | examples/stm32h5/src/bin/usart_split.rs | 2 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/usart_split.rs | 2 | ||||
| -rw-r--r-- | tests/rp/src/bin/gpio_multicore.rs | 6 | ||||
| -rw-r--r-- | tests/rp/src/bin/multicore.rs | 4 |
14 files changed, 63 insertions, 63 deletions
diff --git a/embassy-stm32-wpan/src/mac/driver.rs b/embassy-stm32-wpan/src/mac/driver.rs index 93898d888..bfc4f1ee8 100644 --- a/embassy-stm32-wpan/src/mac/driver.rs +++ b/embassy-stm32-wpan/src/mac/driver.rs | |||
| @@ -93,7 +93,7 @@ impl<'d> embassy_net_driver::RxToken for RxToken<'d> { | |||
| 93 | { | 93 | { |
| 94 | // Only valid data events should be put into the queue | 94 | // Only valid data events should be put into the queue |
| 95 | 95 | ||
| 96 | let data_event = match self.rx.try_recv().unwrap() { | 96 | let data_event = match self.rx.try_receive().unwrap() { |
| 97 | MacEvent::McpsDataInd(data_event) => data_event, | 97 | MacEvent::McpsDataInd(data_event) => data_event, |
| 98 | _ => unreachable!(), | 98 | _ => unreachable!(), |
| 99 | }; | 99 | }; |
| @@ -113,7 +113,7 @@ impl<'d> embassy_net_driver::TxToken for TxToken<'d> { | |||
| 113 | F: FnOnce(&mut [u8]) -> R, | 113 | F: FnOnce(&mut [u8]) -> R, |
| 114 | { | 114 | { |
| 115 | // Only valid tx buffers should be put into the queue | 115 | // Only valid tx buffers should be put into the queue |
| 116 | let buf = self.tx_buf.try_recv().unwrap(); | 116 | let buf = self.tx_buf.try_receive().unwrap(); |
| 117 | let r = f(&mut buf[..len]); | 117 | let r = f(&mut buf[..len]); |
| 118 | 118 | ||
| 119 | // The tx channel should always be of equal capacity to the tx_buf channel | 119 | // The tx channel should always be of equal capacity to the tx_buf channel |
diff --git a/embassy-stm32-wpan/src/mac/runner.rs b/embassy-stm32-wpan/src/mac/runner.rs index 1be6df8a4..d3099b6b7 100644 --- a/embassy-stm32-wpan/src/mac/runner.rs +++ b/embassy-stm32-wpan/src/mac/runner.rs | |||
| @@ -73,7 +73,7 @@ impl<'a> Runner<'a> { | |||
| 73 | let mut msdu_handle = 0x02; | 73 | let mut msdu_handle = 0x02; |
| 74 | 74 | ||
| 75 | loop { | 75 | loop { |
| 76 | let (buf, len) = self.tx_channel.recv().await; | 76 | let (buf, len) = self.tx_channel.receive().await; |
| 77 | let _wm = self.write_mutex.lock().await; | 77 | let _wm = self.write_mutex.lock().await; |
| 78 | 78 | ||
| 79 | // The mutex should be dropped on the next loop iteration | 79 | // The mutex should be dropped on the next loop iteration |
diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index e439207ef..7ad13cece 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs | |||
| @@ -478,7 +478,7 @@ impl<'c, 'd, T: Instance> CanRx<'c, 'd, T> { | |||
| 478 | pub async fn read(&mut self) -> Result<Envelope, BusError> { | 478 | pub async fn read(&mut self) -> Result<Envelope, BusError> { |
| 479 | poll_fn(|cx| { | 479 | poll_fn(|cx| { |
| 480 | T::state().err_waker.register(cx.waker()); | 480 | T::state().err_waker.register(cx.waker()); |
| 481 | if let Poll::Ready(envelope) = T::state().rx_queue.recv().poll_unpin(cx) { | 481 | if let Poll::Ready(envelope) = T::state().rx_queue.receive().poll_unpin(cx) { |
| 482 | return Poll::Ready(Ok(envelope)); | 482 | return Poll::Ready(Ok(envelope)); |
| 483 | } else if let Some(err) = self.curr_error() { | 483 | } else if let Some(err) = self.curr_error() { |
| 484 | return Poll::Ready(Err(err)); | 484 | return Poll::Ready(Err(err)); |
| @@ -493,7 +493,7 @@ impl<'c, 'd, T: Instance> CanRx<'c, 'd, T> { | |||
| 493 | /// | 493 | /// |
| 494 | /// Returns [Err(TryReadError::Empty)] if there are no frames in the rx queue. | 494 | /// Returns [Err(TryReadError::Empty)] if there are no frames in the rx queue. |
| 495 | pub fn try_read(&mut self) -> Result<Envelope, TryReadError> { | 495 | pub fn try_read(&mut self) -> Result<Envelope, TryReadError> { |
| 496 | if let Ok(envelope) = T::state().rx_queue.try_recv() { | 496 | if let Ok(envelope) = T::state().rx_queue.try_receive() { |
| 497 | return Ok(envelope); | 497 | return Ok(envelope); |
| 498 | } | 498 | } |
| 499 | 499 | ||
diff --git a/embassy-sync/src/channel.rs b/embassy-sync/src/channel.rs index dc727fb10..62ea1307d 100644 --- a/embassy-sync/src/channel.rs +++ b/embassy-sync/src/channel.rs | |||
| @@ -147,16 +147,16 @@ where | |||
| 147 | { | 147 | { |
| 148 | /// Receive the next value. | 148 | /// Receive the next value. |
| 149 | /// | 149 | /// |
| 150 | /// See [`Channel::recv()`]. | 150 | /// See [`Channel::receive()`]. |
| 151 | pub fn recv(&self) -> RecvFuture<'_, M, T, N> { | 151 | pub fn receive(&self) -> ReceiveFuture<'_, M, T, N> { |
| 152 | self.channel.recv() | 152 | self.channel.receive() |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | /// Attempt to immediately receive the next value. | 155 | /// Attempt to immediately receive the next value. |
| 156 | /// | 156 | /// |
| 157 | /// See [`Channel::try_recv()`] | 157 | /// See [`Channel::try_receive()`] |
| 158 | pub fn try_recv(&self) -> Result<T, TryRecvError> { | 158 | pub fn try_receive(&self) -> Result<T, TryReceiveError> { |
| 159 | self.channel.try_recv() | 159 | self.channel.try_receive() |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | /// Allows a poll_fn to poll until the channel is ready to receive | 162 | /// Allows a poll_fn to poll until the channel is ready to receive |
| @@ -190,16 +190,16 @@ impl<'ch, T> Copy for DynamicReceiver<'ch, T> {} | |||
| 190 | impl<'ch, T> DynamicReceiver<'ch, T> { | 190 | impl<'ch, T> DynamicReceiver<'ch, T> { |
| 191 | /// Receive the next value. | 191 | /// Receive the next value. |
| 192 | /// | 192 | /// |
| 193 | /// See [`Channel::recv()`]. | 193 | /// See [`Channel::receive()`]. |
| 194 | pub fn recv(&self) -> DynamicRecvFuture<'_, T> { | 194 | pub fn receive(&self) -> DynamicReceiveFuture<'_, T> { |
| 195 | DynamicRecvFuture { channel: self.channel } | 195 | DynamicReceiveFuture { channel: self.channel } |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | /// Attempt to immediately receive the next value. | 198 | /// Attempt to immediately receive the next value. |
| 199 | /// | 199 | /// |
| 200 | /// See [`Channel::try_recv()`] | 200 | /// See [`Channel::try_receive()`] |
| 201 | pub fn try_recv(&self) -> Result<T, TryRecvError> { | 201 | pub fn try_receive(&self) -> Result<T, TryReceiveError> { |
| 202 | self.channel.try_recv_with_context(None) | 202 | self.channel.try_receive_with_context(None) |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | /// Allows a poll_fn to poll until the channel is ready to receive | 205 | /// Allows a poll_fn to poll until the channel is ready to receive |
| @@ -226,16 +226,16 @@ where | |||
| 226 | } | 226 | } |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /// Future returned by [`Channel::recv`] and [`Receiver::recv`]. | 229 | /// Future returned by [`Channel::receive`] and [`Receiver::receive`]. |
| 230 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 230 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 231 | pub struct RecvFuture<'ch, M, T, const N: usize> | 231 | pub struct ReceiveFuture<'ch, M, T, const N: usize> |
| 232 | where | 232 | where |
| 233 | M: RawMutex, | 233 | M: RawMutex, |
| 234 | { | 234 | { |
| 235 | channel: &'ch Channel<M, T, N>, | 235 | channel: &'ch Channel<M, T, N>, |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | impl<'ch, M, T, const N: usize> Future for RecvFuture<'ch, M, T, N> | 238 | impl<'ch, M, T, const N: usize> Future for ReceiveFuture<'ch, M, T, N> |
| 239 | where | 239 | where |
| 240 | M: RawMutex, | 240 | M: RawMutex, |
| 241 | { | 241 | { |
| @@ -246,19 +246,19 @@ where | |||
| 246 | } | 246 | } |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | /// Future returned by [`DynamicReceiver::recv`]. | 249 | /// Future returned by [`DynamicReceiver::receive`]. |
| 250 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 250 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 251 | pub struct DynamicRecvFuture<'ch, T> { | 251 | pub struct DynamicReceiveFuture<'ch, T> { |
| 252 | channel: &'ch dyn DynamicChannel<T>, | 252 | channel: &'ch dyn DynamicChannel<T>, |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | impl<'ch, T> Future for DynamicRecvFuture<'ch, T> { | 255 | impl<'ch, T> Future for DynamicReceiveFuture<'ch, T> { |
| 256 | type Output = T; | 256 | type Output = T; |
| 257 | 257 | ||
| 258 | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> { | 258 | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> { |
| 259 | match self.channel.try_recv_with_context(Some(cx)) { | 259 | match self.channel.try_receive_with_context(Some(cx)) { |
| 260 | Ok(v) => Poll::Ready(v), | 260 | Ok(v) => Poll::Ready(v), |
| 261 | Err(TryRecvError::Empty) => Poll::Pending, | 261 | Err(TryReceiveError::Empty) => Poll::Pending, |
| 262 | } | 262 | } |
| 263 | } | 263 | } |
| 264 | } | 264 | } |
| @@ -324,7 +324,7 @@ impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {} | |||
| 324 | trait DynamicChannel<T> { | 324 | trait DynamicChannel<T> { |
| 325 | fn try_send_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), TrySendError<T>>; | 325 | fn try_send_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), TrySendError<T>>; |
| 326 | 326 | ||
| 327 | fn try_recv_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryRecvError>; | 327 | fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError>; |
| 328 | 328 | ||
| 329 | fn poll_ready_to_send(&self, cx: &mut Context<'_>) -> Poll<()>; | 329 | fn poll_ready_to_send(&self, cx: &mut Context<'_>) -> Poll<()>; |
| 330 | fn poll_ready_to_receive(&self, cx: &mut Context<'_>) -> Poll<()>; | 330 | fn poll_ready_to_receive(&self, cx: &mut Context<'_>) -> Poll<()>; |
| @@ -332,10 +332,10 @@ trait DynamicChannel<T> { | |||
| 332 | fn poll_receive(&self, cx: &mut Context<'_>) -> Poll<T>; | 332 | fn poll_receive(&self, cx: &mut Context<'_>) -> Poll<T>; |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | /// Error returned by [`try_recv`](Channel::try_recv). | 335 | /// Error returned by [`try_receive`](Channel::try_receive). |
| 336 | #[derive(PartialEq, Eq, Clone, Copy, Debug)] | 336 | #[derive(PartialEq, Eq, Clone, Copy, Debug)] |
| 337 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 337 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 338 | pub enum TryRecvError { | 338 | pub enum TryReceiveError { |
| 339 | /// A message could not be received because the channel is empty. | 339 | /// A message could not be received because the channel is empty. |
| 340 | Empty, | 340 | Empty, |
| 341 | } | 341 | } |
| @@ -364,11 +364,11 @@ impl<T, const N: usize> ChannelState<T, N> { | |||
| 364 | } | 364 | } |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | fn try_recv(&mut self) -> Result<T, TryRecvError> { | 367 | fn try_receive(&mut self) -> Result<T, TryReceiveError> { |
| 368 | self.try_recv_with_context(None) | 368 | self.try_receive_with_context(None) |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | fn try_recv_with_context(&mut self, cx: Option<&mut Context<'_>>) -> Result<T, TryRecvError> { | 371 | fn try_receive_with_context(&mut self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError> { |
| 372 | if self.queue.is_full() { | 372 | if self.queue.is_full() { |
| 373 | self.senders_waker.wake(); | 373 | self.senders_waker.wake(); |
| 374 | } | 374 | } |
| @@ -379,7 +379,7 @@ impl<T, const N: usize> ChannelState<T, N> { | |||
| 379 | if let Some(cx) = cx { | 379 | if let Some(cx) = cx { |
| 380 | self.receiver_waker.register(cx.waker()); | 380 | self.receiver_waker.register(cx.waker()); |
| 381 | } | 381 | } |
| 382 | Err(TryRecvError::Empty) | 382 | Err(TryReceiveError::Empty) |
| 383 | } | 383 | } |
| 384 | } | 384 | } |
| 385 | 385 | ||
| @@ -474,8 +474,8 @@ where | |||
| 474 | self.inner.lock(|rc| f(&mut *rc.borrow_mut())) | 474 | self.inner.lock(|rc| f(&mut *rc.borrow_mut())) |
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | fn try_recv_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryRecvError> { | 477 | fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError> { |
| 478 | self.lock(|c| c.try_recv_with_context(cx)) | 478 | self.lock(|c| c.try_receive_with_context(cx)) |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | /// Poll the channel for the next message | 481 | /// Poll the channel for the next message |
| @@ -536,16 +536,16 @@ where | |||
| 536 | /// | 536 | /// |
| 537 | /// If there are no messages in the channel's buffer, this method will | 537 | /// If there are no messages in the channel's buffer, this method will |
| 538 | /// wait until a message is sent. | 538 | /// wait until a message is sent. |
| 539 | pub fn recv(&self) -> RecvFuture<'_, M, T, N> { | 539 | pub fn receive(&self) -> ReceiveFuture<'_, M, T, N> { |
| 540 | RecvFuture { channel: self } | 540 | ReceiveFuture { channel: self } |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | /// Attempt to immediately receive a message. | 543 | /// Attempt to immediately receive a message. |
| 544 | /// | 544 | /// |
| 545 | /// This method will either receive a message from the channel immediately or return an error | 545 | /// This method will either receive a message from the channel immediately or return an error |
| 546 | /// if the channel is empty. | 546 | /// if the channel is empty. |
| 547 | pub fn try_recv(&self) -> Result<T, TryRecvError> { | 547 | pub fn try_receive(&self) -> Result<T, TryReceiveError> { |
| 548 | self.lock(|c| c.try_recv()) | 548 | self.lock(|c| c.try_receive()) |
| 549 | } | 549 | } |
| 550 | } | 550 | } |
| 551 | 551 | ||
| @@ -559,8 +559,8 @@ where | |||
| 559 | Channel::try_send_with_context(self, m, cx) | 559 | Channel::try_send_with_context(self, m, cx) |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | fn try_recv_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryRecvError> { | 562 | fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError> { |
| 563 | Channel::try_recv_with_context(self, cx) | 563 | Channel::try_receive_with_context(self, cx) |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | fn poll_ready_to_send(&self, cx: &mut Context<'_>) -> Poll<()> { | 566 | fn poll_ready_to_send(&self, cx: &mut Context<'_>) -> Poll<()> { |
| @@ -616,15 +616,15 @@ mod tests { | |||
| 616 | fn receiving_once_with_one_send() { | 616 | fn receiving_once_with_one_send() { |
| 617 | let mut c = ChannelState::<u32, 3>::new(); | 617 | let mut c = ChannelState::<u32, 3>::new(); |
| 618 | assert!(c.try_send(1).is_ok()); | 618 | assert!(c.try_send(1).is_ok()); |
| 619 | assert_eq!(c.try_recv().unwrap(), 1); | 619 | assert_eq!(c.try_receive().unwrap(), 1); |
| 620 | assert_eq!(capacity(&c), 3); | 620 | assert_eq!(capacity(&c), 3); |
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | #[test] | 623 | #[test] |
| 624 | fn receiving_when_empty() { | 624 | fn receiving_when_empty() { |
| 625 | let mut c = ChannelState::<u32, 3>::new(); | 625 | let mut c = ChannelState::<u32, 3>::new(); |
| 626 | match c.try_recv() { | 626 | match c.try_receive() { |
| 627 | Err(TryRecvError::Empty) => assert!(true), | 627 | Err(TryReceiveError::Empty) => assert!(true), |
| 628 | _ => assert!(false), | 628 | _ => assert!(false), |
| 629 | } | 629 | } |
| 630 | assert_eq!(capacity(&c), 3); | 630 | assert_eq!(capacity(&c), 3); |
| @@ -634,7 +634,7 @@ mod tests { | |||
| 634 | fn simple_send_and_receive() { | 634 | fn simple_send_and_receive() { |
| 635 | let c = Channel::<NoopRawMutex, u32, 3>::new(); | 635 | let c = Channel::<NoopRawMutex, u32, 3>::new(); |
| 636 | assert!(c.try_send(1).is_ok()); | 636 | assert!(c.try_send(1).is_ok()); |
| 637 | assert_eq!(c.try_recv().unwrap(), 1); | 637 | assert_eq!(c.try_receive().unwrap(), 1); |
| 638 | } | 638 | } |
| 639 | 639 | ||
| 640 | #[test] | 640 | #[test] |
| @@ -654,7 +654,7 @@ mod tests { | |||
| 654 | let r: DynamicReceiver<'_, u32> = c.receiver().into(); | 654 | let r: DynamicReceiver<'_, u32> = c.receiver().into(); |
| 655 | 655 | ||
| 656 | assert!(s.try_send(1).is_ok()); | 656 | assert!(s.try_send(1).is_ok()); |
| 657 | assert_eq!(r.try_recv().unwrap(), 1); | 657 | assert_eq!(r.try_receive().unwrap(), 1); |
| 658 | } | 658 | } |
| 659 | 659 | ||
| 660 | #[futures_test::test] | 660 | #[futures_test::test] |
| @@ -669,14 +669,14 @@ mod tests { | |||
| 669 | assert!(c2.try_send(1).is_ok()); | 669 | assert!(c2.try_send(1).is_ok()); |
| 670 | }) | 670 | }) |
| 671 | .is_ok()); | 671 | .is_ok()); |
| 672 | assert_eq!(c.recv().await, 1); | 672 | assert_eq!(c.receive().await, 1); |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | #[futures_test::test] | 675 | #[futures_test::test] |
| 676 | async fn sender_send_completes_if_capacity() { | 676 | async fn sender_send_completes_if_capacity() { |
| 677 | let c = Channel::<CriticalSectionRawMutex, u32, 1>::new(); | 677 | let c = Channel::<CriticalSectionRawMutex, u32, 1>::new(); |
| 678 | c.send(1).await; | 678 | c.send(1).await; |
| 679 | assert_eq!(c.recv().await, 1); | 679 | assert_eq!(c.receive().await, 1); |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | #[futures_test::test] | 682 | #[futures_test::test] |
| @@ -694,11 +694,11 @@ mod tests { | |||
| 694 | // Wish I could think of a means of determining that the async send is waiting instead. | 694 | // Wish I could think of a means of determining that the async send is waiting instead. |
| 695 | // However, I've used the debugger to observe that the send does indeed wait. | 695 | // However, I've used the debugger to observe that the send does indeed wait. |
| 696 | Delay::new(Duration::from_millis(500)).await; | 696 | Delay::new(Duration::from_millis(500)).await; |
| 697 | assert_eq!(c.recv().await, 1); | 697 | assert_eq!(c.receive().await, 1); |
| 698 | assert!(executor | 698 | assert!(executor |
| 699 | .spawn(async move { | 699 | .spawn(async move { |
| 700 | loop { | 700 | loop { |
| 701 | c.recv().await; | 701 | c.receive().await; |
| 702 | } | 702 | } |
| 703 | }) | 703 | }) |
| 704 | .is_ok()); | 704 | .is_ok()); |
diff --git a/examples/nrf52840/src/bin/channel.rs b/examples/nrf52840/src/bin/channel.rs index d782a79e7..bd9c909da 100644 --- a/examples/nrf52840/src/bin/channel.rs +++ b/examples/nrf52840/src/bin/channel.rs | |||
| @@ -35,7 +35,7 @@ async fn main(spawner: Spawner) { | |||
| 35 | unwrap!(spawner.spawn(my_task())); | 35 | unwrap!(spawner.spawn(my_task())); |
| 36 | 36 | ||
| 37 | loop { | 37 | loop { |
| 38 | match CHANNEL.recv().await { | 38 | match CHANNEL.receive().await { |
| 39 | LedState::On => led.set_high(), | 39 | LedState::On => led.set_high(), |
| 40 | LedState::Off => led.set_low(), | 40 | LedState::Off => led.set_low(), |
| 41 | } | 41 | } |
diff --git a/examples/nrf52840/src/bin/channel_sender_receiver.rs b/examples/nrf52840/src/bin/channel_sender_receiver.rs index fcccdaed5..ec4f1d800 100644 --- a/examples/nrf52840/src/bin/channel_sender_receiver.rs +++ b/examples/nrf52840/src/bin/channel_sender_receiver.rs | |||
| @@ -33,7 +33,7 @@ async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedSta | |||
| 33 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); | 33 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); |
| 34 | 34 | ||
| 35 | loop { | 35 | loop { |
| 36 | match receiver.recv().await { | 36 | match receiver.receive().await { |
| 37 | LedState::On => led.set_high(), | 37 | LedState::On => led.set_high(), |
| 38 | LedState::Off => led.set_low(), | 38 | LedState::Off => led.set_low(), |
| 39 | } | 39 | } |
diff --git a/examples/nrf52840/src/bin/uart_split.rs b/examples/nrf52840/src/bin/uart_split.rs index 9979a1d53..b748bfcd8 100644 --- a/examples/nrf52840/src/bin/uart_split.rs +++ b/examples/nrf52840/src/bin/uart_split.rs | |||
| @@ -46,7 +46,7 @@ async fn main(spawner: Spawner) { | |||
| 46 | // back out the buffer we receive from the read | 46 | // back out the buffer we receive from the read |
| 47 | // task. | 47 | // task. |
| 48 | loop { | 48 | loop { |
| 49 | let buf = CHANNEL.recv().await; | 49 | let buf = CHANNEL.receive().await; |
| 50 | info!("writing..."); | 50 | info!("writing..."); |
| 51 | unwrap!(tx.write(&buf).await); | 51 | unwrap!(tx.write(&buf).await); |
| 52 | } | 52 | } |
diff --git a/examples/rp/src/bin/lora_p2p_send_multicore.rs b/examples/rp/src/bin/lora_p2p_send_multicore.rs index 89a62818d..b54cc92f6 100644 --- a/examples/rp/src/bin/lora_p2p_send_multicore.rs +++ b/examples/rp/src/bin/lora_p2p_send_multicore.rs | |||
| @@ -113,7 +113,7 @@ async fn core1_task( | |||
| 113 | }; | 113 | }; |
| 114 | 114 | ||
| 115 | loop { | 115 | loop { |
| 116 | let buffer: [u8; 3] = CHANNEL.recv().await; | 116 | let buffer: [u8; 3] = CHANNEL.receive().await; |
| 117 | match lora.prepare_for_tx(&mdltn_params, 20, false).await { | 117 | match lora.prepare_for_tx(&mdltn_params, 20, false).await { |
| 118 | Ok(()) => {} | 118 | Ok(()) => {} |
| 119 | Err(err) => { | 119 | Err(err) => { |
diff --git a/examples/rp/src/bin/multicore.rs b/examples/rp/src/bin/multicore.rs index 893b724bf..bf017f6a7 100644 --- a/examples/rp/src/bin/multicore.rs +++ b/examples/rp/src/bin/multicore.rs | |||
| @@ -56,7 +56,7 @@ async fn core0_task() { | |||
| 56 | async fn core1_task(mut led: Output<'static, PIN_25>) { | 56 | async fn core1_task(mut led: Output<'static, PIN_25>) { |
| 57 | info!("Hello from core 1"); | 57 | info!("Hello from core 1"); |
| 58 | loop { | 58 | loop { |
| 59 | match CHANNEL.recv().await { | 59 | match CHANNEL.receive().await { |
| 60 | LedState::On => led.set_high(), | 60 | LedState::On => led.set_high(), |
| 61 | LedState::Off => led.set_low(), | 61 | LedState::Off => led.set_low(), |
| 62 | } | 62 | } |
diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index 02c475f66..8e97e85eb 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs | |||
| @@ -49,12 +49,12 @@ impl<'a> Leds<'a> { | |||
| 49 | 49 | ||
| 50 | async fn show(&mut self) { | 50 | async fn show(&mut self) { |
| 51 | self.leds[self.current_led].set_high(); | 51 | self.leds[self.current_led].set_high(); |
| 52 | if let Ok(new_message) = with_timeout(Duration::from_millis(500), CHANNEL.recv()).await { | 52 | if let Ok(new_message) = with_timeout(Duration::from_millis(500), CHANNEL.receive()).await { |
| 53 | self.leds[self.current_led].set_low(); | 53 | self.leds[self.current_led].set_low(); |
| 54 | self.process_event(new_message).await; | 54 | self.process_event(new_message).await; |
| 55 | } else { | 55 | } else { |
| 56 | self.leds[self.current_led].set_low(); | 56 | self.leds[self.current_led].set_low(); |
| 57 | if let Ok(new_message) = with_timeout(Duration::from_millis(200), CHANNEL.recv()).await { | 57 | if let Ok(new_message) = with_timeout(Duration::from_millis(200), CHANNEL.receive()).await { |
| 58 | self.process_event(new_message).await; | 58 | self.process_event(new_message).await; |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
diff --git a/examples/stm32h5/src/bin/usart_split.rs b/examples/stm32h5/src/bin/usart_split.rs index debd6f454..a6b2e690b 100644 --- a/examples/stm32h5/src/bin/usart_split.rs +++ b/examples/stm32h5/src/bin/usart_split.rs | |||
| @@ -44,7 +44,7 @@ async fn main(spawner: Spawner) -> ! { | |||
| 44 | unwrap!(spawner.spawn(reader(rx))); | 44 | unwrap!(spawner.spawn(reader(rx))); |
| 45 | 45 | ||
| 46 | loop { | 46 | loop { |
| 47 | let buf = CHANNEL.recv().await; | 47 | let buf = CHANNEL.receive().await; |
| 48 | info!("writing..."); | 48 | info!("writing..."); |
| 49 | unwrap!(tx.write(&buf).await); | 49 | unwrap!(tx.write(&buf).await); |
| 50 | } | 50 | } |
diff --git a/examples/stm32h7/src/bin/usart_split.rs b/examples/stm32h7/src/bin/usart_split.rs index 330d1ce09..aa0753450 100644 --- a/examples/stm32h7/src/bin/usart_split.rs +++ b/examples/stm32h7/src/bin/usart_split.rs | |||
| @@ -44,7 +44,7 @@ async fn main(spawner: Spawner) -> ! { | |||
| 44 | unwrap!(spawner.spawn(reader(rx))); | 44 | unwrap!(spawner.spawn(reader(rx))); |
| 45 | 45 | ||
| 46 | loop { | 46 | loop { |
| 47 | let buf = CHANNEL.recv().await; | 47 | let buf = CHANNEL.receive().await; |
| 48 | info!("writing..."); | 48 | info!("writing..."); |
| 49 | unwrap!(tx.write(&buf).await); | 49 | unwrap!(tx.write(&buf).await); |
| 50 | } | 50 | } |
diff --git a/tests/rp/src/bin/gpio_multicore.rs b/tests/rp/src/bin/gpio_multicore.rs index 780112bc1..611cecb76 100644 --- a/tests/rp/src/bin/gpio_multicore.rs +++ b/tests/rp/src/bin/gpio_multicore.rs | |||
| @@ -38,11 +38,11 @@ async fn core0_task(p: PIN_0) { | |||
| 38 | let mut pin = Output::new(p, Level::Low); | 38 | let mut pin = Output::new(p, Level::Low); |
| 39 | 39 | ||
| 40 | CHANNEL0.send(()).await; | 40 | CHANNEL0.send(()).await; |
| 41 | CHANNEL1.recv().await; | 41 | CHANNEL1.receive().await; |
| 42 | 42 | ||
| 43 | pin.set_high(); | 43 | pin.set_high(); |
| 44 | 44 | ||
| 45 | CHANNEL1.recv().await; | 45 | CHANNEL1.receive().await; |
| 46 | 46 | ||
| 47 | info!("Test OK"); | 47 | info!("Test OK"); |
| 48 | cortex_m::asm::bkpt(); | 48 | cortex_m::asm::bkpt(); |
| @@ -52,7 +52,7 @@ async fn core0_task(p: PIN_0) { | |||
| 52 | async fn core1_task(p: PIN_1) { | 52 | async fn core1_task(p: PIN_1) { |
| 53 | info!("CORE1 is running"); | 53 | info!("CORE1 is running"); |
| 54 | 54 | ||
| 55 | CHANNEL0.recv().await; | 55 | CHANNEL0.receive().await; |
| 56 | 56 | ||
| 57 | let mut pin = Input::new(p, Pull::Down); | 57 | let mut pin = Input::new(p, Pull::Down); |
| 58 | let wait = pin.wait_for_rising_edge(); | 58 | let wait = pin.wait_for_rising_edge(); |
diff --git a/tests/rp/src/bin/multicore.rs b/tests/rp/src/bin/multicore.rs index 114889dec..c4579e5bb 100644 --- a/tests/rp/src/bin/multicore.rs +++ b/tests/rp/src/bin/multicore.rs | |||
| @@ -34,7 +34,7 @@ async fn core0_task() { | |||
| 34 | info!("CORE0 is running"); | 34 | info!("CORE0 is running"); |
| 35 | let ping = true; | 35 | let ping = true; |
| 36 | CHANNEL0.send(ping).await; | 36 | CHANNEL0.send(ping).await; |
| 37 | let pong = CHANNEL1.recv().await; | 37 | let pong = CHANNEL1.receive().await; |
| 38 | assert_eq!(ping, pong); | 38 | assert_eq!(ping, pong); |
| 39 | 39 | ||
| 40 | info!("Test OK"); | 40 | info!("Test OK"); |
| @@ -44,6 +44,6 @@ async fn core0_task() { | |||
| 44 | #[embassy_executor::task] | 44 | #[embassy_executor::task] |
| 45 | async fn core1_task() { | 45 | async fn core1_task() { |
| 46 | info!("CORE1 is running"); | 46 | info!("CORE1 is running"); |
| 47 | let ping = CHANNEL0.recv().await; | 47 | let ping = CHANNEL0.receive().await; |
| 48 | CHANNEL1.send(ping).await; | 48 | CHANNEL1.send(ping).await; |
| 49 | } | 49 | } |
