diff options
| -rw-r--r-- | .vscode/settings.json | 3 | ||||
| -rw-r--r-- | Cargo.example.toml | 93 | ||||
| -rw-r--r-- | README.md | 25 |
3 files changed, 23 insertions, 98 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index a35be8054..b229f7eb6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json | |||
| @@ -16,7 +16,8 @@ | |||
| 16 | //"embassy-net/pool-16", | 16 | //"embassy-net/pool-16", |
| 17 | ], | 17 | ], |
| 18 | "rust-analyzer.linkedProjects": [ | 18 | "rust-analyzer.linkedProjects": [ |
| 19 | "examples/stm32f1/Cargo.toml" | 19 | // Declare for the target you wish to develop |
| 20 | "examples/nrf/Cargo.toml" | ||
| 20 | ], | 21 | ], |
| 21 | "rust-analyzer.procMacro.enable": true, | 22 | "rust-analyzer.procMacro.enable": true, |
| 22 | "rust-analyzer.cargo.runBuildScripts": true, | 23 | "rust-analyzer.cargo.runBuildScripts": true, |
diff --git a/Cargo.example.toml b/Cargo.example.toml deleted file mode 100644 index 3fa8a32e9..000000000 --- a/Cargo.example.toml +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | # This file is a template for a Cargo workspace for developer convenience. | ||
| 2 | # | ||
| 3 | # Since Cargo resolves all features for all crates in the workspace together, | ||
| 4 | # it is not possible to have a workspace with all the crates together, since they | ||
| 5 | # enable incompatible features. For example, nrf crates enable embassy-macros/nrf | ||
| 6 | # and stm32 crates enable embassy-macros/stm32. embassy-macros doesn't support having | ||
| 7 | # both of these features on at the same time, because it makes no sense. | ||
| 8 | # | ||
| 9 | # Instead, we provide this template so you can enable only the crates you're going to | ||
| 10 | # work on. This makes eg rust-analyzer check-on-save and autocomplete work, but only | ||
| 11 | # in these crates, without any feature conflict. | ||
| 12 | # | ||
| 13 | # Copy this file to `Cargo.toml` and uncomment one group of crates below. | ||
| 14 | # | ||
| 15 | # `/Cargo.toml` is already in .gitignore, so you don't commit it accidentally. | ||
| 16 | |||
| 17 | [workspace] | ||
| 18 | resolver = "2" | ||
| 19 | |||
| 20 | members = [ | ||
| 21 | "embassy", | ||
| 22 | "embassy-traits", | ||
| 23 | "embassy-macros", | ||
| 24 | "embassy-hal-common", | ||
| 25 | "embassy-net", | ||
| 26 | |||
| 27 | # Uncomment ONLY ONE of the groups below. | ||
| 28 | |||
| 29 | # nRF | ||
| 30 | #"embassy-nrf", | ||
| 31 | #"examples/nrf", | ||
| 32 | |||
| 33 | # stm32 | ||
| 34 | #"embassy-stm32", | ||
| 35 | #"stm32-metapac", | ||
| 36 | # uncomment ONLY ONE example crate. | ||
| 37 | #"examples/stm32f0", | ||
| 38 | #"examples/stm32f1", | ||
| 39 | #"examples/stm32f4", | ||
| 40 | #"examples/stm32f7", | ||
| 41 | #"examples/stm32g0", | ||
| 42 | #"examples/stm32h7", | ||
| 43 | #"examples/stm32l0", | ||
| 44 | #"examples/stm32l1", | ||
| 45 | #"examples/stm32l4", | ||
| 46 | #"examples/stm32wb55", | ||
| 47 | #"examples/stm32wl55", | ||
| 48 | |||
| 49 | # rp2040 | ||
| 50 | #"embassy-rp", | ||
| 51 | #"examples/rp", | ||
| 52 | |||
| 53 | # std | ||
| 54 | #"examples/std", | ||
| 55 | ] | ||
| 56 | |||
| 57 | exclude = [ | ||
| 58 | # This is only built as a build-dependency, for the host. It shouldn't | ||
| 59 | # get built for the target. | ||
| 60 | "stm32-metapac-gen" | ||
| 61 | ] | ||
| 62 | |||
| 63 | [profile.dev] | ||
| 64 | codegen-units = 1 | ||
| 65 | debug = 2 | ||
| 66 | debug-assertions = true | ||
| 67 | incremental = false | ||
| 68 | opt-level = 3 | ||
| 69 | overflow-checks = true | ||
| 70 | |||
| 71 | [profile.release] | ||
| 72 | codegen-units = 1 | ||
| 73 | debug = 2 | ||
| 74 | debug-assertions = false | ||
| 75 | incremental = false | ||
| 76 | lto = "fat" | ||
| 77 | opt-level = 's' | ||
| 78 | overflow-checks = false | ||
| 79 | |||
| 80 | # do not optimize proc-macro crates = faster builds from scratch | ||
| 81 | [profile.dev.build-override] | ||
| 82 | codegen-units = 8 | ||
| 83 | debug = false | ||
| 84 | debug-assertions = false | ||
| 85 | opt-level = 0 | ||
| 86 | overflow-checks = false | ||
| 87 | |||
| 88 | [profile.release.build-override] | ||
| 89 | codegen-units = 8 | ||
| 90 | debug = false | ||
| 91 | debug-assertions = false | ||
| 92 | opt-level = 0 | ||
| 93 | overflow-checks = false | ||
| @@ -28,9 +28,10 @@ The `embassy::executor` module provides an async/await executor designed for emb | |||
| 28 | 28 | ||
| 29 | `embassy::util` contains some lightweight async/await utilities, mainly helpful for async driver development (signaling a task that an interrupt has occured, for example). | 29 | `embassy::util` contains some lightweight async/await utilities, mainly helpful for async driver development (signaling a task that an interrupt has occured, for example). |
| 30 | 30 | ||
| 31 | ## embassy-nrf | 31 | ## HALs |
| 32 | 32 | ||
| 33 | The `embassy-nrf` crate contains implementations for nRF 52 series SoCs. | 33 | Hardware Absraction Layers with asynchronous behaviors are provided for a variety of platforms. |
| 34 | For example, the `embassy-nrf` crate contains implementations for nRF 52 series SoCs. | ||
| 34 | 35 | ||
| 35 | - `uarte`: UARTE driver implementing `AsyncBufRead` and `AsyncWrite`. | 36 | - `uarte`: UARTE driver implementing `AsyncBufRead` and `AsyncWrite`. |
| 36 | - `qspi`: QSPI driver implementing `Flash`. | 37 | - `qspi`: QSPI driver implementing `Flash`. |
| @@ -41,7 +42,8 @@ The `embassy-nrf` crate contains implementations for nRF 52 series SoCs. | |||
| 41 | 42 | ||
| 42 | ## Examples | 43 | ## Examples |
| 43 | 44 | ||
| 44 | Examples are found in the `examples/` folder seperated by the chip manufacturer they are designed to run on: | 45 | Examples are found in the `examples/` folder seperated by the chip manufacturer they are designed to run on. For example: |
| 46 | |||
| 45 | * `examples/nrf` are designed to run on the `nrf52840-dk` board (PCA10056) but should be easily adaptable to other nRF52 chips and boards. | 47 | * `examples/nrf` are designed to run on the `nrf52840-dk` board (PCA10056) but should be easily adaptable to other nRF52 chips and boards. |
| 46 | * `examples/rp` are for the RP2040 chip. | 48 | * `examples/rp` are for the RP2040 chip. |
| 47 | * `examples/stm32` are designed for the STM32F429ZI chip but should be easily adaptable to other STM32F4xx chips. | 49 | * `examples/stm32` are designed for the STM32F429ZI chip but should be easily adaptable to other STM32F4xx chips. |
| @@ -61,12 +63,27 @@ git submodule update | |||
| 61 | cargo install probe-run | 63 | cargo install probe-run |
| 62 | ``` | 64 | ``` |
| 63 | 65 | ||
| 66 | - Change directory to the sample's base directory. For example: | ||
| 67 | |||
| 68 | ``` | ||
| 69 | cd examples/nrf | ||
| 70 | ``` | ||
| 71 | |||
| 64 | - Run the example | 72 | - Run the example |
| 65 | 73 | ||
| 74 | For example: | ||
| 75 | |||
| 66 | ``` | 76 | ``` |
| 67 | cargo run --bin rtc_async | 77 | cargo run --bin blinky |
| 68 | ``` | 78 | ``` |
| 69 | 79 | ||
| 80 | ## Developing Embassy with Rust Analyzer based editors | ||
| 81 | |||
| 82 | The [Rust Analyzer](https://rust-analyzer.github.io/) is used by [Visual Studio Code](https://code.visualstudio.com/) | ||
| 83 | and others. Given the multiple targets that Embassy serves, there is no Cargo workspace file. Instead, the Rust Analyzer | ||
| 84 | must be told of the target project to work with. In the case of Visual Studio Code, | ||
| 85 | please refer to the `.vscode/settings.json` file's `rust-analyzer.linkedProjects`setting. | ||
| 86 | |||
| 70 | ## Minimum supported Rust version (MSRV) | 87 | ## Minimum supported Rust version (MSRV) |
| 71 | 88 | ||
| 72 | Required nightly version is specified in the `rust-toolchain.toml` file. Nightly is required for: | 89 | Required nightly version is specified in the `rust-toolchain.toml` file. Nightly is required for: |
