aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
author1-rafael-1 <[email protected]>2025-09-15 20:07:18 +0200
committer1-rafael-1 <[email protected]>2025-09-15 20:07:18 +0200
commit6bb3d2c0720fa082f27d3cdb70f516058497ec87 (patch)
tree5a1e255cff999b00800f203b91a759c720c973e5 /docs
parenteb685574601d98c44faed9a3534d056199b46e20 (diff)
parent92a6fd2946f2cbb15359290f68aa360953da2ff7 (diff)
Merge branch 'main' into rp2040-rtc-alarm
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/basic/Cargo.toml18
-rw-r--r--docs/examples/basic/src/main.rs2
-rw-r--r--docs/examples/layer-by-layer/blinky-async/Cargo.toml16
-rw-r--r--docs/examples/layer-by-layer/blinky-hal/Cargo.toml14
-rw-r--r--docs/examples/layer-by-layer/blinky-irq/Cargo.toml14
-rw-r--r--docs/examples/layer-by-layer/blinky-pac/Cargo.toml12
-rw-r--r--docs/index.adoc1
-rw-r--r--docs/pages/bootloader.adoc7
-rw-r--r--docs/pages/embassy_in_the_wild.adoc4
-rw-r--r--docs/pages/faq.adoc10
-rw-r--r--docs/pages/imxrt.adoc5
-rw-r--r--docs/pages/layer_by_layer.adoc2
-rw-r--r--docs/pages/new_project.adoc2
-rw-r--r--docs/pages/overview.adoc2
-rw-r--r--docs/pages/sharing_peripherals.adoc8
15 files changed, 82 insertions, 35 deletions
diff --git a/docs/examples/basic/Cargo.toml b/docs/examples/basic/Cargo.toml
index 705c334a7..b6dbeda2a 100644
--- a/docs/examples/basic/Cargo.toml
+++ b/docs/examples/basic/Cargo.toml
@@ -5,14 +5,20 @@ name = "embassy-basic-example"
5version = "0.1.0" 5version = "0.1.0"
6license = "MIT OR Apache-2.0" 6license = "MIT OR Apache-2.0"
7 7
8publish = false
8[dependencies] 9[dependencies]
9embassy-executor = { version = "0.7.0", path = "../../../embassy-executor", features = ["defmt", "arch-cortex-m", "executor-thread"] } 10embassy-executor = { version = "0.9.0", path = "../../../embassy-executor", features = ["defmt", "arch-cortex-m", "executor-thread"] }
10embassy-time = { version = "0.4.0", path = "../../../embassy-time", features = ["defmt"] } 11embassy-time = { version = "0.5.0", path = "../../../embassy-time", features = ["defmt"] }
11embassy-nrf = { version = "0.3.1", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } 12embassy-nrf = { version = "0.7.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
12 13
13defmt = "0.3" 14defmt = "1.0.1"
14defmt-rtt = "0.3" 15defmt-rtt = "1.0.0"
15 16
16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 17cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
17cortex-m-rt = "0.7.0" 18cortex-m-rt = "0.7.0"
18panic-probe = { version = "0.3", features = ["print-defmt"] } 19panic-probe = { version = "1.0.0", features = ["print-defmt"] }
20
21[package.metadata.embassy]
22build = [
23 { target = "thumbv7em-none-eabi" }
24]
diff --git a/docs/examples/basic/src/main.rs b/docs/examples/basic/src/main.rs
index 4412712c8..6e274bacb 100644
--- a/docs/examples/basic/src/main.rs
+++ b/docs/examples/basic/src/main.rs
@@ -22,5 +22,5 @@ async fn main(spawner: Spawner) {
22 let p = embassy_nrf::init(Default::default()); 22 let p = embassy_nrf::init(Default::default());
23 23
24 let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); 24 let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);
25 unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300)))); 25 spawner.spawn(unwrap!(blinker(led, Duration::from_millis(300))));
26} 26}
diff --git a/docs/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
index 541eb6edf..ec718022c 100644
--- a/docs/examples/layer-by-layer/blinky-async/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
@@ -4,12 +4,18 @@ version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7publish = false
7[dependencies] 8[dependencies]
8cortex-m = { version = "0.7", features = ["critical-section-single-core"] } 9cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
9cortex-m-rt = "0.7" 10cortex-m-rt = "0.7"
10embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x", "exti"] } 11embassy-stm32 = { version = "0.4.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x", "exti"] }
11embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } 12embassy-executor = { version = "0.9.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] }
12 13
13defmt = "0.3" 14defmt = "1.0.1"
14defmt-rtt = "0.4" 15defmt-rtt = "1.0.0"
15panic-probe = { version = "0.3.0", features = ["print-defmt"] } 16panic-probe = { version = "1.0.0", features = ["print-defmt"] }
17
18[package.metadata.embassy]
19build = [
20 { target = "thumbv7em-none-eabi" }
21]
diff --git a/docs/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
index dd574c3e7..4a0b03a83 100644
--- a/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
@@ -4,11 +4,17 @@ version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7publish = false
7[dependencies] 8[dependencies]
8cortex-m-rt = "0.7" 9cortex-m-rt = "0.7"
9cortex-m = { version = "0.7", features = ["critical-section-single-core"] } 10cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
10embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x"] } 11embassy-stm32 = { version = "0.4.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x"] }
11 12
12defmt = "0.3" 13defmt = "1.0.1"
13defmt-rtt = "0.4" 14defmt-rtt = "1.0.0"
14panic-probe = { version = "0.3.0", features = ["print-defmt"] } 15panic-probe = { version = "1.0.0", features = ["print-defmt"] }
16
17[package.metadata.embassy]
18build = [
19 { target = "thumbv7em-none-eabi" }
20]
diff --git a/docs/examples/layer-by-layer/blinky-irq/Cargo.toml b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
index 8733ee894..3c4bf8446 100644
--- a/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
@@ -6,11 +6,17 @@ version = "0.1.0"
6edition = "2021" 6edition = "2021"
7license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
8 8
9publish = false
9[dependencies] 10[dependencies]
10cortex-m = { version = "0.7", features = ["critical-section-single-core"] } 11cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
11cortex-m-rt = { version = "0.7" } 12cortex-m-rt = { version = "0.7" }
12embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x", "unstable-pac"] } 13embassy-stm32 = { version = "0.4.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x", "unstable-pac"] }
13 14
14defmt = "0.3" 15defmt = "1.0.1"
15defmt-rtt = "0.4" 16defmt-rtt = "1.0.0"
16panic-probe = { version = "0.3.0", features = ["print-defmt"] } 17panic-probe = { version = "1.0.0", features = ["print-defmt"] }
18
19[package.metadata.embassy]
20build = [
21 { target = "thumbv7em-none-eabi" }
22]
diff --git a/docs/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
index 155c41ec6..0d4711da2 100644
--- a/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
@@ -4,11 +4,17 @@ version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7publish = false
7[dependencies] 8[dependencies]
8cortex-m = { version = "0.7", features = ["critical-section-single-core"] } 9cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
9cortex-m-rt = "0.7" 10cortex-m-rt = "0.7"
10stm32-metapac = { version = "16", features = ["stm32l475vg"] } 11stm32-metapac = { version = "16", features = ["stm32l475vg"] }
11 12
12defmt = "0.3" 13defmt = "1.0.1"
13defmt-rtt = "0.4" 14defmt-rtt = "1.0.0"
14panic-probe = { version = "0.3.0", features = ["print-defmt"] } 15panic-probe = { version = "1.0.0", features = ["print-defmt"] }
16
17[package.metadata.embassy]
18build = [
19 { target = "thumbv7em-none-eabi" }
20]
diff --git a/docs/index.adoc b/docs/index.adoc
index 9c6150196..80754d5a4 100644
--- a/docs/index.adoc
+++ b/docs/index.adoc
@@ -5,6 +5,7 @@
5:toc-placement: left 5:toc-placement: left
6:toclevels: 2 6:toclevels: 2
7:imagesdir: images 7:imagesdir: images
8:source-highlighter: rouge
8 9
9# Embassy Book 10# Embassy Book
10 11
diff --git a/docs/pages/bootloader.adoc b/docs/pages/bootloader.adoc
index 53f85d995..b0f0331aa 100644
--- a/docs/pages/bootloader.adoc
+++ b/docs/pages/bootloader.adoc
@@ -2,6 +2,13 @@
2 2
3`embassy-boot` a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks. 3`embassy-boot` a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks.
4 4
5The update method used is referred to as an A/B partition update scheme.
6
7With a general-purpose OS, A/B partition update is accomplished by directly booting either the A or B partition depending on the update state.
8To accomplish the same goal in a way that is portable across all microcontrollers, `embassy-boot` swaps data page by page (in both directions) between the DFU and the Active partition when a firmware update is triggered. +
9Because the original Active application is moved into the DFU partition during this update, the operation can be reversed if the update is interrupted or the new firmware does not flag that it booted successfully. +
10See the design section for more details on how this is implemented.
11
5The bootloader can be used either as a library or be flashed directly if you are happy with the default configuration and capabilities. 12The bootloader can be used either as a library or be flashed directly if you are happy with the default configuration and capabilities.
6 13
7By design, the bootloader does not provide any network capabilities. Networking capabilities for fetching new firmware can be provided by the user application, using the bootloader as a library for updating the firmware, or by using the bootloader as a library and adding this capability yourself. 14By design, the bootloader does not provide any network capabilities. Networking capabilities for fetching new firmware can be provided by the user application, using the bootloader as a library for updating the firmware, or by using the bootloader as a library and adding this capability yourself.
diff --git a/docs/pages/embassy_in_the_wild.adoc b/docs/pages/embassy_in_the_wild.adoc
index 620794c31..cedbedada 100644
--- a/docs/pages/embassy_in_the_wild.adoc
+++ b/docs/pages/embassy_in_the_wild.adoc
@@ -2,6 +2,10 @@
2 2
3Here 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]! 3Here 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_newer entries at the top_
6
7* link:https://github.com/CarlKCarlK/clock[Embassy Clock: Layered, modular bare-metal clock with emulation]
8** A `no_std` Raspberry Pi Pico clock demonstrating layered Embassy tasks (Display->Blinker->Clock) for clean separation of multiplexing, blinking, and UI logic. Features single-button HH:MM/MM:SS time-set UI, heapless data structures, and a Renode emulator for hardware-free testing. See link:https://medium.com/@carlmkadie/how-rust-embassy-shine-on-embedded-devices-part-2-aad1adfccf72[this article] for details.
5* link:https://github.com/1-rafael-1/simple-robot[A simple tracked robot based on Raspberry Pi Pico 2] 9* link:https://github.com/1-rafael-1/simple-robot[A simple tracked robot based on Raspberry Pi Pico 2]
6** A hobbyist project building a tracked robot with basic autonomous and manual drive mode. 10** A hobbyist project building a tracked robot with basic autonomous and manual drive mode.
7* link:https://github.com/1-rafael-1/pi-pico-alarmclock-rust[A Raspberry Pi Pico W Alarmclock] 11* link:https://github.com/1-rafael-1/pi-pico-alarmclock-rust[A Raspberry Pi Pico W Alarmclock]
diff --git a/docs/pages/faq.adoc b/docs/pages/faq.adoc
index b21be9a30..8098e12ac 100644
--- a/docs/pages/faq.adoc
+++ b/docs/pages/faq.adoc
@@ -6,16 +6,16 @@ Please feel free to add items to link:https://github.com/embassy-rs/embassy/edit
6 6
7== How to deploy to RP2040 or RP235x without a debugging probe. 7== How to deploy to RP2040 or RP235x without a debugging probe.
8 8
9Install link:https://github.com/JoNil/elf2uf2-rs[elf2uf2-rs] for converting the generated elf binary into a uf2 file. 9Install link:https://github.com/raspberrypi/pico-sdk-tools/releases[Picotool] for uploading the binary.
10 10
11Configure the runner to use this tool, add this to `.cargo/config.toml`: 11Configure the runner to use this tool, add this to `.cargo/config.toml`:
12[source,toml] 12[source,toml]
13---- 13----
14[target.'cfg(all(target_arch = "arm", target_os = "none"))'] 14[target.'cfg(all(target_arch = "arm", target_os = "none"))']
15runner = "elf2uf2-rs --deploy --serial --verbose" 15runner = "picotool load --update --verify --execute -t elf"
16---- 16----
17 17
18The command-line parameters `--deploy` will detect your device and upload the binary, `--serial` starts a serial connection. See the documentation for more info. 18Picotool will detect your device and upload the binary, skipping identical flash sectors (the `--update` command-line flag), verify that the binary was written correctly (`--verify`), and then run your new code (`--execute`). Run `picotool help load` for more information.
19 19
20== Missing main macro 20== Missing main macro
21 21
@@ -209,7 +209,7 @@ MEMORY
209_stack_start = ORIGIN(RAM) + LENGTH(RAM); 209_stack_start = ORIGIN(RAM) + LENGTH(RAM);
210``` 210```
211 211
212Please refer to the STM32 documentation for the specific values suitable for your board and setup. The STM32 Cube examples often contain a linker script `.ld` file. 212Please refer to the STM32 documentation for the specific values suitable for your board and setup. The STM32 Cube examples often contain a linker script `.ld` file.
213Look for the `MEMORY` section and try to determine the FLASH and RAM sizes and section start. 213Look for the `MEMORY` section and try to determine the FLASH and RAM sizes and section start.
214 214
215If you find a case where the memory.x is wrong, please report it on link:https://github.com/embassy-rs/stm32-data/issues/301[this Github issue] so other users are not caught by surprise. 215If you find a case where the memory.x is wrong, please report it on link:https://github.com/embassy-rs/stm32-data/issues/301[this Github issue] so other users are not caught by surprise.
@@ -334,7 +334,7 @@ There are two main ways to handle concurrency in Embassy:
334 334
335In general, either of these approaches will work. The main differences of these approaches are: 335In general, either of these approaches will work. The main differences of these approaches are:
336 336
337When 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. 337When 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.
338An 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]. 338An 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].
339 339
340But 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. 340But 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.
diff --git a/docs/pages/imxrt.adoc b/docs/pages/imxrt.adoc
index adf5218e8..87867e1e0 100644
--- a/docs/pages/imxrt.adoc
+++ b/docs/pages/imxrt.adoc
@@ -9,5 +9,8 @@ The link: link:https://github.com/embassy-rs/embassy/tree/main/embassy-imxrt[Emb
9 9
10The following peripherals have a HAL implementation at present 10The following peripherals have a HAL implementation at present
11 11
12* CRC
13* DMA
12* GPIO 14* GPIO
13 15* RNG
16* UART
diff --git a/docs/pages/layer_by_layer.adoc b/docs/pages/layer_by_layer.adoc
index 7dba11b5e..0692ee4fa 100644
--- a/docs/pages/layer_by_layer.adoc
+++ b/docs/pages/layer_by_layer.adoc
@@ -8,7 +8,7 @@ The application we'll write is a simple 'push button, blink led' application, wh
8 8
9== PAC version 9== PAC version
10 10
11The PAC is the lowest API for accessing peripherals and registers, if you don't count reading/writing directly to memory addresses. It provides distinct types to make accessing peripheral registers easier, but it does not prevent you from writing unsafe code. 11The PAC is the lowest API for accessing peripherals and registers, if you don't count reading/writing directly to memory addresses. It provides distinct types to make accessing peripheral registers easier, but it does little to prevent you from configuring or coordinating those registers incorrectly.
12 12
13Writing an application using the PAC directly is therefore not recommended, but if the functionality you want to use is not exposed in the upper layers, that's what you need to use. 13Writing an application using the PAC directly is therefore not recommended, but if the functionality you want to use is not exposed in the upper layers, that's what you need to use.
14 14
diff --git a/docs/pages/new_project.adoc b/docs/pages/new_project.adoc
index cd943b4f6..906d89f36 100644
--- a/docs/pages/new_project.adoc
+++ b/docs/pages/new_project.adoc
@@ -11,6 +11,8 @@ Once you’ve successfully xref:#_getting_started[run some example projects], th
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=== esp-generate
15- link:https://github.com/esp-rs/esp-generate[esp-generate] (ESP32 using esp-hal)
14 16
15== Starting a project from scratch 17== Starting a project from scratch
16 18
diff --git a/docs/pages/overview.adoc b/docs/pages/overview.adoc
index acd757795..18eaaeb75 100644
--- a/docs/pages/overview.adoc
+++ b/docs/pages/overview.adoc
@@ -30,7 +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 as well as RP235x microcontroller. 31* link:https://docs.embassy.dev/embassy-rp/[embassy-rp], for the Raspberry Pi RP2040 as well as RP235x microcontroller.
32* link:https://docs.embassy.dev/embassy-mspm0/[embassy-mspm0], for the Texas Instruments MSPM0 microcontrollers. 32* link:https://docs.embassy.dev/embassy-mspm0/[embassy-mspm0], for the Texas Instruments MSPM0 microcontrollers.
33* link:https://github.com/esp-rs[esp-rs], for the Espressif Systems ESP32 series of chips. 33* link:https://github.com/esp-rs/esp-hal[esp-hal], for the Espressif Systems ESP32 series of chips.
34* link:https://github.com/ch32-rs/ch32-hal[ch32-hal], for the WCH 32-bit RISC-V(CH32V) series of chips. 34* link:https://github.com/ch32-rs/ch32-hal[ch32-hal], for the WCH 32-bit RISC-V(CH32V) series of chips.
35* link:https://github.com/AlexCharlton/mpfs-hal[mpfs-hal], for the Microchip PolarFire SoC. 35* link:https://github.com/AlexCharlton/mpfs-hal[mpfs-hal], for the Microchip PolarFire SoC.
36* link:https://github.com/py32-rs/py32-hal[py32-hal], for the Puya Semiconductor PY32 series of chips. 36* link:https://github.com/py32-rs/py32-hal[py32-hal], for the Puya Semiconductor PY32 series of chips.
diff --git a/docs/pages/sharing_peripherals.adoc b/docs/pages/sharing_peripherals.adoc
index dfb8c1ffe..70b4210e6 100644
--- a/docs/pages/sharing_peripherals.adoc
+++ b/docs/pages/sharing_peripherals.adoc
@@ -36,8 +36,8 @@ async fn main(spawner: Spawner) {
36 let dt = 100 * 1_000_000; 36 let dt = 100 * 1_000_000;
37 let k = 1.003; 37 let k = 1.003;
38 38
39 unwrap!(spawner.spawn(toggle_led(&LED, Duration::from_nanos(dt)))); 39 spawner.spawn(unwrap!(toggle_led(&LED, Duration::from_nanos(dt))));
40 unwrap!(spawner.spawn(toggle_led(&LED, Duration::from_nanos((dt as f64 * k) as u64)))); 40 spawner.spawn(unwrap!(toggle_led(&LED, Duration::from_nanos((dt as f64 * k) as u64))));
41} 41}
42 42
43// A pool size of 2 means you can spawn two instances of this task. 43// A pool size of 2 means you can spawn two instances of this task.
@@ -103,8 +103,8 @@ async fn main(spawner: Spawner) {
103 let dt = 100 * 1_000_000; 103 let dt = 100 * 1_000_000;
104 let k = 1.003; 104 let k = 1.003;
105 105
106 unwrap!(spawner.spawn(toggle_led(CHANNEL.sender(), Duration::from_nanos(dt)))); 106 spawner.spawn(unwrap!(toggle_led(CHANNEL.sender(), Duration::from_nanos(dt))));
107 unwrap!(spawner.spawn(toggle_led(CHANNEL.sender(), Duration::from_nanos((dt as f64 * k) as u64)))); 107 spawner.spawn(unwrap!(toggle_led(CHANNEL.sender(), Duration::from_nanos((dt as f64 * k) as u64))));
108 108
109 loop { 109 loop {
110 match CHANNEL.receive().await { 110 match CHANNEL.receive().await {