Skip to content

Commit 5a50693

Browse files
committed
Minor cleanup; clarify Timer type use cases
1 parent 649f9f9 commit 5a50693

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ Further, `async-io` has a non-trivial set of dependencies (again - for MCUs; for
3939

4040
## Enhancements
4141

42-
The `Timer` type of `async_io_mini` is based on the `embassy-time` crate, and as such should offer a higher resolution on embedded operating systems like the ESP-IDF than what can be normally achieved by implementing timers using the `timeout` parameter of the `select` syscall.
42+
The `Timer` type of `async_io_mini` is based on the `embassy-time` crate, and as such should offer a higher resolution on embedded operating systems like the ESP-IDF than what can be normally achieved by implementing timers using the `timeout` parameter of the `select` syscall (as `async-io` does).
4343

4444
The reason for this is that on the ESP-IDF, the `timeout` parameter of `select` provides a minimum resolution of 10ms (one FreeRTOS sys-tick), while
4545
`embassy-time` is implemented using ESP-IDF Timer service, which provides resolutions up to 1 microsecond.
4646

47+
With that said, for greenfield code that does not need to be compatible with `async-io`, use the native `embassy_time::Timer` and `embassy_time::Ticker` rather than `async_io_mini::Timer`, because the latter has a larger memory footprint (40 bytes on 32bit archs) compared to the `embassy-time` types (8 and 16 bytes each).
48+
4749
## Limitations
4850

4951
### No equivalent of `async_io::block_on`

src/timer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ use std::time::Instant;
4848
/// .await?;
4949
/// # std::io::Result::Ok(()) });
5050
/// ```
51-
//#[derive(Debug)] TODO
5251
pub struct Timer {
5352
when: Option<Instant>,
5453
period: Duration,

0 commit comments

Comments
 (0)