diff options
| author | Dion Dokter <[email protected]> | 2024-08-05 11:21:21 +0200 |
|---|---|---|
| committer | Dion Dokter <[email protected]> | 2024-08-05 11:21:21 +0200 |
| commit | ab4d378dda5a74834dcc1fc0c872824f4a616911 (patch) | |
| tree | d79824af61988c9adae883fa04e40b7b74e112a9 /docs | |
| parent | 2a7fe16ceb53aca38f73ac01a923ea445654673c (diff) | |
| parent | 0f685761e09b1617e435de4e50986fe9a548502e (diff) | |
Merge branch 'master' into stm-dualcore
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/examples/basic/Cargo.toml | 6 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-async/Cargo.toml | 2 | ||||
| -rw-r--r-- | docs/pages/basic_application.adoc | 2 | ||||
| -rw-r--r-- | docs/pages/faq.adoc | 7 | ||||
| -rw-r--r-- | docs/pages/new_project.adoc | 2 | ||||
| -rw-r--r-- | docs/pages/nrf.adoc | 2 | ||||
| -rw-r--r-- | docs/pages/overview.adoc | 2 | ||||
| -rw-r--r-- | docs/pages/sharing_peripherals.adoc | 10 | ||||
| -rw-r--r-- | docs/pages/stm32.adoc | 2 | ||||
| -rw-r--r-- | docs/pages/time_keeping.adoc | 4 |
10 files changed, 25 insertions, 14 deletions
diff --git a/docs/examples/basic/Cargo.toml b/docs/examples/basic/Cargo.toml index e82165032..5d391adf3 100644 --- a/docs/examples/basic/Cargo.toml +++ b/docs/examples/basic/Cargo.toml | |||
| @@ -6,9 +6,9 @@ version = "0.1.0" | |||
| 6 | license = "MIT OR Apache-2.0" | 6 | license = "MIT OR Apache-2.0" |
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy-executor = { version = "0.5.0", path = "../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.6.0", path = "../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.3.1", path = "../../../embassy-time", features = ["defmt"] } | 10 | embassy-time = { version = "0.3.2", path = "../../../embassy-time", features = ["defmt"] } |
| 11 | embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } | 11 | embassy-nrf = { version = "0.2.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } |
| 12 | 12 | ||
| 13 | defmt = "0.3" | 13 | defmt = "0.3" |
| 14 | defmt-rtt = "0.3" | 14 | defmt-rtt = "0.3" |
diff --git a/docs/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/examples/layer-by-layer/blinky-async/Cargo.toml index 64f7e8403..7f8d8af3e 100644 --- a/docs/examples/layer-by-layer/blinky-async/Cargo.toml +++ b/docs/examples/layer-by-layer/blinky-async/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | cortex-m = "0.7" | 8 | cortex-m = "0.7" |
| 9 | cortex-m-rt = "0.7" | 9 | cortex-m-rt = "0.7" |
| 10 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] } | 10 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] } |
| 11 | embassy-executor = { version = "0.5.0", features = ["arch-cortex-m", "executor-thread"] } | 11 | embassy-executor = { version = "0.6.0", features = ["arch-cortex-m", "executor-thread"] } |
| 12 | 12 | ||
| 13 | defmt = "0.3.0" | 13 | defmt = "0.3.0" |
| 14 | defmt-rtt = "0.3.0" | 14 | defmt-rtt = "0.3.0" |
diff --git a/docs/pages/basic_application.adoc b/docs/pages/basic_application.adoc index 7b4ebda4f..5c4e3e8b3 100644 --- a/docs/pages/basic_application.adoc +++ b/docs/pages/basic_application.adoc | |||
| @@ -4,7 +4,7 @@ So you've got one of the examples running, but what now? Let's go through a simp | |||
| 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/examples/basic[here]. | 7 | The full example can be found link:https://github.com/embassy-rs/embassy/tree/main/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 | ||
diff --git a/docs/pages/faq.adoc b/docs/pages/faq.adoc index a2f56a539..4ab04e2a1 100644 --- a/docs/pages/faq.adoc +++ b/docs/pages/faq.adoc | |||
| @@ -352,8 +352,13 @@ There are two main ways to handle concurrency in Embassy: | |||
| 352 | 352 | ||
| 353 | In general, either of these approaches will work. The main differences of these approaches are: | 353 | In general, either of these approaches will work. The main differences of these approaches are: |
| 354 | 354 | ||
| 355 | When using **separate tasks**, each task needs its own RAM allocation, so there's a little overhead for each task, so one task that does three things will likely be a little bit smaller than three tasks that do one thing (not a lot, probably a couple dozen bytes). In contrast, with **multiple futures in one task**, you don't need multiple task allocations, and it will generally be easier to share data, or use borrowed resources, inside of a single task. | 355 | When using **separate tasks**, each task needs its own RAM allocation, so there's a little overhead for each task, so one task that does three things will likely be a little bit smaller than three tasks that do one thing (not a lot, probably a couple dozen bytes). In contrast, with **multiple futures in one task**, you don't need multiple task allocations, and it will generally be easier to share data, or use borrowed resources, inside of a single task. |
| 356 | An example showcasing some methods for sharing things between tasks link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here]. | ||
| 356 | 357 | ||
| 357 | But when it comes to "waking" tasks, for example when a data transfer is complete or a button is pressed, it's faster to wake a dedicated task, because that task does not need to check which future is actually ready. `join` and `select` must check ALL of the futures they are managing to see which one (or which ones) are ready to do more work. This is because all Rust executors (like Embassy or Tokio) only have the ability to wake tasks, not specific futures. This means you will use slightly less CPU time juggling futures when using dedicated tasks. | 358 | But when it comes to "waking" tasks, for example when a data transfer is complete or a button is pressed, it's faster to wake a dedicated task, because that task does not need to check which future is actually ready. `join` and `select` must check ALL of the futures they are managing to see which one (or which ones) are ready to do more work. This is because all Rust executors (like Embassy or Tokio) only have the ability to wake tasks, not specific futures. This means you will use slightly less CPU time juggling futures when using dedicated tasks. |
| 358 | 359 | ||
| 359 | Practically, there's not a LOT of difference either way - so go with what makes it easier for you and your code first, but there will be some details that are slightly different in each case. | 360 | Practically, there's not a LOT of difference either way - so go with what makes it easier for you and your code first, but there will be some details that are slightly different in each case. |
| 361 | |||
| 362 | == splitting peripherals resources between tasks | ||
| 363 | |||
| 364 | There are two ways to split resources between tasks, either manually assigned or by a convenient macro. See link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/assign_resources.rs[this example] \ No newline at end of file | ||
diff --git a/docs/pages/new_project.adoc b/docs/pages/new_project.adoc index 346d9f0f8..821bcbd27 100644 --- a/docs/pages/new_project.adoc +++ b/docs/pages/new_project.adoc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | = Starting a new 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[run some example projects], the next step is to make a standalone Embassy project. |
| 4 | 4 | ||
| 5 | == Tools for generating Embassy projects | 5 | == Tools for generating Embassy projects |
| 6 | 6 | ||
diff --git a/docs/pages/nrf.adoc b/docs/pages/nrf.adoc index 1706087ae..de052b63f 100644 --- a/docs/pages/nrf.adoc +++ b/docs/pages/nrf.adoc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | = Embassy nRF HAL | 1 | = Embassy nRF HAL |
| 2 | 2 | ||
| 3 | The link:https://github.com/embassy-rs/embassy/tree/master/embassy-nrf[Embassy nRF HAL] is based on the PACs (Peripheral Access Crate) from link:https://github.com/nrf-rs/[nrf-rs]. | 3 | The link:https://github.com/embassy-rs/embassy/tree/main/embassy-nrf[Embassy nRF HAL] is based on the PACs (Peripheral Access Crate) from link:https://github.com/nrf-rs/[nrf-rs]. |
| 4 | 4 | ||
| 5 | == Timer driver | 5 | == Timer driver |
| 6 | 6 | ||
diff --git a/docs/pages/overview.adoc b/docs/pages/overview.adoc index 1b9381bfe..7d59d5521 100644 --- a/docs/pages/overview.adoc +++ b/docs/pages/overview.adoc | |||
| @@ -48,7 +48,7 @@ link:https://github.com/lora-rs/lora-rs[lora-rs] supports LoRa networking on a w | |||
| 48 | link:https://docs.embassy.dev/embassy-usb/[embassy-usb] implements a device-side USB stack. Implementations for common classes such as USB serial (CDC ACM) and USB HID are available, and a rich builder API allows building your own. | 48 | link:https://docs.embassy.dev/embassy-usb/[embassy-usb] implements a device-side USB stack. Implementations for common classes such as USB serial (CDC ACM) and USB HID are available, and a rich builder API allows building your own. |
| 49 | 49 | ||
| 50 | === Bootloader and DFU | 50 | === Bootloader and DFU |
| 51 | link:https://github.com/embassy-rs/embassy/tree/master/embassy-boot[embassy-boot] is a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks. | 51 | link:https://github.com/embassy-rs/embassy/tree/main/embassy-boot[embassy-boot] is a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks. |
| 52 | 52 | ||
| 53 | == What is DMA? | 53 | == What is DMA? |
| 54 | 54 | ||
diff --git a/docs/pages/sharing_peripherals.adoc b/docs/pages/sharing_peripherals.adoc index 6bcd56b01..dfb8c1ffe 100644 --- a/docs/pages/sharing_peripherals.adoc +++ b/docs/pages/sharing_peripherals.adoc | |||
| @@ -8,7 +8,7 @@ The following examples shows different ways to use the on-board LED on a Raspber | |||
| 8 | 8 | ||
| 9 | Using mutual exclusion is the simplest way to share a peripheral. | 9 | Using mutual exclusion is the simplest way to share a peripheral. |
| 10 | 10 | ||
| 11 | TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. | 11 | TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here]. |
| 12 | [,rust] | 12 | [,rust] |
| 13 | ---- | 13 | ---- |
| 14 | use defmt::*; | 14 | use defmt::*; |
| @@ -78,7 +78,7 @@ To indicate that the pin will be set to an Output. The `AnyPin` could have been | |||
| 78 | 78 | ||
| 79 | A channel is another way to ensure exclusive access to a resource. Using a channel is great in the cases where the access can happen at a later point in time, allowing you to enqueue operations and do other things. | 79 | A channel is another way to ensure exclusive access to a resource. Using a channel is great in the cases where the access can happen at a later point in time, allowing you to enqueue operations and do other things. |
| 80 | 80 | ||
| 81 | TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. | 81 | TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here]. |
| 82 | [,rust] | 82 | [,rust] |
| 83 | ---- | 83 | ---- |
| 84 | use defmt::*; | 84 | use defmt::*; |
| @@ -126,3 +126,9 @@ async fn toggle_led(control: Sender<'static, ThreadModeRawMutex, LedState, 64>, | |||
| 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 completed before continuing to do other work in your task. | 128 | that the operation is completed before continuing to do other work in your task. |
| 129 | |||
| 130 | An example showcasing more methods for sharing link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here]. | ||
| 131 | |||
| 132 | == Sharing an I2C or SPI bus between multiple devices | ||
| 133 | |||
| 134 | An example of how to deal with multiple devices sharing a common I2C or SPI bus link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/shared_bus.rs[can be found here]. | ||
diff --git a/docs/pages/stm32.adoc b/docs/pages/stm32.adoc index 7bfc0592b..df139a420 100644 --- a/docs/pages/stm32.adoc +++ b/docs/pages/stm32.adoc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | = Embassy STM32 HAL | 1 | = Embassy STM32 HAL |
| 2 | 2 | ||
| 3 | The link:https://github.com/embassy-rs/embassy/tree/master/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project. | 3 | The link:https://github.com/embassy-rs/embassy/tree/main/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project. |
| 4 | 4 | ||
| 5 | == The infinite variant problem | 5 | == The infinite variant problem |
| 6 | 6 | ||
diff --git a/docs/pages/time_keeping.adoc b/docs/pages/time_keeping.adoc index 17492a884..11ddb2b2b 100644 --- a/docs/pages/time_keeping.adoc +++ b/docs/pages/time_keeping.adoc | |||
| @@ -16,7 +16,7 @@ The `embassy::time::Timer` type provides two timing methods. | |||
| 16 | 16 | ||
| 17 | An example of a delay is provided as follows: | 17 | An example of a delay is provided as follows: |
| 18 | 18 | ||
| 19 | TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. | 19 | TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here]. |
| 20 | [,rust] | 20 | [,rust] |
| 21 | ---- | 21 | ---- |
| 22 | use embassy::executor::{task, Executor}; | 22 | use embassy::executor::{task, Executor}; |
| @@ -41,7 +41,7 @@ that expect a generic delay implementation to be provided. | |||
| 41 | 41 | ||
| 42 | An example of how this can be used: | 42 | An example of how this can be used: |
| 43 | 43 | ||
| 44 | TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. | 44 | TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here]. |
| 45 | [,rust] | 45 | [,rust] |
| 46 | ---- | 46 | ---- |
| 47 | use embassy::executor::{task, Executor}; | 47 | use embassy::executor::{task, Executor}; |
