diff options
| author | Joel Schulz-Andres <[email protected]> | 2024-05-23 15:34:16 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-23 15:34:16 +0200 |
| commit | 0a5820e3ed423af1788072a5416e04ab86c44c2d (patch) | |
| tree | 5a2b8d3d7a88835aebec0914da234d547e3b3dbe /docs | |
| parent | 27e8ef6e7e720a3c74f7c696ab105915695431c5 (diff) | |
| parent | ded1f9d33520fc847dce8fe72f2fb80f6fa86350 (diff) | |
Merge branch 'embassy-rs:main' into add-miso-pullup
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/Makefile | 8 | ||||
| -rw-r--r-- | docs/README.md | 9 | ||||
| -rw-r--r-- | docs/antora.yml | 5 | ||||
| -rw-r--r-- | docs/examples/basic/.cargo/config.toml (renamed from docs/modules/ROOT/examples/basic/.cargo/config.toml) | 0 | ||||
| -rw-r--r-- | docs/examples/basic/Cargo.toml | 18 | ||||
| -rw-r--r-- | docs/examples/basic/build.rs (renamed from docs/modules/ROOT/examples/basic/build.rs) | 0 | ||||
| -rw-r--r-- | docs/examples/basic/memory.x (renamed from docs/modules/ROOT/examples/basic/memory.x) | 0 | ||||
| -rw-r--r-- | docs/examples/basic/src/main.rs (renamed from docs/modules/ROOT/examples/basic/src/main.rs) | 0 | ||||
| l--------- | docs/examples/examples | 1 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/.cargo/config.toml (renamed from docs/modules/ROOT/examples/layer-by-layer/.cargo/config.toml) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/Cargo.toml (renamed from docs/modules/ROOT/examples/layer-by-layer/Cargo.toml) | 4 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-async/Cargo.toml (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-async/src/main.rs (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-hal/Cargo.toml (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-hal/src/main.rs (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-irq/Cargo.toml (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-irq/src/main.rs (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-pac/Cargo.toml (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml) | 0 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-pac/src/main.rs (renamed from docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs) | 0 | ||||
| -rw-r--r-- | docs/images/bootloader_flash.png (renamed from docs/modules/ROOT/images/bootloader_flash.png) | bin | 32147 -> 32147 bytes | |||
| -rw-r--r-- | docs/images/embassy_executor.drawio (renamed from docs/modules/ROOT/images/embassy_executor.drawio) | 0 | ||||
| -rw-r--r-- | docs/images/embassy_executor.png (renamed from docs/modules/ROOT/images/embassy_executor.png) | bin | 121382 -> 121382 bytes | |||
| -rw-r--r-- | docs/images/embassy_irq.drawio (renamed from docs/modules/ROOT/images/embassy_irq.drawio) | 0 | ||||
| -rw-r--r-- | docs/images/embassy_irq.png (renamed from docs/modules/ROOT/images/embassy_irq.png) | bin | 134158 -> 134158 bytes | |||
| -rw-r--r-- | docs/index.adoc | 16 | ||||
| -rw-r--r-- | docs/modules/ROOT/examples/basic/Cargo.toml | 18 | ||||
| l--------- | docs/modules/ROOT/examples/examples | 1 | ||||
| -rw-r--r-- | docs/modules/ROOT/nav.adoc | 19 | ||||
| -rw-r--r-- | docs/pages/basic_application.adoc (renamed from docs/modules/ROOT/pages/basic_application.adoc) | 14 | ||||
| -rw-r--r-- | docs/pages/beginners.adoc | 11 | ||||
| -rw-r--r-- | docs/pages/best_practices.adoc (renamed from docs/modules/ROOT/pages/best_practices.adoc) | 0 | ||||
| -rw-r--r-- | docs/pages/bootloader.adoc (renamed from docs/modules/ROOT/pages/bootloader.adoc) | 0 | ||||
| -rw-r--r-- | docs/pages/developer.adoc (renamed from docs/modules/ROOT/pages/developer.adoc) | 0 | ||||
| -rw-r--r-- | docs/pages/developer_stm32.adoc (renamed from docs/modules/ROOT/pages/developer_stm32.adoc) | 0 | ||||
| -rw-r--r-- | docs/pages/embassy_in_the_wild.adoc (renamed from docs/modules/ROOT/pages/embassy_in_the_wild.adoc) | 6 | ||||
| -rw-r--r-- | docs/pages/examples.adoc (renamed from docs/modules/ROOT/pages/examples.adoc) | 2 | ||||
| -rw-r--r-- | docs/pages/faq.adoc (renamed from docs/modules/ROOT/pages/faq.adoc) | 23 | ||||
| -rw-r--r-- | docs/pages/getting_started.adoc (renamed from docs/modules/ROOT/pages/getting_started.adoc) | 8 | ||||
| -rw-r--r-- | docs/pages/hal.adoc (renamed from docs/modules/ROOT/pages/hal.adoc) | 2 | ||||
| -rw-r--r-- | docs/pages/layer_by_layer.adoc (renamed from docs/modules/ROOT/pages/layer_by_layer.adoc) | 8 | ||||
| -rw-r--r-- | docs/pages/new_project.adoc (renamed from docs/modules/ROOT/pages/new_project.adoc) | 21 | ||||
| -rw-r--r-- | docs/pages/nrf.adoc (renamed from docs/modules/ROOT/pages/nrf.adoc) | 0 | ||||
| -rw-r--r-- | docs/pages/overview.adoc (renamed from docs/modules/ROOT/pages/index.adoc) | 17 | ||||
| -rw-r--r-- | docs/pages/project_structure.adoc (renamed from docs/modules/ROOT/pages/project_structure.adoc) | 12 | ||||
| -rw-r--r-- | docs/pages/runtime.adoc (renamed from docs/modules/ROOT/pages/runtime.adoc) | 0 | ||||
| -rw-r--r-- | docs/pages/sharing_peripherals.adoc (renamed from docs/modules/ROOT/pages/sharing_peripherals.adoc) | 2 | ||||
| -rw-r--r-- | docs/pages/stm32.adoc (renamed from docs/modules/ROOT/pages/stm32.adoc) | 0 | ||||
| -rw-r--r-- | docs/pages/system.adoc | 13 | ||||
| -rw-r--r-- | docs/pages/time_keeping.adoc (renamed from docs/modules/ROOT/pages/time_keeping.adoc) | 0 |
49 files changed, 156 insertions, 82 deletions
diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..834802d3b --- /dev/null +++ b/docs/Makefile | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | all: | ||
| 2 | asciidoctor -d book -D book/ index.adoc | ||
| 3 | cp -r images book | ||
| 4 | |||
| 5 | clean: | ||
| 6 | rm -rf book | ||
| 7 | |||
| 8 | .PHONY: all clean | ||
diff --git a/docs/README.md b/docs/README.md index 0bf3a6c89..94ebd7a05 100644 --- a/docs/README.md +++ b/docs/README.md | |||
| @@ -1,4 +1,9 @@ | |||
| 1 | # embassy docs | 1 | # embassy docs |
| 2 | 2 | ||
| 3 | The documentation hosted at [https://embassy.dev/book](https://embassy.dev/book). Building the documentation requires | 3 | The documentation hosted at [https://embassy.dev/book](https://embassy.dev/book). Building the documentation requires the [asciidoctor](https://asciidoctor.org/) tool, and can built running `make` in this folder: |
| 4 | cloning the [embassy-book](https://github.com/embassy-rs/embassy-book) repository and following the instructions. | 4 | |
| 5 | ``` | ||
| 6 | make | ||
| 7 | ``` | ||
| 8 | |||
| 9 | Then open the generated file `thebook/index.html`. | ||
diff --git a/docs/antora.yml b/docs/antora.yml deleted file mode 100644 index 9a00fa820..000000000 --- a/docs/antora.yml +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | name: ROOT | ||
| 2 | title: Embassy | ||
| 3 | version: dev | ||
| 4 | nav: | ||
| 5 | - modules/ROOT/nav.adoc | ||
diff --git a/docs/modules/ROOT/examples/basic/.cargo/config.toml b/docs/examples/basic/.cargo/config.toml index 8ca28df39..8ca28df39 100644 --- a/docs/modules/ROOT/examples/basic/.cargo/config.toml +++ b/docs/examples/basic/.cargo/config.toml | |||
diff --git a/docs/examples/basic/Cargo.toml b/docs/examples/basic/Cargo.toml new file mode 100644 index 000000000..d86d4a809 --- /dev/null +++ b/docs/examples/basic/Cargo.toml | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | [package] | ||
| 2 | authors = ["Dario Nieuwenhuis <[email protected]>"] | ||
| 3 | edition = "2018" | ||
| 4 | name = "embassy-basic-example" | ||
| 5 | version = "0.1.0" | ||
| 6 | license = "MIT OR Apache-2.0" | ||
| 7 | |||
| 8 | [dependencies] | ||
| 9 | embassy-executor = { version = "0.5.0", path = "../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] } | ||
| 10 | embassy-time = { version = "0.3.0", path = "../../../embassy-time", features = ["defmt"] } | ||
| 11 | embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } | ||
| 12 | |||
| 13 | defmt = "0.3" | ||
| 14 | defmt-rtt = "0.3" | ||
| 15 | |||
| 16 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | ||
| 17 | cortex-m-rt = "0.7.0" | ||
| 18 | panic-probe = { version = "0.3", features = ["print-defmt"] } | ||
diff --git a/docs/modules/ROOT/examples/basic/build.rs b/docs/examples/basic/build.rs index 30691aa97..30691aa97 100644 --- a/docs/modules/ROOT/examples/basic/build.rs +++ b/docs/examples/basic/build.rs | |||
diff --git a/docs/modules/ROOT/examples/basic/memory.x b/docs/examples/basic/memory.x index 9b04edec0..9b04edec0 100644 --- a/docs/modules/ROOT/examples/basic/memory.x +++ b/docs/examples/basic/memory.x | |||
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/examples/basic/src/main.rs index 4412712c8..4412712c8 100644 --- a/docs/modules/ROOT/examples/basic/src/main.rs +++ b/docs/examples/basic/src/main.rs | |||
diff --git a/docs/examples/examples b/docs/examples/examples new file mode 120000 index 000000000..d15735c1d --- /dev/null +++ b/docs/examples/examples | |||
| @@ -0,0 +1 @@ | |||
| ../../examples \ No newline at end of file | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/.cargo/config.toml b/docs/examples/layer-by-layer/.cargo/config.toml index 3012f05dc..3012f05dc 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/.cargo/config.toml +++ b/docs/examples/layer-by-layer/.cargo/config.toml | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml b/docs/examples/layer-by-layer/Cargo.toml index 943249a17..0f233eae5 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml +++ b/docs/examples/layer-by-layer/Cargo.toml | |||
| @@ -8,8 +8,8 @@ members = [ | |||
| 8 | ] | 8 | ] |
| 9 | 9 | ||
| 10 | [patch.crates-io] | 10 | [patch.crates-io] |
| 11 | embassy-executor = { path = "../../../../../embassy-executor" } | 11 | embassy-executor = { path = "../../../embassy-executor" } |
| 12 | embassy-stm32 = { path = "../../../../../embassy-stm32" } | 12 | embassy-stm32 = { path = "../../../embassy-stm32" } |
| 13 | 13 | ||
| 14 | [profile.release] | 14 | [profile.release] |
| 15 | codegen-units = 1 | 15 | codegen-units = 1 |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/examples/layer-by-layer/blinky-async/Cargo.toml index 64f7e8403..64f7e8403 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml +++ b/docs/examples/layer-by-layer/blinky-async/Cargo.toml | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs b/docs/examples/layer-by-layer/blinky-async/src/main.rs index 004602816..004602816 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs +++ b/docs/examples/layer-by-layer/blinky-async/src/main.rs | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml index c15de2db2..c15de2db2 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml +++ b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs b/docs/examples/layer-by-layer/blinky-hal/src/main.rs index d0c9f4907..d0c9f4907 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs +++ b/docs/examples/layer-by-layer/blinky-hal/src/main.rs | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml index 9733658b6..9733658b6 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml +++ b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs b/docs/examples/layer-by-layer/blinky-irq/src/main.rs index 743c9d99b..743c9d99b 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs +++ b/docs/examples/layer-by-layer/blinky-irq/src/main.rs | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml index f872b94cb..f872b94cb 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml +++ b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml | |||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs b/docs/examples/layer-by-layer/blinky-pac/src/main.rs index 990d46cb6..990d46cb6 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs +++ b/docs/examples/layer-by-layer/blinky-pac/src/main.rs | |||
diff --git a/docs/modules/ROOT/images/bootloader_flash.png b/docs/images/bootloader_flash.png index 635783b05..635783b05 100644 --- a/docs/modules/ROOT/images/bootloader_flash.png +++ b/docs/images/bootloader_flash.png | |||
| Binary files differ | |||
diff --git a/docs/modules/ROOT/images/embassy_executor.drawio b/docs/images/embassy_executor.drawio index b76587d97..b76587d97 100644 --- a/docs/modules/ROOT/images/embassy_executor.drawio +++ b/docs/images/embassy_executor.drawio | |||
diff --git a/docs/modules/ROOT/images/embassy_executor.png b/docs/images/embassy_executor.png index 2a83a3adb..2a83a3adb 100644 --- a/docs/modules/ROOT/images/embassy_executor.png +++ b/docs/images/embassy_executor.png | |||
| Binary files differ | |||
diff --git a/docs/modules/ROOT/images/embassy_irq.drawio b/docs/images/embassy_irq.drawio index aa439a8e6..aa439a8e6 100644 --- a/docs/modules/ROOT/images/embassy_irq.drawio +++ b/docs/images/embassy_irq.drawio | |||
diff --git a/docs/modules/ROOT/images/embassy_irq.png b/docs/images/embassy_irq.png index 154d336b6..154d336b6 100644 --- a/docs/modules/ROOT/images/embassy_irq.png +++ b/docs/images/embassy_irq.png | |||
| Binary files differ | |||
diff --git a/docs/index.adoc b/docs/index.adoc new file mode 100644 index 000000000..9c6150196 --- /dev/null +++ b/docs/index.adoc | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | :description: Embassy Book | ||
| 2 | :sectanchors: | ||
| 3 | :doctype: book | ||
| 4 | :toc: | ||
| 5 | :toc-placement: left | ||
| 6 | :toclevels: 2 | ||
| 7 | :imagesdir: images | ||
| 8 | |||
| 9 | # Embassy Book | ||
| 10 | |||
| 11 | Welcome to the Embassy Book. The Embassy Book is for everyone who wants to use Embassy and understand how Embassy works. | ||
| 12 | |||
| 13 | include::pages/overview.adoc[leveloffset = 1] | ||
| 14 | include::pages/beginners.adoc[leveloffset = 1] | ||
| 15 | include::pages/system.adoc[leveloffset = 1] | ||
| 16 | include::pages/faq.adoc[leveloffset = 1] | ||
diff --git a/docs/modules/ROOT/examples/basic/Cargo.toml b/docs/modules/ROOT/examples/basic/Cargo.toml deleted file mode 100644 index 2c282145d..000000000 --- a/docs/modules/ROOT/examples/basic/Cargo.toml +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | [package] | ||
| 2 | authors = ["Dario Nieuwenhuis <[email protected]>"] | ||
| 3 | edition = "2018" | ||
| 4 | name = "embassy-basic-example" | ||
| 5 | version = "0.1.0" | ||
| 6 | license = "MIT OR Apache-2.0" | ||
| 7 | |||
| 8 | [dependencies] | ||
| 9 | embassy-executor = { version = "0.5.0", path = "../../../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] } | ||
| 10 | embassy-time = { version = "0.3.0", path = "../../../../../embassy-time", features = ["defmt"] } | ||
| 11 | embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } | ||
| 12 | |||
| 13 | defmt = "0.3" | ||
| 14 | defmt-rtt = "0.3" | ||
| 15 | |||
| 16 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | ||
| 17 | cortex-m-rt = "0.7.0" | ||
| 18 | panic-probe = { version = "0.3", features = ["print-defmt"] } | ||
diff --git a/docs/modules/ROOT/examples/examples b/docs/modules/ROOT/examples/examples deleted file mode 120000 index 1929330b0..000000000 --- a/docs/modules/ROOT/examples/examples +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | ../../../../examples \ No newline at end of file | ||
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc deleted file mode 100644 index 44b0eddb9..000000000 --- a/docs/modules/ROOT/nav.adoc +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | * xref:getting_started.adoc[Getting started] | ||
| 2 | ** xref:basic_application.adoc[Basic application] | ||
| 3 | ** xref:project_structure.adoc[Project Structure] | ||
| 4 | ** xref:new_project.adoc[Starting a new Embassy project] | ||
| 5 | ** xref:best_practices.adoc[Best Practices] | ||
| 6 | * xref:runtime.adoc[Executor] | ||
| 7 | * xref::time_keeping.adoc[Time-keeping] | ||
| 8 | * xref:sharing_peripherals.adoc[Sharing peripherals] | ||
| 9 | * xref:hal.adoc[HAL] | ||
| 10 | ** xref:layer_by_layer.adoc[Anatomy of an async HAL] | ||
| 11 | ** xref:nrf.adoc[nRF] | ||
| 12 | ** xref:stm32.adoc[STM32] | ||
| 13 | * xref:bootloader.adoc[Bootloader] | ||
| 14 | |||
| 15 | * xref:examples.adoc[Examples] | ||
| 16 | * xref:developer.adoc[Developer Docs] | ||
| 17 | ** xref:developer_stm32.adoc[Developer Docs: STM32] | ||
| 18 | * xref:embassy_in_the_wild.adoc[Embassy in the wild] | ||
| 19 | * xref:faq.adoc[Frequently Asked Questions] | ||
diff --git a/docs/modules/ROOT/pages/basic_application.adoc b/docs/pages/basic_application.adoc index d5aad806d..7b4ebda4f 100644 --- a/docs/modules/ROOT/pages/basic_application.adoc +++ b/docs/pages/basic_application.adoc | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | = A basic Embassy application | 1 | = A basic Embassy application |
| 2 | 2 | ||
| 3 | So you've got one of the xref:examples.adoc[examples] running, but what now? Let's go through a simple Embassy application for the nRF52 DK to understand it better. | 3 | So you've got one of the examples running, but what now? Let's go through a simple Embassy application for the nRF52 DK to understand it better. |
| 4 | 4 | ||
| 5 | == Main | 5 | == Main |
| 6 | 6 | ||
| 7 | The full example can be found link:https://github.com/embassy-rs/embassy/tree/master/docs/modules/ROOT/examples/basic[here]. | 7 | The full example can be found link:https://github.com/embassy-rs/embassy/tree/master/docs/examples/basic[here]. |
| 8 | 8 | ||
| 9 | NOTE: If you’re using VS Code and rust-analyzer to view and edit the examples, you may need to make some changes to `.vscode/settings.json` to tell it which project we’re working on. Follow the instructions commented in that file to get rust-analyzer working correctly. | 9 | NOTE: If you’re using VS Code and rust-analyzer to view and edit the examples, you may need to make some changes to `.vscode/settings.json` to tell it which project we’re working on. Follow the instructions commented in that file to get rust-analyzer working correctly. |
| 10 | 10 | ||
| @@ -14,7 +14,7 @@ The first thing you’ll notice are two attributes at the top of the file. These | |||
| 14 | 14 | ||
| 15 | [source,rust] | 15 | [source,rust] |
| 16 | ---- | 16 | ---- |
| 17 | include::example$basic/src/main.rs[lines="1..2"] | 17 | include::../examples/basic/src/main.rs[lines="1..2"] |
| 18 | ---- | 18 | ---- |
| 19 | 19 | ||
| 20 | === Dealing with errors | 20 | === Dealing with errors |
| @@ -23,7 +23,7 @@ Then, what follows are some declarations on how to deal with panics and faults. | |||
| 23 | 23 | ||
| 24 | [source,rust] | 24 | [source,rust] |
| 25 | ---- | 25 | ---- |
| 26 | include::example$basic/src/main.rs[lines="8"] | 26 | include::../examples/basic/src/main.rs[lines="8"] |
| 27 | ---- | 27 | ---- |
| 28 | 28 | ||
| 29 | === Task declaration | 29 | === Task declaration |
| @@ -32,7 +32,7 @@ After a bit of import declaration, the tasks run by the application should be de | |||
| 32 | 32 | ||
| 33 | [source,rust] | 33 | [source,rust] |
| 34 | ---- | 34 | ---- |
| 35 | include::example$basic/src/main.rs[lines="10..18"] | 35 | include::../examples/basic/src/main.rs[lines="10..18"] |
| 36 | ---- | 36 | ---- |
| 37 | 37 | ||
| 38 | An embassy task must be declared `async`, and may NOT take generic arguments. In this case, we are handed the LED that should be blinked and the interval of the blinking. | 38 | An embassy task must be declared `async`, and may NOT take generic arguments. In this case, we are handed the LED that should be blinked and the interval of the blinking. |
| @@ -47,7 +47,7 @@ We then initialize the HAL with a default config, which gives us a `Peripherals` | |||
| 47 | 47 | ||
| 48 | [source,rust] | 48 | [source,rust] |
| 49 | ---- | 49 | ---- |
| 50 | include::example$basic/src/main.rs[lines="20..-1"] | 50 | include::../examples/basic/src/main.rs[lines="20..-1"] |
| 51 | ---- | 51 | ---- |
| 52 | 52 | ||
| 53 | What happens when the `blinker` task has been spawned and main returns? Well, the main entry point is actually just like any other task, except that you can only have one and it takes some specific type arguments. The magic lies within the `#[embassy_executor::main]` macro. The macro does the following: | 53 | What happens when the `blinker` task has been spawned and main returns? Well, the main entry point is actually just like any other task, except that you can only have one and it takes some specific type arguments. The magic lies within the `#[embassy_executor::main]` macro. The macro does the following: |
| @@ -64,7 +64,7 @@ The project definition needs to contain the embassy dependencies: | |||
| 64 | 64 | ||
| 65 | [source,toml] | 65 | [source,toml] |
| 66 | ---- | 66 | ---- |
| 67 | include::example$basic/Cargo.toml[lines="9..11"] | 67 | include::../examples/basic/Cargo.toml[lines="9..11"] |
| 68 | ---- | 68 | ---- |
| 69 | 69 | ||
| 70 | Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well). | 70 | Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well). |
diff --git a/docs/pages/beginners.adoc b/docs/pages/beginners.adoc new file mode 100644 index 000000000..48c9f4541 --- /dev/null +++ b/docs/pages/beginners.adoc | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | = For beginners | ||
| 2 | |||
| 3 | The articles in this section are primarily aimed at users new to Embassy, | ||
| 4 | showing how to get started, how to structure your project and other best practices. | ||
| 5 | |||
| 6 | include::getting_started.adoc[leveloffset = 2] | ||
| 7 | include::basic_application.adoc[leveloffset = 2] | ||
| 8 | include::project_structure.adoc[leveloffset = 2] | ||
| 9 | include::new_project.adoc[leveloffset = 2] | ||
| 10 | include::best_practices.adoc[leveloffset = 2] | ||
| 11 | include::layer_by_layer.adoc[leveloffset = 2] | ||
diff --git a/docs/modules/ROOT/pages/best_practices.adoc b/docs/pages/best_practices.adoc index bfcedec06..bfcedec06 100644 --- a/docs/modules/ROOT/pages/best_practices.adoc +++ b/docs/pages/best_practices.adoc | |||
diff --git a/docs/modules/ROOT/pages/bootloader.adoc b/docs/pages/bootloader.adoc index 3b0cdb182..3b0cdb182 100644 --- a/docs/modules/ROOT/pages/bootloader.adoc +++ b/docs/pages/bootloader.adoc | |||
diff --git a/docs/modules/ROOT/pages/developer.adoc b/docs/pages/developer.adoc index e03ee51a8..e03ee51a8 100644 --- a/docs/modules/ROOT/pages/developer.adoc +++ b/docs/pages/developer.adoc | |||
diff --git a/docs/modules/ROOT/pages/developer_stm32.adoc b/docs/pages/developer_stm32.adoc index 7c04ab1a4..7c04ab1a4 100644 --- a/docs/modules/ROOT/pages/developer_stm32.adoc +++ b/docs/pages/developer_stm32.adoc | |||
diff --git a/docs/modules/ROOT/pages/embassy_in_the_wild.adoc b/docs/pages/embassy_in_the_wild.adoc index a7d63f990..76b1169bd 100644 --- a/docs/modules/ROOT/pages/embassy_in_the_wild.adoc +++ b/docs/pages/embassy_in_the_wild.adoc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | = Embassy in the wild! | 1 | = Embassy in the wild! |
| 2 | 2 | ||
| 3 | Here are known examples of real-world projects which make use of Embassy. Feel free to link:https://github.com/embassy-rs/embassy/blob/main/docs/modules/ROOT/pages/embassy_in_the_wild.adoc[add more]! | 3 | Here are known examples of real-world projects which make use of Embassy. Feel free to link:https://github.com/embassy-rs/embassy/blob/main/docs/pages/embassy_in_the_wild.adoc[add more]! |
| 4 | 4 | ||
| 5 | * link:https://github.com/haobogu/rmk/[RMK: A feature-rich Rust keyboard firmware] | 5 | * link:https://github.com/haobogu/rmk/[RMK: A feature-rich Rust keyboard firmware] |
| 6 | ** RMK has built-in layer support, wireless(BLE) support, real-time key editing support using vial, and more! | 6 | ** RMK has built-in layer support, wireless(BLE) support, real-time key editing support using vial, and more! |
| @@ -10,8 +10,8 @@ Here are known examples of real-world projects which make use of Embassy. Feel f | |||
| 10 | * link:https://github.com/card-io-ecg/card-io-fw[Card/IO firmware] - firmware for an open source ECG device | 10 | * link:https://github.com/card-io-ecg/card-io-fw[Card/IO firmware] - firmware for an open source ECG device |
| 11 | ** Targets the ESP32-S3 or ESP32-C6 MCU | 11 | ** Targets the ESP32-S3 or ESP32-C6 MCU |
| 12 | * The link:https://github.com/lora-rs/lora-rs[lora-rs] project includes link:https://github.com/lora-rs/lora-rs/tree/main/examples/stm32l0/src/bin[various standalone examples] for NRF52840, RP2040, STM32L0 and STM32WL | 12 | * The link:https://github.com/lora-rs/lora-rs[lora-rs] project includes link:https://github.com/lora-rs/lora-rs/tree/main/examples/stm32l0/src/bin[various standalone examples] for NRF52840, RP2040, STM32L0 and STM32WL |
| 13 | ** link:https://github.com/matoushybl/air-force-one[Air force one: A simple air quality monitoring system] | 13 | * link:https://github.com/matoushybl/air-force-one[Air force one: A simple air quality monitoring system] |
| 14 | *** Targets nRF52 and uses nrf-softdevice | 14 | ** Targets nRF52 and uses nrf-softdevice |
| 15 | 15 | ||
| 16 | * link:https://github.com/schmettow/ylab-edge-go[YLab Edge Go] and link:https://github.com/schmettow/ylab-edge-pro[YLab Edge Pro] projects develop | 16 | * link:https://github.com/schmettow/ylab-edge-go[YLab Edge Go] and link:https://github.com/schmettow/ylab-edge-pro[YLab Edge Pro] projects develop |
| 17 | firmware (RP2040, STM32) for capturing physiological data in behavioural science research. Included so far are: | 17 | firmware (RP2040, STM32) for capturing physiological data in behavioural science research. Included so far are: |
diff --git a/docs/modules/ROOT/pages/examples.adoc b/docs/pages/examples.adoc index c852f5205..82381a2c5 100644 --- a/docs/modules/ROOT/pages/examples.adoc +++ b/docs/pages/examples.adoc | |||
| @@ -7,5 +7,5 @@ Main loop example | |||
| 7 | 7 | ||
| 8 | [source,rust] | 8 | [source,rust] |
| 9 | ---- | 9 | ---- |
| 10 | include::example$examples/std/src/bin/tick.rs[] | 10 | include::../examples/examples/std/src/bin/tick.rs[] |
| 11 | ---- | 11 | ---- |
diff --git a/docs/modules/ROOT/pages/faq.adoc b/docs/pages/faq.adoc index 6c7126cd6..5f50951d8 100644 --- a/docs/modules/ROOT/pages/faq.adoc +++ b/docs/pages/faq.adoc | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | These are a list of unsorted, commonly asked questions and answers. | 3 | These are a list of unsorted, commonly asked questions and answers. |
| 4 | 4 | ||
| 5 | Please feel free to add items to link:https://github.com/embassy-rs/embassy/edit/main/docs/modules/ROOT/pages/faq.adoc[this page], especially if someone in the chat answered a question for you! | 5 | Please feel free to add items to link:https://github.com/embassy-rs/embassy/edit/main/docs/pages/faq.adoc[this page], especially if someone in the chat answered a question for you! |
| 6 | 6 | ||
| 7 | == How to deploy to RP2040 without a debugging probe. | 7 | == How to deploy to RP2040 without a debugging probe. |
| 8 | 8 | ||
| @@ -291,7 +291,7 @@ General steps: | |||
| 291 | 291 | ||
| 292 | See link:/examples/stm32h7/src/bin/spi_bdma.rs[this example] for more details. | 292 | See link:/examples/stm32h7/src/bin/spi_bdma.rs[this example] for more details. |
| 293 | 293 | ||
| 294 | === How do I switch to the `main` branch? | 294 | == How do I switch to the `main` branch? |
| 295 | 295 | ||
| 296 | Sometimes to test new changes or fixes, you'll want to switch your project to using a version from GitHub. | 296 | Sometimes to test new changes or fixes, you'll want to switch your project to using a version from GitHub. |
| 297 | 297 | ||
| @@ -314,3 +314,22 @@ embassy-time = { git = "https://github.com/embassy-rs/embassy", rev | |||
| 314 | embassy-usb = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" } | 314 | embassy-usb = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" } |
| 315 | embassy-usb-driver = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" } | 315 | embassy-usb-driver = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" } |
| 316 | ---- | 316 | ---- |
| 317 | |||
| 318 | == How do I add support for a new microcontroller to embassy? | ||
| 319 | |||
| 320 | This is particularly for cortex-m, and potentially risc-v, where there is already support for basics like interrupt handling, or even already embassy-executor support for your architecture. | ||
| 321 | |||
| 322 | This is a *much harder path* than just using Embassy on an already supported chip. If you are a beginner, consider using embassy on an existing, well supported chip for a while, before you decide to write drivers from scratch. It's also worth reading the existing source of supported Embassy HALs, to get a feel for how drivers are implemented for various chips. You should already be comfortable reading and writing unsafe code, and understanding the responsibilities of writing safe abstractions for users of your HAL. | ||
| 323 | |||
| 324 | This is not the only possible approach, but if you are looking for where to start, this is a reasonable way to tackle the task: | ||
| 325 | |||
| 326 | 1. First, drop by the Matrix room or search around to see if someone has already started writing drivers, either in Embassy or otherwise in Rust. You might not have to start from scratch! | ||
| 327 | 2. Make sure the target is supported in probe-rs, it likely is, and if not, there is likely a cmsis-pack you can use to add support so that flashing and debugging is possible. You will definitely appreciate being able to debug with SWD or JTAG when writing drivers! | ||
| 328 | 3. See if there is an SVD (or SVDs, if it's a family) available, if it is, run it through chiptool to create a PAC for low level register access. If not, there are other ways (like scraping the PDF datasheets or existing C header files), but these are more work than starting from the SVD file to define peripheral memory locations necessary for writing drivers. | ||
| 329 | 4. Either make a fork of embassy repo, and add your target there, or make a repo that just contains the PAC and an empty HAL. It doesn't necessarily have to live in the embassy repo at first. | ||
| 330 | 5. Get a hello world binary working on your chip, either with minimal HAL or just PAC access, use delays and blink a light or send some raw data on some interface, make sure it works and you can flash, debug with defmt + RTT, write a proper linker script, etc. | ||
| 331 | 6. Get basic timer operations and timer interrupts working, upgrade your blinking application to use hardware timers and interrupts, and ensure they are accurate (with a logic analyzer or oscilloscope, if possible). | ||
| 332 | 7. Implement the embassy-time driver API with your timer and timer interrupt code, so that you can use embassy-time operations in your drivers and applications. | ||
| 333 | 8. Then start implementing whatever peripherals you need, like GPIOs, UART, SPI, I2C, etc. This is the largest part of the work, and will likely continue for a while! Don't feel like you need 100% coverage of all peripherals at first, this is likely to be an ongoing process over time. | ||
| 334 | 9. Start implementing the embedded-hal, embedded-io, and embedded-hal-async traits on top of your HAL drivers, once you start having more features completed. This will allow users to use standard external device drivers (e.g. sensors, actuators, displays, etc.) with your HAL. | ||
| 335 | 10. Discuss upstreaming the PAC/HAL for embassy support, or make sure your drivers are added to the awesome-embedded-rust list so that people can find it. | ||
diff --git a/docs/modules/ROOT/pages/getting_started.adoc b/docs/pages/getting_started.adoc index 73cb5530d..465059922 100644 --- a/docs/modules/ROOT/pages/getting_started.adoc +++ b/docs/pages/getting_started.adoc | |||
| @@ -137,7 +137,7 @@ If you’re still having problems, check the link:https://embassy.dev/book/dev/f | |||
| 137 | 137 | ||
| 138 | Congratulations, you have your first Embassy application running! Here are some suggestions for where to go from here: | 138 | Congratulations, you have your first Embassy application running! Here are some suggestions for where to go from here: |
| 139 | 139 | ||
| 140 | * Read more about the xref:runtime.adoc[executor]. | 140 | * Read more about the xref:_embassy_executor[executor]. |
| 141 | * Read more about the xref:hal.adoc[HAL]. | 141 | * Read more about the xref:_hardware_abstraction_layer_hal[HAL]. |
| 142 | * Start xref:basic_application.adoc[writing your application]. | 142 | * Start xref:_a_basic_embassy_application[writing your application]. |
| 143 | * Learn how to xref:new_project.adoc[start a new embassy project by adapting an example]. | 143 | * Learn how to xref:_starting_a_new_project[start a new embassy project by adapting an example]. |
diff --git a/docs/modules/ROOT/pages/hal.adoc b/docs/pages/hal.adoc index b1382e8e5..14b85e1f1 100644 --- a/docs/modules/ROOT/pages/hal.adoc +++ b/docs/pages/hal.adoc | |||
| @@ -10,3 +10,5 @@ These HALs implement async/await functionality for most peripherals while also i | |||
| 10 | async traits in `embedded-hal` and `embedded-hal-async`. You can also use these HALs with another executor. | 10 | async traits in `embedded-hal` and `embedded-hal-async`. You can also use these HALs with another executor. |
| 11 | 11 | ||
| 12 | For the ESP32 series, there is an link:https://github.com/esp-rs/esp-hal[esp-hal] which you can use. | 12 | For the ESP32 series, there is an link:https://github.com/esp-rs/esp-hal[esp-hal] which you can use. |
| 13 | |||
| 14 | For the WCH 32-bit RISC-V series, there is an link:https://github.com/ch32-rs/ch32-hal[ch32-hal], which you can use. | ||
diff --git a/docs/modules/ROOT/pages/layer_by_layer.adoc b/docs/pages/layer_by_layer.adoc index fa419f75e..f87291c20 100644 --- a/docs/modules/ROOT/pages/layer_by_layer.adoc +++ b/docs/pages/layer_by_layer.adoc | |||
| @@ -16,7 +16,7 @@ The blinky app using PAC is shown below: | |||
| 16 | 16 | ||
| 17 | [source,rust] | 17 | [source,rust] |
| 18 | ---- | 18 | ---- |
| 19 | include::example$layer-by-layer/blinky-pac/src/main.rs[] | 19 | include::../examples/layer-by-layer/blinky-pac/src/main.rs[] |
| 20 | ---- | 20 | ---- |
| 21 | 21 | ||
| 22 | As you can see, a lot of code is needed to enable the peripheral clocks and to configure the input pins and the output pins of the application. | 22 | As you can see, a lot of code is needed to enable the peripheral clocks and to configure the input pins and the output pins of the application. |
| @@ -35,7 +35,7 @@ The HAL example is shown below: | |||
| 35 | 35 | ||
| 36 | [source,rust] | 36 | [source,rust] |
| 37 | ---- | 37 | ---- |
| 38 | include::example$layer-by-layer/blinky-hal/src/main.rs[] | 38 | include::../examples/layer-by-layer/blinky-hal/src/main.rs[] |
| 39 | ---- | 39 | ---- |
| 40 | 40 | ||
| 41 | As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` types hide all the details of accessing the GPIO registers and allow you to use a much simpler API for querying the state of the button and toggling the LED output. | 41 | As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` types hide all the details of accessing the GPIO registers and allow you to use a much simpler API for querying the state of the button and toggling the LED output. |
| @@ -52,7 +52,7 @@ Given Embassy focus on async Rust (which we'll come back to after this example), | |||
| 52 | 52 | ||
| 53 | [source,rust] | 53 | [source,rust] |
| 54 | ---- | 54 | ---- |
| 55 | include::example$layer-by-layer/blinky-irq/src/main.rs[lines="1..57"] | 55 | include::../examples/layer-by-layer/blinky-irq/src/main.rs[lines="1..57"] |
| 56 | ---- | 56 | ---- |
| 57 | 57 | ||
| 58 | The simple application is now more complex again, primarily because of the need to keep the button and LED states in the global scope where it is accessible by the main application loop, as well as the interrupt handler. | 58 | The simple application is now more complex again, primarily because of the need to keep the button and LED states in the global scope where it is accessible by the main application loop, as well as the interrupt handler. |
| @@ -67,7 +67,7 @@ It's time to use the Embassy capabilities to its fullest. At the core, Embassy h | |||
| 67 | 67 | ||
| 68 | [source,rust] | 68 | [source,rust] |
| 69 | ---- | 69 | ---- |
| 70 | include::example$layer-by-layer/blinky-async/src/main.rs[] | 70 | include::../examples/layer-by-layer/blinky-async/src/main.rs[] |
| 71 | ---- | 71 | ---- |
| 72 | 72 | ||
| 73 | The async version looks very similar to the HAL version, apart from a few minor details: | 73 | The async version looks very similar to the HAL version, apart from a few minor details: |
diff --git a/docs/modules/ROOT/pages/new_project.adoc b/docs/pages/new_project.adoc index 320966bb6..346d9f0f8 100644 --- a/docs/modules/ROOT/pages/new_project.adoc +++ b/docs/pages/new_project.adoc | |||
| @@ -1,17 +1,18 @@ | |||
| 1 | = Starting a new Embassy project | 1 | = Starting a new project |
| 2 | 2 | ||
| 3 | Once you’ve successfully xref:getting_started.adoc[run some example projects], the next step is to make a standalone Embassy project. | 3 | Once you’ve successfully xref:getting_started.adoc[run some example projects], the next step is to make a standalone Embassy project. |
| 4 | 4 | ||
| 5 | There are some tools for generating Embassy projects: (WIP) | 5 | == Tools for generating Embassy projects |
| 6 | 6 | ||
| 7 | ==== CLI | 7 | === CLI |
| 8 | - link:https://github.com/adinack/cargo-embassy[cargo-embassy] (STM32 and NRF) | 8 | - link:https://github.com/adinack/cargo-embassy[cargo-embassy] (STM32 and NRF) |
| 9 | 9 | ||
| 10 | ==== cargo-generate | 10 | === cargo-generate |
| 11 | - link:https://github.com/lulf/embassy-template[embassy-template] (STM32, NRF, and RP) | 11 | - link:https://github.com/lulf/embassy-template[embassy-template] (STM32, NRF, and RP) |
| 12 | - link:https://github.com/bentwire/embassy-rp2040-template[embassy-rp2040-template] (RP) | 12 | - link:https://github.com/bentwire/embassy-rp2040-template[embassy-rp2040-template] (RP) |
| 13 | 13 | ||
| 14 | But if you want to start from scratch: | 14 | |
| 15 | == Starting a project from scratch | ||
| 15 | 16 | ||
| 16 | As an example, let’s create a new embassy project from scratch for a STM32G474. The same instructions are applicable for any supported chip with some minor changes. | 17 | As an example, let’s create a new embassy project from scratch for a STM32G474. The same instructions are applicable for any supported chip with some minor changes. |
| 17 | 18 | ||
| @@ -35,7 +36,7 @@ stm32g474-example | |||
| 35 | 36 | ||
| 36 | Looking in link:https://github.com/embassy-rs/embassy/tree/main/examples[the Embassy examples], we can see there’s a `stm32g4` folder. Find `src/blinky.rs` and copy its contents into our `src/main.rs`. | 37 | Looking in link:https://github.com/embassy-rs/embassy/tree/main/examples[the Embassy examples], we can see there’s a `stm32g4` folder. Find `src/blinky.rs` and copy its contents into our `src/main.rs`. |
| 37 | 38 | ||
| 38 | == .cargo/config.toml | 39 | === The .cargo/config.toml |
| 39 | 40 | ||
| 40 | Currently, we’d need to provide cargo with a target triple every time we run `cargo build` or `cargo run`. Let’s spare ourselves that work by copying `.cargo/config.toml` from `examples/stm32g4` into our project. | 41 | Currently, we’d need to provide cargo with a target triple every time we run `cargo build` or `cargo run`. Let’s spare ourselves that work by copying `.cargo/config.toml` from `examples/stm32g4` into our project. |
| 41 | 42 | ||
| @@ -66,7 +67,7 @@ and copying `STM32G474RETx` into `.cargo/config.toml` as so: | |||
| 66 | runner = "probe-rs run --chip STM32G474RETx" | 67 | runner = "probe-rs run --chip STM32G474RETx" |
| 67 | ---- | 68 | ---- |
| 68 | 69 | ||
| 69 | == Cargo.toml | 70 | === Cargo.toml |
| 70 | 71 | ||
| 71 | Now that cargo knows what target to compile for (and probe-rs knows what chip to run it on), we’re ready to add some dependencies. | 72 | Now that cargo knows what target to compile for (and probe-rs knows what chip to run it on), we’re ready to add some dependencies. |
| 72 | 73 | ||
| @@ -117,7 +118,7 @@ Finally, copy the `[profile.release]` section from the example `Cargo.toml` into | |||
| 117 | debug = 2 | 118 | debug = 2 |
| 118 | ---- | 119 | ---- |
| 119 | 120 | ||
| 120 | == rust-toolchain.toml | 121 | === rust-toolchain.toml |
| 121 | 122 | ||
| 122 | Before we can build our project, we need to add an additional file to tell cargo to use the nightly toolchain. Copy the `rust-toolchain.toml` from the embassy repo to ours, and trim the list of targets down to only the target triple relevent for our project — in this case, `thumbv7em-none-eabi`: | 123 | Before we can build our project, we need to add an additional file to tell cargo to use the nightly toolchain. Copy the `rust-toolchain.toml` from the embassy repo to ours, and trim the list of targets down to only the target triple relevent for our project — in this case, `thumbv7em-none-eabi`: |
| 123 | 124 | ||
| @@ -142,7 +143,7 @@ components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ] | |||
| 142 | targets = ["thumbv7em-none-eabi"] | 143 | targets = ["thumbv7em-none-eabi"] |
| 143 | ---- | 144 | ---- |
| 144 | 145 | ||
| 145 | == build.rs | 146 | === build.rs |
| 146 | 147 | ||
| 147 | In order to produce a working binary for our target, cargo requires a custom build script. Copy `build.rs` from the example to our project: | 148 | In order to produce a working binary for our target, cargo requires a custom build script. Copy `build.rs` from the example to our project: |
| 148 | 149 | ||
| @@ -158,7 +159,7 @@ stm32g474-example | |||
| 158 | └── main.rs | 159 | └── main.rs |
| 159 | ---- | 160 | ---- |
| 160 | 161 | ||
| 161 | == Building and running | 162 | === Building and running |
| 162 | 163 | ||
| 163 | At this point, we‘re finally ready to build and run our project! Connect your board via a debug probe and run: | 164 | At this point, we‘re finally ready to build and run our project! Connect your board via a debug probe and run: |
| 164 | 165 | ||
diff --git a/docs/modules/ROOT/pages/nrf.adoc b/docs/pages/nrf.adoc index 1706087ae..1706087ae 100644 --- a/docs/modules/ROOT/pages/nrf.adoc +++ b/docs/pages/nrf.adoc | |||
diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/pages/overview.adoc index e17adbbd7..1b9381bfe 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/pages/overview.adoc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | = Embassy | 1 | = Introduction |
| 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 | ||
| @@ -30,6 +30,7 @@ The Embassy project maintains HALs for select hardware, but you can still use HA | |||
| 30 | * link:https://docs.embassy.dev/embassy-nrf/[embassy-nrf], for the Nordic Semiconductor nRF52, nRF53, nRF91 series. | 30 | * link:https://docs.embassy.dev/embassy-nrf/[embassy-nrf], for the Nordic Semiconductor nRF52, nRF53, nRF91 series. |
| 31 | * link:https://docs.embassy.dev/embassy-rp/[embassy-rp], for the Raspberry Pi RP2040 microcontroller. | 31 | * link:https://docs.embassy.dev/embassy-rp/[embassy-rp], for the Raspberry Pi RP2040 microcontroller. |
| 32 | * link:https://github.com/esp-rs[esp-rs], for the Espressif Systems ESP32 series of chips. | 32 | * link:https://github.com/esp-rs[esp-rs], for the Espressif Systems ESP32 series of chips. |
| 33 | * link:https://github.com/ch32-rs/ch32-hal[ch32-hal], for the WCH 32-bit RISC-V(CH32V) series of chips. | ||
| 33 | 34 | ||
| 34 | NOTE: A common question is if one can use the Embassy HALs standalone. Yes, it is possible! There are no dependency on the executor within the HALs. You can even use them without async, | 35 | NOTE: A common question is if one can use the Embassy HALs standalone. Yes, it is possible! There are no dependency on the executor within the HALs. You can even use them without async, |
| 35 | as they implement both the link:https://github.com/rust-embedded/embedded-hal[Embedded HAL] blocking and async traits. | 36 | as they implement both the link:https://github.com/rust-embedded/embedded-hal[Embedded HAL] blocking and async traits. |
| @@ -55,6 +56,20 @@ For most I/O in embedded devices, the peripheral doesn't directly support the tr | |||
| 55 | 56 | ||
| 56 | The Direct Memory Access controller (DMA) is a controller that is present in MCUs that Embassy supports, including stm32 and nrf. The DMA allows the MCU to set up a transfer, either send or receive, and then wait for the transfer to complete. With DMA, once started, no MCU intervention is required until the transfer is complete, meaning that the MCU can perform other computation, or set up other I/O while the transfer is in progress. For high I/O rates, DMA can cut the time that the MCU spends handling I/O by over half. However, because DMA is more complex to set-up, it is less widely used in the embedded community. Embassy aims to change that by making DMA the first choice rather than the last. Using Embassy, there's no additional tuning required once I/O rates increase because your application is already set-up to handle them. | 57 | The Direct Memory Access controller (DMA) is a controller that is present in MCUs that Embassy supports, including stm32 and nrf. The DMA allows the MCU to set up a transfer, either send or receive, and then wait for the transfer to complete. With DMA, once started, no MCU intervention is required until the transfer is complete, meaning that the MCU can perform other computation, or set up other I/O while the transfer is in progress. For high I/O rates, DMA can cut the time that the MCU spends handling I/O by over half. However, because DMA is more complex to set-up, it is less widely used in the embedded community. Embassy aims to change that by making DMA the first choice rather than the last. Using Embassy, there's no additional tuning required once I/O rates increase because your application is already set-up to handle them. |
| 57 | 58 | ||
| 59 | == Examples | ||
| 60 | |||
| 61 | Embassy provides examples for all HALs supported. You can find them in the `examples/` folder. | ||
| 62 | |||
| 63 | |||
| 64 | Main loop example | ||
| 65 | |||
| 66 | [source,rust] | ||
| 67 | ---- | ||
| 68 | include::../examples/examples/std/src/bin/tick.rs[] | ||
| 69 | ---- | ||
| 70 | |||
| 71 | include::embassy_in_the_wild.adoc[leveloffset = 2] | ||
| 72 | |||
| 58 | == Resources | 73 | == Resources |
| 59 | 74 | ||
| 60 | For more reading material on async Rust and Embassy: | 75 | For more reading material on async Rust and Embassy: |
diff --git a/docs/modules/ROOT/pages/project_structure.adoc b/docs/pages/project_structure.adoc index 2adfcc1df..722ec8d9d 100644 --- a/docs/modules/ROOT/pages/project_structure.adoc +++ b/docs/pages/project_structure.adoc | |||
| @@ -18,6 +18,7 @@ my-project | |||
| 18 | |- rust-toolchain.toml | 18 | |- rust-toolchain.toml |
| 19 | ---- | 19 | ---- |
| 20 | 20 | ||
| 21 | [discrete] | ||
| 21 | == .cargo/config.toml | 22 | == .cargo/config.toml |
| 22 | 23 | ||
| 23 | This directory/file describes what platform you're on, and configures link:https://github.com/probe-rs/probe-rs[probe-rs] to deploy to your device. | 24 | This directory/file describes what platform you're on, and configures link:https://github.com/probe-rs/probe-rs[probe-rs] to deploy to your device. |
| @@ -36,21 +37,27 @@ target = "thumbv6m-none-eabi" # <-change for your platform | |||
| 36 | DEFMT_LOG = "trace" # <- can change to info, warn, or error | 37 | DEFMT_LOG = "trace" # <- can change to info, warn, or error |
| 37 | ---- | 38 | ---- |
| 38 | 39 | ||
| 40 | [discrete] | ||
| 39 | == build.rs | 41 | == build.rs |
| 40 | 42 | ||
| 41 | This is the build script for your project. It links defmt (what is link:https://defmt.ferrous-systems.com[defmt]?) and the `memory.x` file if needed. This file is pretty specific for each chipset, just copy and paste from the corresponding link:https://github.com/embassy-rs/embassy/tree/main/examples[example]. | 43 | This is the build script for your project. It links defmt (what is link:https://defmt.ferrous-systems.com[defmt]?) and the `memory.x` file if needed. This file is pretty specific for each chipset, just copy and paste from the corresponding link:https://github.com/embassy-rs/embassy/tree/main/examples[example]. |
| 42 | 44 | ||
| 45 | [discrete] | ||
| 43 | == Cargo.toml | 46 | == Cargo.toml |
| 44 | 47 | ||
| 45 | This is your manifest file, where you can configure all of the embassy components to use the features you need. | 48 | This is your manifest file, where you can configure all of the embassy components to use the features you need. |
| 46 | 49 | ||
| 47 | ==== Features | 50 | [discrete] |
| 48 | ===== Time | 51 | === Features |
| 52 | |||
| 53 | [discrete] | ||
| 54 | ==== Time | ||
| 49 | - tick-hz-x: Configures the tick rate of `embassy-time`. Higher tick rate means higher precision, and higher CPU wakes. | 55 | - tick-hz-x: Configures the tick rate of `embassy-time`. Higher tick rate means higher precision, and higher CPU wakes. |
| 50 | - defmt-timestamp-uptime: defmt log entries will display the uptime in seconds. | 56 | - defmt-timestamp-uptime: defmt log entries will display the uptime in seconds. |
| 51 | 57 | ||
| 52 | ...more to come | 58 | ...more to come |
| 53 | 59 | ||
| 60 | [discrete] | ||
| 54 | == memory.x | 61 | == memory.x |
| 55 | 62 | ||
| 56 | This file outlines the flash/ram usage of your program. It is especially useful when using link:https://github.com/embassy-rs/nrf-softdevice[nrf-softdevice] on an nRF5x. | 63 | This file outlines the flash/ram usage of your program. It is especially useful when using link:https://github.com/embassy-rs/nrf-softdevice[nrf-softdevice] on an nRF5x. |
| @@ -68,6 +75,7 @@ MEMORY | |||
| 68 | } | 75 | } |
| 69 | ---- | 76 | ---- |
| 70 | 77 | ||
| 78 | [discrete] | ||
| 71 | == rust-toolchain.toml | 79 | == rust-toolchain.toml |
| 72 | 80 | ||
| 73 | This file configures the rust version and configuration to use. | 81 | This file configures the rust version and configuration to use. |
diff --git a/docs/modules/ROOT/pages/runtime.adoc b/docs/pages/runtime.adoc index f2812dd7c..f2812dd7c 100644 --- a/docs/modules/ROOT/pages/runtime.adoc +++ b/docs/pages/runtime.adoc | |||
diff --git a/docs/modules/ROOT/pages/sharing_peripherals.adoc b/docs/pages/sharing_peripherals.adoc index 784239fb1..6bcd56b01 100644 --- a/docs/modules/ROOT/pages/sharing_peripherals.adoc +++ b/docs/pages/sharing_peripherals.adoc | |||
| @@ -125,4 +125,4 @@ async fn toggle_led(control: Sender<'static, ThreadModeRawMutex, LedState, 64>, | |||
| 125 | ---- | 125 | ---- |
| 126 | 126 | ||
| 127 | This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure | 127 | This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure |
| 128 | that the operation is ecompleted before continuing to do other work in your task. | 128 | that the operation is completed before continuing to do other work in your task. |
diff --git a/docs/modules/ROOT/pages/stm32.adoc b/docs/pages/stm32.adoc index 7bfc0592b..7bfc0592b 100644 --- a/docs/modules/ROOT/pages/stm32.adoc +++ b/docs/pages/stm32.adoc | |||
diff --git a/docs/pages/system.adoc b/docs/pages/system.adoc new file mode 100644 index 000000000..985f92b18 --- /dev/null +++ b/docs/pages/system.adoc | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | = System description | ||
| 2 | |||
| 3 | This section describes different parts of Embassy in more detail. | ||
| 4 | |||
| 5 | include::runtime.adoc[leveloffset = 2] | ||
| 6 | include::bootloader.adoc[leveloffset = 2] | ||
| 7 | include::time_keeping.adoc[leveloffset = 2] | ||
| 8 | include::hal.adoc[leveloffset = 2] | ||
| 9 | include::nrf.adoc[leveloffset = 2] | ||
| 10 | include::stm32.adoc[leveloffset = 2] | ||
| 11 | include::sharing_peripherals.adoc[leveloffset = 2] | ||
| 12 | include::developer.adoc[leveloffset = 2] | ||
| 13 | include::developer_stm32.adoc[leveloffset = 2] | ||
diff --git a/docs/modules/ROOT/pages/time_keeping.adoc b/docs/pages/time_keeping.adoc index 17492a884..17492a884 100644 --- a/docs/modules/ROOT/pages/time_keeping.adoc +++ b/docs/pages/time_keeping.adoc | |||
