diff options
| author | Dario Nieuwenhuis <[email protected]> | 2020-09-25 03:50:14 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2020-09-25 03:50:14 +0200 |
| commit | a734a9ff46ffe4f510641c203cd406eeb85bfa03 (patch) | |
| tree | 1df22793515ee3e0be849252b51a97f72fb45693 | |
| parent | 4333105341072bc5391809906c5c68fee1a31a8e (diff) | |
Update README.
| -rw-r--r-- | README.md | 66 |
1 files changed, 61 insertions, 5 deletions
| @@ -2,22 +2,78 @@ | |||
| 2 | 2 | ||
| 3 | Embassy is a project to make async/await a first-class option for embedded development. | 3 | Embassy is a project to make async/await a first-class option for embedded development. |
| 4 | 4 | ||
| 5 | The `embassy` crate defines some traits. | 5 | ## Traits and types |
| 6 | 6 | ||
| 7 | - `embassy::io`: Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`. | 7 | `embassy` provides a set of traits and types specifically designed for `async` usage. |
| 8 | - `embassy::flash`: Trait for an async flash device. | 8 | |
| 9 | - `embassy::io`: `AsyncBufRead`, `AsyncWrite`. Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`. | ||
| 10 | - `embassy::flash`: Flash device trait. | ||
| 11 | - `embassy::time`: `Clock` and `Alarm` traits. Std-like `Duration` and `Instant`. | ||
| 9 | - More traits for SPI, I2C, UART async HAL coming soon. | 12 | - More traits for SPI, I2C, UART async HAL coming soon. |
| 10 | 13 | ||
| 14 | ## Executor with timers | ||
| 15 | |||
| 16 | The `embassy::executor` module provides an async/await executor based on [static-executor](https://github.com/Dirbaio/static-executor). | ||
| 17 | |||
| 18 | - No `alloc`, no heap needed. Task futures are statically allocated. | ||
| 19 | - Integrated timer queue allows simple sleeping: `Timer::after(Duration::from_ticks(64000)).await;`. | ||
| 20 | - Suitable for low-power operation. Using interrupts or `WFE/SEV` ensures the CPU sleeps when there's no work to do. No busy-loop polling. | ||
| 21 | - Creating multiple executor instances is supported, to run tasks with multiple priority levels. This allows higher-priority tasks to preempt lower-priority tasks. (example coming soon) | ||
| 22 | - Compatible with RTIC (example coming soon). | ||
| 23 | |||
| 24 | ## Utils | ||
| 25 | |||
| 26 | `embassy::util` contains some lightweight async/await utilities, mainly helpful for async driver development (signaling a task that an interrupt has occured, for example). | ||
| 27 | |||
| 28 | ## embassy-nrf | ||
| 29 | |||
| 11 | The `embassy-nrf` crate contains implementations for nRF 52 series SoCs. | 30 | The `embassy-nrf` crate contains implementations for nRF 52 series SoCs. |
| 12 | 31 | ||
| 13 | - `uarte`: UARTE driver implementing `AsyncBufRead` and `AsyncWrite`. | 32 | - `uarte`: UARTE driver implementing `AsyncBufRead` and `AsyncWrite`. |
| 14 | - `qspi`: QSPI driver implementing `Flash`. | 33 | - `qspi`: QSPI driver implementing `Flash`. |
| 34 | - `gpiote`: GPIOTE driver. Allows `await`ing GPIO pin changes. Great for reading buttons or receiving interrupts from external chips. | ||
| 35 | - `rtc`: RTC driver implementing `Clock` and `Alarm`, for use with `embassy::executor`. | ||
| 36 | |||
| 37 | ## Running the examples | ||
| 38 | |||
| 39 | Examples are for the nRF52840 chip but should be easily adaptable to other nRF52 chips. | ||
| 40 | |||
| 41 | GPIO pins are set up for the `nrf52840-dk` board (PCA10056) | ||
| 42 | |||
| 43 | - Install `probe-run` with defmt support. | ||
| 44 | |||
| 45 | ``` | ||
| 46 | cargo install --git https://github.com/knurling-rs/probe-run --branch main --features defmt | ||
| 47 | ``` | ||
| 48 | |||
| 49 | - Run the example | ||
| 50 | |||
| 51 | ``` | ||
| 52 | cargo run --bin rtc_async | ||
| 53 | ``` | ||
| 54 | |||
| 55 | ## Using on your project | ||
| 56 | |||
| 57 | `embassy` requires git version of a few dependencies. | ||
| 58 | |||
| 59 | When using `embassy` in your own project, make sure you copy over the `[patch.crates-io]` section from root `Cargo.toml`. | ||
| 60 | |||
| 61 | This will no longer needed after the first crates.io release. | ||
| 62 | |||
| 63 | ## Minimum supported Rust version (MSRV) | ||
| 64 | |||
| 65 | `rustc 1.48.0-nightly (1fd5b9d51 2020-09-20)` | ||
| 66 | |||
| 67 | Any recent nightly should work. Nightly is required for: | ||
| 68 | |||
| 69 | - `generic_associated_types`: for trait funcs returning futures. | ||
| 70 | - `type_alias_impl_trait`: for trait funcs returning futures implemented with `async{}` blocks, and for `static-executor`. | ||
| 15 | 71 | ||
| 16 | Currently Embassy requires a recent nightly, mainly for `generic_associated_types` (for trait funcs returning futures) and `type_alias_impl_trait` (for returning futures implemented with `async{}` blocks). Stable support is a non-goal. | 72 | Stable support is a non-goal until these features get stabilized. |
| 17 | 73 | ||
| 18 | ## Why the name? | 74 | ## Why the name? |
| 19 | 75 | ||
| 20 | EMBedded ASYnc. | 76 | EMBedded ASYnc! :) |
| 21 | 77 | ||
| 22 | ## License | 78 | ## License |
| 23 | 79 | ||
