Commit Graph

111 Commits

Author SHA1 Message Date
Adam Greig
0621e957a0
time: Update examples, tests, and other code to use new Timer::after_x convenience methods 2023-10-15 01:30:12 +01:00
Adam Greig
c8fdbe19f9
time: Add convenience methods for Timer::after_secs/millis/micros/ticks 2023-10-15 00:47:55 +01:00
Dániel Buga
02d2c06b23 Release embassy-time 0.1.4 2023-10-12 18:14:33 +02:00
Dario Nieuwenhuis
70a91945fc stm32: remove atomic-polyfill. 2023-10-12 02:07:26 +02:00
Dániel Buga
e8a462768e Add more tick rates 2023-09-28 19:06:38 +02:00
Dániel Buga
b9ef831ff7 Add 80MHz tick rate 2023-09-28 09:41:35 +02:00
Ulf Lilleengen
4907ccaa4d
Merge pull request #1839 from Frostie314159/embassy-time-next
embassy-time: Introduce reset function for Ticker.
2023-09-12 22:11:21 +00:00
Frostie314159
527bdc57b9
Fixed formating. 2023-09-11 08:04:06 +02:00
Dario Nieuwenhuis
9baa3bafb0
Merge pull request #1854 from bugadani/str
embassy-{net, sync, time}: Use fmt::unwrap
2023-09-03 00:35:21 +02:00
Dániel Buga
0c66636d00 Use fmt::unwrap 2023-09-02 08:39:52 +02:00
Dario Nieuwenhuis
5e613d9abb Sync all fmt.rs files. 2023-08-30 01:37:18 +02:00
Frostie314159
de01fe352b
Removed unnecessary newline. 2023-08-29 08:35:29 +02:00
Frostie314159
70662ec4ba
embassy-time: Introduced reset function for Ticker 2023-08-29 08:29:38 +02:00
Jesse Braham
1f63bf4153 Release embassy-time v0.1.3 2023-08-28 08:00:18 -07:00
Dániel Buga
a2c718f61c Bump executor crate version to 0.3.0 2023-08-23 20:34:37 +02:00
Dario Nieuwenhuis
f26dd54f63
Update embedded-hal to 1.0.0-rc.1 (#1783) 2023-08-16 00:40:56 +02:00
Sebastian Goll
c40b944da6 Mark Ticker stream as FusedStream 2023-08-09 00:17:02 +02:00
Dario Nieuwenhuis
dff9bd9711 Remove trivial to remove uses of atomic-polyfill. 2023-07-12 18:30:43 +02:00
James Waples
05c524a7db Enable critical-section/std when using std feature of embassy-time 2023-07-08 11:20:26 +01:00
Dario Nieuwenhuis
d137286981 Release embassy-time v0.1.2 2023-07-06 01:29:44 +02:00
Rasmus Pedersen
a0dc87d64e Remove semicolon in time driver example struct declaration
The semicolon is not allowed with struct declarations with braces.
The doc test compiles fine for some reason!?
2023-07-05 14:07:05 +02:00
Dario Nieuwenhuis
a101d9078d update embedded-hal crates. 2023-07-04 19:59:36 +02:00
cumthugo
40d25da793 time: fix queue size 2023-07-04 21:13:31 +08:00
Dario Nieuwenhuis
46961cfdf7 Fix tests. 2023-05-29 19:46:28 +02:00
Dario Nieuwenhuis
df56f901de time: fix unused mut. 2023-05-19 17:38:57 +02:00
Dario Nieuwenhuis
9f7392474b Update Rust nightly. 2023-05-19 17:12:39 +02:00
Dario Nieuwenhuis
a7629299f4 Release embassy-time v0.1.1 2023-04-13 23:57:20 +02:00
Dario Nieuwenhuis
e7ff759f1c time: remove dependency on embassy-sync. 2023-04-13 23:57:20 +02:00
Dario Nieuwenhuis
577f060d24 Release embassy-sync v0.2.0 2023-04-13 23:40:49 +02:00
Dario Nieuwenhuis
be37eee13d Update embedded-hal crates. 2023-04-06 22:41:50 +02:00
Dario Nieuwenhuis
79061021f9 time: add power-of-2 kHz tick rates.
Fixes #1269
2023-03-09 23:32:00 +01:00
Dario Nieuwenhuis
c88bbaa5ec time/ticker: make sure the future for .next() is Unpin. 2023-03-05 23:13:22 +01:00
kbleeke
4e212c7a0b embassy-time: add async tick() method to Ticker 2023-02-28 17:25:42 +01:00
Grant Miller
7be4337de9 Add #[must_use] to all futures 2023-02-24 13:01:41 -06:00
kbleeke
43a4409405 embassy-time: Implement conversions to/from core::time::Duration for embassy-time::Duration 2023-02-23 19:25:22 +01:00
Caleb Jamison
bd7b3bd455 Clamp ticks to 1 and round to nearest. 2023-02-09 20:57:27 -05:00
Caleb Jamison
a4371e9544 Add from_hz function for Duration. 2023-02-09 19:22:06 -05:00
ivmarkov
34b67fe137 STD driver needs a reentrant mutex; logic fixed to be reentrancy-safe 2023-01-26 20:41:18 +00:00
Gabriel Smith
aedcc472c9 time: Fix nighly feature compilation after upgrade to embedded-hal-async
0.2.0-alpha.0
2022-11-27 17:59:01 -05:00
Dario Nieuwenhuis
1e2fb0459d Switch to async-fn-in-trait 2022-11-25 21:02:06 +01:00
Dario Nieuwenhuis
61560e740d time: add missing cargo manifest fields. 2022-10-26 22:18:10 +02:00
Dario Nieuwenhuis
d2246ae693 Release embassy-sync, embassy-time v0.1.0 2022-10-26 22:13:27 +02:00
bors[bot]
e5097a8866
Merge #959
959: Generic, executor-agnostic queue implementation r=ivmarkov a=ivmarkov

Hopefully relatively well documented.

Implementation relies on a fixed-size `SortedLinkedList` from `heapless`. (By default, for up to 128 timer schedules, but we can lower this number to - say - 64.)

As discussed earlier, on queue overflow, the `WakerRegistration` approach is utilized, whereas the waker that is ordered first in the queue is awoken to make room for the incoming one (which might be the waker that would be awoken after all!). Wakers are compared with `Waker::will_wake`, so the queue should actually not fill up that easily, if at all.

I've left provisions for the user to manually instantiate the queue using a dedicated macro - `generic_queue!` so that users willing to adjust the queue size, or users (like me) who have to use the queue in a complex "on-top-of-RTOS-but-the-timer-driver-calling-back-from-ISR" scenario can customize the mutex that protects the queue.

The one thing I'm not completely happy with is the need to call `{ embassy_time::queue::initialize() }` early on before any futures using embassy-time are polled, which is currently on the shoulders of the user. I'm open to any ideas where we can get rid of this and do it on the first call to `_embassy_time_schedule_wake`, without introducing very complex combinations of critical sections, atomics and whatnot.




Co-authored-by: ivmarkov <ivan.markov@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-10-26 19:14:12 +00:00
Dario Nieuwenhuis
f9da6271ce time/generic_queue: use Vec instead of SortedLinkedList 2022-10-26 21:00:50 +02:00
Dario Nieuwenhuis
4976cbbe60 time/generic-queue: ensure queue goes in .bss instead of .data 2022-10-26 20:02:58 +02:00
ivmarkov
ac6995f9e6 Fix a bug identified during code review 2022-10-26 17:48:22 +03:00
Dario Nieuwenhuis
eeb072d9cb Update Rust nightly. 2022-10-26 16:47:29 +02:00
ivmarkov
516f4ce946 Fix embassy-time wasm build and fix a bug in wasm time driver 2022-10-24 12:15:53 +03:00
ivmarkov
4d5550070f Change time Driver contract to never fire the alarm synchronously 2022-10-24 09:17:43 +03:00
ivmarkov
53608a87ac Address feedback after code review 2022-10-24 08:21:35 +03:00
ivmarkov
ba6e452cc5 Documentation and initial testing framework
Add mock waker

First simple test

Tests & documentation
2022-10-24 08:21:31 +03:00
ivmarkov
c2404ee8ca Initial generic timer queue impl 2022-10-24 08:20:29 +03:00
chrysn
6718ca3a94 all Cargo.toml: Add license to all crate Cargo.toml files
Closes: https://github.com/embassy-rs/embassy/issues/1002
2022-10-07 12:41:56 +02:00
Ulf Lilleengen
72c2e985bb Update embedded-hal versions and explicitly pin 2022-09-29 11:27:46 +02:00
Dario Nieuwenhuis
897b72c872 Update Rust nightly.
Removes feature(generic_associated_types)
2022-09-22 16:38:14 +02:00
Dario Nieuwenhuis
5327b9c289 time: add more tick rates, use 1mhz as default. 2022-09-02 00:59:34 +02:00
Dario Nieuwenhuis
8ba421f324 Do not use cfg_if for embedded-hal-async feature gates.
Old code used `cfg_if!` because rustc still parses code inside disabled cfg's, and Rust stable at that time couldn't parse the new GAT where-clause location. This is not the case anymore.
2022-08-31 03:11:21 +02:00
Ulf Lilleengen
bd4ae2e952 Enable 'std' feature on critical-section for WASM
This fixes the WASM support which was failing due to missing
critical-section implementation. This also upgrades the bindgen
dependency and ensures that tooling works.
2022-08-23 20:00:34 +02:00
Ulf Lilleengen
189d4137cc Add readme for embassy-time 2022-08-23 13:58:57 +02:00
Ulf Lilleengen
5fddff849e Remove warnings for embassy-time 2022-08-22 16:33:39 +02:00
Dario Nieuwenhuis
5daa173ce4 Split embassy-time from embassy-executor. 2022-08-18 01:22:30 +02:00