diff options
| author | Badr Bouslikhin <[email protected]> | 2024-02-11 19:35:42 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-11 19:35:42 +0100 |
| commit | 2a09996a789af11951131081f0288ddd8b39b126 (patch) | |
| tree | 36906b503e33f5f414c23347d78415cb4cba25dd /embassy-executor/src | |
| parent | c95bf6895adfcd33b5238c02620e83c6713205ce (diff) | |
| parent | edb3989b577a15bed3d0434f25edc20b6f24bf52 (diff) | |
Merge branch 'embassy-rs:main' into usb-dfu-erase-then-write
Diffstat (limited to 'embassy-executor/src')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 3f00be4a8..3d5e3ab9f 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -581,6 +581,15 @@ impl embassy_time_queue_driver::TimerQueue for TimerQueue { | |||
| 581 | #[cfg(feature = "integrated-timers")] | 581 | #[cfg(feature = "integrated-timers")] |
| 582 | embassy_time_queue_driver::timer_queue_impl!(static TIMER_QUEUE: TimerQueue = TimerQueue); | 582 | embassy_time_queue_driver::timer_queue_impl!(static TIMER_QUEUE: TimerQueue = TimerQueue); |
| 583 | 583 | ||
| 584 | #[cfg(all(feature = "rtos-trace", feature = "integrated-timers"))] | ||
| 585 | const fn gcd(a: u64, b: u64) -> u64 { | ||
| 586 | if b == 0 { | ||
| 587 | a | ||
| 588 | } else { | ||
| 589 | gcd(b, a % b) | ||
| 590 | } | ||
| 591 | } | ||
| 592 | |||
| 584 | #[cfg(feature = "rtos-trace")] | 593 | #[cfg(feature = "rtos-trace")] |
| 585 | impl rtos_trace::RtosTraceOSCallbacks for Executor { | 594 | impl rtos_trace::RtosTraceOSCallbacks for Executor { |
| 586 | fn task_list() { | 595 | fn task_list() { |
| @@ -588,7 +597,8 @@ impl rtos_trace::RtosTraceOSCallbacks for Executor { | |||
| 588 | } | 597 | } |
| 589 | #[cfg(feature = "integrated-timers")] | 598 | #[cfg(feature = "integrated-timers")] |
| 590 | fn time() -> u64 { | 599 | fn time() -> u64 { |
| 591 | Instant::now().as_micros() | 600 | const GCD_1M: u64 = gcd(embassy_time_driver::TICK_HZ, 1_000_000); |
| 601 | embassy_time_driver::now() * (1_000_000 / GCD_1M) / (embassy_time_driver::TICK_HZ / GCD_1M) | ||
| 592 | } | 602 | } |
| 593 | #[cfg(not(feature = "integrated-timers"))] | 603 | #[cfg(not(feature = "integrated-timers"))] |
| 594 | fn time() -> u64 { | 604 | fn time() -> u64 { |
