Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtic_sync channels #983

Open
maiteas opened this issue Oct 22, 2024 · 4 comments
Open

rtic_sync channels #983

maiteas opened this issue Oct 22, 2024 · 4 comments

Comments

@maiteas
Copy link

maiteas commented Oct 22, 2024

Hi, I'm trying to implement RTIC code using channels, but I keep getting an error. Could you please share an example where two or more tasks communicate through channels? I can only find the example from the book at https://rtic.rs/2/book/en/by-example/channel.html. I based my implementation on that, but it didn't work, and I couldn't find any additional information online and I don't have any ideia how to make it works. Please help me! Thank you!

@Erhannis
Copy link

I'm just passing through, but, what error are you getting?

@AfoHT
Copy link
Contributor

AfoHT commented Oct 30, 2024

Have a look at https://github.com/rtic-rs/rtic/tree/master/examples/stm32f411_adc_and_mpsc_channel and the various async-channel* examples here: https://github.com/rtic-rs/rtic/blob/master/examples/lm3s6965/examples/async-channel-done.rs

And as @Erhannis kindly suggested, to get any help you need to provide something a bit more detailed, what you tried, results etc.!

@maiteas
Copy link
Author

maiteas commented Oct 30, 2024

Hello guys, thank you so much for your help. I really apreciate. Well, I did an example and it worked. But I have a question to ask. I'm sending a led state by this channel and it's not possible to see the state changing thought the led. Because it happens so fast. So my question is: can I use time function using async channels in RTIC?

@Erhannis
Copy link

@maiteas To delay for a time, I use

use rtic_monotonics::rp2040::prelude::*; // There's probably similar things for different platforms
rp2040_timer_monotonic!(Mono);
...
async fn whatever_your_function_is(...) -> ... {
  ...
  Mono::delay(500_u64.millis()).await; // This bit's the important bit
  ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants