27 Mar 2023 |
korken89 | It generates an interrupt on every tick | 16:16:22 |
korken89 | Other monotonics generates interrupts when it's the right time for something to happen | 16:16:42 |
korken89 | So if your do something with 1s interval you'll get one interrupt per second | 16:18:27 |
korken89 | While the systick with generate 999 extra than what is needed | 16:18:50 |
korken89 | It does extremely little, so at 1000 Hz it's not noticable really, but good to know | 16:19:19 |
korken89 | Félix the Newbie: ^ | 16:19:41 |
korken89 | If i have no low power requirements, and don't need smaller times than an milliseconds i use the systick generally | 16:20:37 |
korken89 | For everything else a timer based monotonic :) | 16:21:05 |
korken89 | And if low power is high on the list, an RTC based one | 16:21:55 |
korken89 | Afk, I'm going away until ~21 swedish time :) | 16:26:21 |
rtic-bot | New PR: build(deps): update syn requirement from 1.0.107 to 2.0.10 | 17:06:47 |
rtic-bot | PR closed without merging: build(deps): update syn requirement from 1.0.107 to 2.0.3 | 17:06:51 |
Félix the Newbie | In reply to @korken89:matrix.org And if low power is high on the list, an RTC based one I'd like to ask you a few things, but I don't want to spam this chat. Do you prefer to go PM? | 18:24:00 |
| kulst joined the room. | 20:35:26 |
28 Mar 2023 |
korken89 | In reply to @boiethios:matrix.org I'd like to ask you a few things, but I don't want to spam this chat. Do you prefer to go PM? Both are fine with me:) | 03:57:13 |
Félix the Newbie | In reply to @korken89:matrix.org Both are fine with me:) Thank you! I was thinking about something like that:
pub trait TimeoutHandler {
type Handle;
/// Returns a new handle for a new timeout countdown.
fn create(&mut self, ready_in: u64) -> Self::Handle;
/// Returns weither the given timeout has elapsed or not.
fn elapsed(&self, handle: Self::Handle) -> bool;
}
But the issue is that, IIUC, the tasks are always a function in the app, so I cannot move the receiver around (typically in the timeout handler). How would you do that? Maybe my trait isn't designed correctly.
| 07:25:45 |
korken89 | Hmm I'm not sure I'm following what you're trying to do | 07:51:20 |
Félix the Newbie | An abstraction in my library so that the user can implement a timeout mechanism that I can use in my library. I don't want to tie it directly to RTIC, but I want it to be usable with RTIC. | 07:53:56 |
Félix the Newbie | To put it otherly: I need a timeout mechanism in my library, but it's the user's job to provide it (with RTIC behind the curtain) | 07:55:38 |
Félix the Newbie | Also, a single timeout handler must be able to manage several timeouts at once. | 07:58:40 |
korken89 | Then I'd recommend to use the async-embedded-hal feature flag and use that delay | 08:42:23 |
korken89 | You can then select on the delay and your operation, and have a completely generic impl | 08:42:42 |
korken89 | * Then I'd recommend to use the embedded-hal-async feature flag and use that delay | 08:43:11 |
korken89 | Fore example this enables this part: https://github.com/rtic-rs/rtic/blob/master/rtic-monotonics/src/rp2040.rs#L124 | 08:43:37 |
korken89 | Félix the Newbie: ^ | 08:43:42 |
korken89 | Then you don't need to make your own trait | 08:44:06 |
korken89 | * Then you don't need to make your own trait as well | 08:44:18 |
Félix the Newbie | In reply to @korken89:matrix.org Then I'd recommend to use the embedded-hal-async feature flag and use that delay Sorry for my answer delay, unfortunately, I'm not paid for playing with embedded Rust, so my priority is my actual job 😅 I'm not sure to understand what that DelayUs is used for: isn't that an API to pause the current execution flow? BTW I didn't know it was possible to have async fn in traits. | 19:11:53 |
Félix the Newbie | Also, I wanted to create an abstraction not tied to any hardware, so doesn't it defeat my goal to use embedded_hal_async ? | 19:13:18 |
Félix the Newbie | In reply to @korken89:matrix.org Then I'd recommend to use the embedded-hal-async feature flag and use that delay * Sorry for my answer delay, unfortunately, I'm not paid for playing with embedded Rust, so my priority is my actual job 😅 I'm not sure to understand what that DelayUs is used for: isn't that an API to pause the current execution flow? I don't understand how it can help me to implement a timeout, since the execution is stuck at that point. BTW I didn't know it was possible to have async fn in traits. | 19:18:11 |