aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf52840/src/bin/pubsub.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/nrf52840/src/bin/pubsub.rs')
-rw-r--r--examples/nrf52840/src/bin/pubsub.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/nrf52840/src/bin/pubsub.rs b/examples/nrf52840/src/bin/pubsub.rs
index cca60ebc9..17d902227 100644
--- a/examples/nrf52840/src/bin/pubsub.rs
+++ b/examples/nrf52840/src/bin/pubsub.rs
@@ -6,7 +6,7 @@ use defmt::unwrap;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; 7use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
8use embassy_sync::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; 8use embassy_sync::pubsub::{DynSubscriber, PubSubChannel, Subscriber};
9use embassy_time::{Duration, Timer}; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12/// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher 12/// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher
@@ -39,7 +39,7 @@ async fn main(spawner: Spawner) {
39 39
40 let mut index = 0; 40 let mut index = 0;
41 loop { 41 loop {
42 Timer::after(Duration::from_millis(500)).await; 42 Timer::after_millis(500).await;
43 43
44 let message = match index % 3 { 44 let message = match index % 3 {
45 0 => Message::A, 45 0 => Message::A,
@@ -81,7 +81,7 @@ async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Messa
81async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { 81async fn slow_logger(mut messages: DynSubscriber<'static, Message>) {
82 loop { 82 loop {
83 // Do some work 83 // Do some work
84 Timer::after(Duration::from_millis(2000)).await; 84 Timer::after_millis(2000).await;
85 85
86 // If the publisher has used the `publish_immediate` function, then we may receive a lag message here 86 // If the publisher has used the `publish_immediate` function, then we may receive a lag message here
87 let message = messages.next_message().await; 87 let message = messages.next_message().await;
@@ -98,7 +98,7 @@ async fn slow_logger(mut messages: DynSubscriber<'static, Message>) {
98async fn slow_logger_pure(mut messages: DynSubscriber<'static, Message>) { 98async fn slow_logger_pure(mut messages: DynSubscriber<'static, Message>) {
99 loop { 99 loop {
100 // Do some work 100 // Do some work
101 Timer::after(Duration::from_millis(2000)).await; 101 Timer::after_millis(2000).await;
102 102
103 // Instead of receiving lags here, we just ignore that and read the next message 103 // Instead of receiving lags here, we just ignore that and read the next message
104 let message = messages.next_message_pure().await; 104 let message = messages.next_message_pure().await;