aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2021-12-10 10:47:34 +0100
committerUlf Lilleengen <[email protected]>2021-12-10 10:47:34 +0100
commit7568d0bb68b5d37adf6229ac57c0c961a2a9e803 (patch)
tree275be0ed72805adc2bad0652dfa99d20e7b1d11a /docs
parent439e317ba30a9a2eec3a3fcc46c88e3f665580e5 (diff)
More on traits and notes on time
Diffstat (limited to 'docs')
-rw-r--r--docs/modules/ROOT/pages/runtime.adoc12
-rw-r--r--docs/modules/ROOT/pages/traits.adoc11
2 files changed, 17 insertions, 6 deletions
diff --git a/docs/modules/ROOT/pages/runtime.adoc b/docs/modules/ROOT/pages/runtime.adoc
index 39cf2545e..2970bd59e 100644
--- a/docs/modules/ROOT/pages/runtime.adoc
+++ b/docs/modules/ROOT/pages/runtime.adoc
@@ -1,6 +1,8 @@
1= Embassy runtime 1= Embassy runtime
2 2
3The Embassy executor is an async/await executor designed for embedded usage. 3The Embassy runtime is an async/await executor designed for embedded usage along with support functionality for interrupts and timers.
4
5== Features
4 6
5* No `alloc`, no heap needed. Task are statically allocated. 7* No `alloc`, no heap needed. Task are statically allocated.
6* No "fixed capacity" data structures, executor works with 1 or 1000 tasks without needing config/tuning. 8* No "fixed capacity" data structures, executor works with 1 or 1000 tasks without needing config/tuning.
@@ -26,3 +28,11 @@ Interrupts are a common way for peripherals to signal completion of some operati
26The peripheral HAL then (4) ensures that interrupt signals are routed to to the peripheral and updating the peripheral state with the results of the operation. The executor is then (5) notified that the task should be polled, which it will do. 28The peripheral HAL then (4) ensures that interrupt signals are routed to to the peripheral and updating the peripheral state with the results of the operation. The executor is then (5) notified that the task should be polled, which it will do.
27 29
28image::embassy_irq.png[Interrupt handling] 30image::embassy_irq.png[Interrupt handling]
31
32== Time
33
34Embassy features an internal timer queue enabled by the `time` feature flag. When enabled, Embassy assumes a time `Driver` implementation existing for the platform. Embassy provides time drivers for the nRF, STM32, RPi Pico, WASM and Std platforms.
35
36The timer driver implementations for the embedded platforms support a fixed number of alarms that can be set, which is normally the number of tasks you expect wanting to use the timer at the same time.
37
38NOTE: If you do not require timers in your application, not enabling the `time` feature can save some CPU cycles and reduce power usage.
diff --git a/docs/modules/ROOT/pages/traits.adoc b/docs/modules/ROOT/pages/traits.adoc
index 39e714127..96f3e88bb 100644
--- a/docs/modules/ROOT/pages/traits.adoc
+++ b/docs/modules/ROOT/pages/traits.adoc
@@ -1,8 +1,9 @@
1= Embassy Traits 1= Embassy Traits
2 2
3Embassy provides a set of traits and types specifically designed for `async` usage. 3Embassy provides a set of traits and types specifically designed for `async` usage. Many of these futures will be upstreamed to the `embedded-hal` crate at some point in the future, probably when the required GAT (Generic Associated Types) feature is stabilized in Rust.
4 4
5* `embassy::io`: `AsyncBufRead`, `AsyncWrite`. Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`. 5* `embassy::io`: `AsyncBufRead`, `AsyncWrite`. Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`. The primary reason for re-defining these traits is that the `futures::io` variant requires `std::io::Error`, which does not work in the `no_std` environment.
6* `embassy::traits::flash`: Flash device trait. 6* `embassy::traits`: Async traits for Flash, SPI, I2C, UART, RNG, GPIO and more.
7* `embassy::time`: `Clock` and `Alarm` traits. Std-like `Duration` and `Instant`. 7* `embassy::time`: Time `Driver` trait that is implemented for different platforms. Time in Embassy is represented using the `Duration` and `Instant` types.
8* More traits for SPI, I2C, UART async HAL coming soon. 8
9These traits are implemented by the platform-specific crates, such as `embassy-nrf` or `embassy-stm32`.