diff options
| author | Tobias Naumann <[email protected]> | 2025-03-31 16:48:13 +0200 |
|---|---|---|
| committer | Tobias Naumann <[email protected]> | 2025-03-31 16:48:13 +0200 |
| commit | c29fc3532b34633b2234c26a7e41e8ba6d628e7f (patch) | |
| tree | 667bc74b504a65592c805fd3f66197bd2126801f /examples | |
| parent | 14d079ae84ac28ce860015ad6ca8d040edf3f065 (diff) | |
| parent | 4d9b41714da77d82811f39bd6feabe161e93552c (diff) | |
Merge branch 'main' into fix/ringbuffered-error-handling to resolve merge conflicts
Diffstat (limited to 'examples')
134 files changed, 1019 insertions, 188 deletions
diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml index 78227c49c..4ae0e6a77 100644 --- a/examples/boot/application/nrf/Cargo.toml +++ b/examples/boot/application/nrf/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-16384", "arch-cortex-m", "executor-thread", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [] } |
| 11 | embassy-nrf = { version = "0.3.1", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", ] } | 11 | embassy-nrf = { version = "0.3.1", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", ] } |
| 12 | embassy-boot = { version = "0.4.0", path = "../../../../embassy-boot", features = [] } | 12 | embassy-boot = { version = "0.4.0", path = "../../../../embassy-boot", features = [] } |
diff --git a/examples/boot/application/rp/Cargo.toml b/examples/boot/application/rp/Cargo.toml index 3f0d4cd78..fa4a7d44f 100644 --- a/examples/boot/application/rp/Cargo.toml +++ b/examples/boot/application/rp/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-16384", "arch-cortex-m", "executor-thread", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [] } |
| 11 | embassy-rp = { version = "0.4.0", path = "../../../../embassy-rp", features = ["time-driver", "rp2040"] } | 11 | embassy-rp = { version = "0.4.0", path = "../../../../embassy-rp", features = ["time-driver", "rp2040"] } |
| 12 | embassy-boot-rp = { version = "0.5.0", path = "../../../../embassy-boot-rp", features = [] } | 12 | embassy-boot-rp = { version = "0.5.0", path = "../../../../embassy-boot-rp", features = [] } |
diff --git a/examples/boot/application/stm32f3/Cargo.toml b/examples/boot/application/stm32f3/Cargo.toml index 2590e9c49..f32727ea8 100644 --- a/examples/boot/application/stm32f3/Cargo.toml +++ b/examples/boot/application/stm32f3/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f303re", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f303re", "time-driver-any", "exti"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32" } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32" } |
diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml index fac73afd7..6a5a500de 100644 --- a/examples/boot/application/stm32f7/Cargo.toml +++ b/examples/boot/application/stm32f7/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } |
diff --git a/examples/boot/application/stm32h7/Cargo.toml b/examples/boot/application/stm32h7/Cargo.toml index 587d303ab..dd3a32e45 100644 --- a/examples/boot/application/stm32h7/Cargo.toml +++ b/examples/boot/application/stm32h7/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32h743zi", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32h743zi", "time-driver-any", "exti"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } |
diff --git a/examples/boot/application/stm32l0/Cargo.toml b/examples/boot/application/stm32l0/Cargo.toml index b3c580d3d..0b9e9b96a 100644 --- a/examples/boot/application/stm32l0/Cargo.toml +++ b/examples/boot/application/stm32l0/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l072cz", "time-driver-any", "exti", "memory-x"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l072cz", "time-driver-any", "exti", "memory-x"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } |
diff --git a/examples/boot/application/stm32l1/Cargo.toml b/examples/boot/application/stm32l1/Cargo.toml index 8c49be914..490541a2e 100644 --- a/examples/boot/application/stm32l1/Cargo.toml +++ b/examples/boot/application/stm32l1/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l151cb-a", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l151cb-a", "time-driver-any", "exti"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } |
diff --git a/examples/boot/application/stm32l4/Cargo.toml b/examples/boot/application/stm32l4/Cargo.toml index 28c74303a..c3aa31161 100644 --- a/examples/boot/application/stm32l4/Cargo.toml +++ b/examples/boot/application/stm32l4/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "time-driver-any", "exti"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } |
diff --git a/examples/boot/application/stm32wb-dfu/Cargo.toml b/examples/boot/application/stm32wb-dfu/Cargo.toml index deaf4c388..a89e2bb6e 100644 --- a/examples/boot/application/stm32wb-dfu/Cargo.toml +++ b/examples/boot/application/stm32wb-dfu/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32wb55rg", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32wb55rg", "time-driver-any", "exti"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } |
diff --git a/examples/boot/application/stm32wl/Cargo.toml b/examples/boot/application/stm32wl/Cargo.toml index 890d0b510..f4d7ae712 100644 --- a/examples/boot/application/stm32wl/Cargo.toml +++ b/examples/boot/application/stm32wl/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } | 8 | embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32wl55jc-cm4", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32wl55jc-cm4", "time-driver-any", "exti"] } |
| 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } | 12 | embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } |
diff --git a/examples/lpc55s69/Cargo.toml b/examples/lpc55s69/Cargo.toml index afd76f9ac..f5a6e6995 100644 --- a/examples/lpc55s69/Cargo.toml +++ b/examples/lpc55s69/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy-nxp = { version = "0.1.0", path = "../../embassy-nxp", features = ["rt"] } | 9 | embassy-nxp = { version = "0.1.0", path = "../../embassy-nxp", features = ["rt"] } |
| 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt"] } | 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } |
| 11 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 11 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } |
| 13 | panic-halt = "0.2.0" | 13 | panic-halt = "0.2.0" |
diff --git a/examples/mspm0c1104/.cargo/config.toml b/examples/mspm0c1104/.cargo/config.toml new file mode 100644 index 000000000..204a56b1c --- /dev/null +++ b/examples/mspm0c1104/.cargo/config.toml | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
| 2 | # replace MSPM0C1104 with your chip as listed in `probe-rs chip list` | ||
| 3 | runner = "probe-rs run --chip MSPM0C1104 --protocol=swd" | ||
| 4 | |||
| 5 | [build] | ||
| 6 | target = "thumbv6m-none-eabi" | ||
| 7 | |||
| 8 | [env] | ||
| 9 | DEFMT_LOG = "debug" | ||
| 10 | # defmt's buffer needs to be shrunk since the MSPM0C1104 only has 1KB of ram. | ||
| 11 | DEFMT_RTT_BUFFER_SIZE = "72" | ||
diff --git a/examples/mspm0c1104/Cargo.toml b/examples/mspm0c1104/Cargo.toml new file mode 100644 index 000000000..7c382482a --- /dev/null +++ b/examples/mspm0c1104/Cargo.toml | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | [package] | ||
| 2 | edition = "2021" | ||
| 3 | name = "embassy-mspm0-c1104-examples" | ||
| 4 | version = "0.1.0" | ||
| 5 | license = "MIT OR Apache-2.0" | ||
| 6 | |||
| 7 | [dependencies] | ||
| 8 | embassy-mspm0 = { version = "0.1.0", path = "../../embassy-mspm0", features = ["mspm0c110x", "rt", "time-driver-any"] } | ||
| 9 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } | ||
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | ||
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } | ||
| 12 | panic-halt = "0.2.0" | ||
| 13 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | ||
| 14 | cortex-m-rt = { version = "0.7.0"} | ||
| 15 | defmt = "0.3" | ||
| 16 | defmt-rtt = "0.4" | ||
| 17 | panic-probe = { version = "0.3.2", features = ["print-defmt"] } | ||
| 18 | panic-semihosting = "0.6.0" | ||
| 19 | |||
| 20 | # The chip only has 1KB of ram, so we must optimize binaries regardless | ||
| 21 | [profile.dev] | ||
| 22 | debug = 0 | ||
| 23 | opt-level = "z" | ||
| 24 | lto = true | ||
| 25 | codegen-units = 1 | ||
| 26 | # strip = true | ||
| 27 | |||
| 28 | [profile.release] | ||
| 29 | debug = 0 | ||
| 30 | opt-level = "z" | ||
| 31 | lto = true | ||
| 32 | codegen-units = 1 | ||
diff --git a/examples/mspm0c1104/README.md b/examples/mspm0c1104/README.md new file mode 100644 index 000000000..e5c9f961d --- /dev/null +++ b/examples/mspm0c1104/README.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # Examples for MSPM0C110x family | ||
| 2 | |||
| 3 | Run individual examples with | ||
| 4 | ``` | ||
| 5 | cargo run --bin <module-name> | ||
| 6 | ``` | ||
| 7 | for example | ||
| 8 | ``` | ||
| 9 | cargo run --bin blinky | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## Checklist before running examples | ||
| 13 | A large number of the examples are written for the [LP-MSPM0C1104](https://www.ti.com/tool/LP-MSPM0C1104) board. | ||
| 14 | |||
| 15 | You might need to adjust `.cargo/config.toml`, `Cargo.toml` and possibly update pin numbers or peripherals to match the specific MCU or board you are using. | ||
| 16 | |||
| 17 | * [ ] Update .cargo/config.toml with the correct probe-rs command to use your specific MCU. For example for C1104 it should be `probe-rs run --chip MSPM0C1104`. (use `probe-rs chip list` to find your chip) | ||
| 18 | * [ ] Update Cargo.toml to have the correct `embassy-mspm0` feature. For example for C1104 it should be `mspm0c1104`. Look in the `Cargo.toml` file of the `embassy-mspm0` project to find the correct feature flag for your chip. | ||
| 19 | * [ ] If your board has a special clock or power configuration, make sure that it is set up appropriately. | ||
| 20 | * [ ] If your board has different pin mapping, update any pin numbers or peripherals in the given example code to match your schematic | ||
| 21 | |||
| 22 | If you are unsure, please drop by the Embassy Matrix chat for support, and let us know: | ||
| 23 | |||
| 24 | * Which example you are trying to run | ||
| 25 | * Which chip and board you are using | ||
| 26 | |||
| 27 | Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org | ||
diff --git a/examples/mspm0c1104/build.rs b/examples/mspm0c1104/build.rs new file mode 100644 index 000000000..30691aa97 --- /dev/null +++ b/examples/mspm0c1104/build.rs | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | //! This build script copies the `memory.x` file from the crate root into | ||
| 2 | //! a directory where the linker can always find it at build time. | ||
| 3 | //! For many projects this is optional, as the linker always searches the | ||
| 4 | //! project root directory -- wherever `Cargo.toml` is. However, if you | ||
| 5 | //! are using a workspace or have a more complicated build setup, this | ||
| 6 | //! build script becomes required. Additionally, by requesting that | ||
| 7 | //! Cargo re-run the build script whenever `memory.x` is changed, | ||
| 8 | //! updating `memory.x` ensures a rebuild of the application with the | ||
| 9 | //! new memory settings. | ||
| 10 | |||
| 11 | use std::env; | ||
| 12 | use std::fs::File; | ||
| 13 | use std::io::Write; | ||
| 14 | use std::path::PathBuf; | ||
| 15 | |||
| 16 | fn main() { | ||
| 17 | // Put `memory.x` in our output directory and ensure it's | ||
| 18 | // on the linker search path. | ||
| 19 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
| 20 | File::create(out.join("memory.x")) | ||
| 21 | .unwrap() | ||
| 22 | .write_all(include_bytes!("memory.x")) | ||
| 23 | .unwrap(); | ||
| 24 | println!("cargo:rustc-link-search={}", out.display()); | ||
| 25 | |||
| 26 | // By default, Cargo will re-run a build script whenever | ||
| 27 | // any file in the project changes. By specifying `memory.x` | ||
| 28 | // here, we ensure the build script is only re-run when | ||
| 29 | // `memory.x` is changed. | ||
| 30 | println!("cargo:rerun-if-changed=memory.x"); | ||
| 31 | |||
| 32 | println!("cargo:rustc-link-arg-bins=--nmagic"); | ||
| 33 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 34 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||
| 35 | } | ||
diff --git a/examples/mspm0c1104/memory.x b/examples/mspm0c1104/memory.x new file mode 100644 index 000000000..a9108835a --- /dev/null +++ b/examples/mspm0c1104/memory.x | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | FLASH : ORIGIN = 0x00000000, LENGTH = 16K | ||
| 4 | RAM : ORIGIN = 0x20000000, LENGTH = 1K | ||
| 5 | } | ||
diff --git a/examples/mspm0c1104/src/bin/blinky.rs b/examples/mspm0c1104/src/bin/blinky.rs new file mode 100644 index 000000000..0d974cc5e --- /dev/null +++ b/examples/mspm0c1104/src/bin/blinky.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Level, Output}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use embassy_time::Timer; | ||
| 9 | use {defmt_rtt as _, panic_halt as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) -> ! { | ||
| 13 | info!("Hello world!"); | ||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let mut led1 = Output::new(p.PA22, Level::Low); | ||
| 17 | led1.set_inversion(true); | ||
| 18 | |||
| 19 | loop { | ||
| 20 | Timer::after_millis(400).await; | ||
| 21 | |||
| 22 | info!("Toggle"); | ||
| 23 | led1.toggle(); | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/examples/mspm0c1104/src/bin/button.rs b/examples/mspm0c1104/src/bin/button.rs new file mode 100644 index 000000000..7face1618 --- /dev/null +++ b/examples/mspm0c1104/src/bin/button.rs | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Input, Level, Output, Pull}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use {defmt_rtt as _, panic_halt as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) -> ! { | ||
| 12 | info!("Hello world!"); | ||
| 13 | |||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let led1 = p.PA22; | ||
| 17 | let s2 = p.PA16; | ||
| 18 | |||
| 19 | let mut led1 = Output::new(led1, Level::Low); | ||
| 20 | |||
| 21 | let mut s2 = Input::new(s2, Pull::Up); | ||
| 22 | |||
| 23 | // led1 is active low | ||
| 24 | led1.set_high(); | ||
| 25 | |||
| 26 | loop { | ||
| 27 | s2.wait_for_falling_edge().await; | ||
| 28 | |||
| 29 | info!("Switch 2 was pressed"); | ||
| 30 | |||
| 31 | led1.toggle(); | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/examples/mspm0g3507/.cargo/config.toml b/examples/mspm0g3507/.cargo/config.toml new file mode 100644 index 000000000..34c720cdd --- /dev/null +++ b/examples/mspm0g3507/.cargo/config.toml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
| 2 | # replace MSPM0G3507 with your chip as listed in `probe-rs chip list` | ||
| 3 | runner = "probe-rs run --chip MSPM0G3507 --protocol=swd" | ||
| 4 | |||
| 5 | [build] | ||
| 6 | target = "thumbv6m-none-eabi" | ||
| 7 | |||
| 8 | [env] | ||
| 9 | DEFMT_LOG = "debug" | ||
diff --git a/examples/mspm0g3507/Cargo.toml b/examples/mspm0g3507/Cargo.toml new file mode 100644 index 000000000..9bc82151c --- /dev/null +++ b/examples/mspm0g3507/Cargo.toml | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | [package] | ||
| 2 | edition = "2021" | ||
| 3 | name = "embassy-mspm0-g3507-examples" | ||
| 4 | version = "0.1.0" | ||
| 5 | license = "MIT OR Apache-2.0" | ||
| 6 | |||
| 7 | [dependencies] | ||
| 8 | embassy-mspm0 = { version = "0.1.0", path = "../../embassy-mspm0", features = ["mspm0g350x", "rt", "time-driver-any"] } | ||
| 9 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } | ||
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | ||
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } | ||
| 12 | panic-halt = "0.2.0" | ||
| 13 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | ||
| 14 | cortex-m-rt = { version = "0.7.0"} | ||
| 15 | defmt = "0.3" | ||
| 16 | defmt-rtt = "0.4" | ||
| 17 | panic-probe = { version = "0.3.2", features = ["print-defmt"] } | ||
| 18 | panic-semihosting = "0.6.0" | ||
| 19 | |||
| 20 | [profile.release] | ||
| 21 | debug = 2 | ||
diff --git a/examples/mspm0g3507/README.md b/examples/mspm0g3507/README.md new file mode 100644 index 000000000..5e8a83212 --- /dev/null +++ b/examples/mspm0g3507/README.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # Examples for MSPM0C350x family | ||
| 2 | |||
| 3 | Run individual examples with | ||
| 4 | ``` | ||
| 5 | cargo run --bin <module-name> | ||
| 6 | ``` | ||
| 7 | for example | ||
| 8 | ``` | ||
| 9 | cargo run --bin blinky | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## Checklist before running examples | ||
| 13 | A large number of the examples are written for the [LP-MSPM0G3507](https://www.ti.com/tool/LP-MSPM0G3507) board. | ||
| 14 | |||
| 15 | You might need to adjust `.cargo/config.toml`, `Cargo.toml` and possibly update pin numbers or peripherals to match the specific MCU or board you are using. | ||
| 16 | |||
| 17 | * [ ] Update .cargo/config.toml with the correct probe-rs command to use your specific MCU. For example for G3507 it should be `probe-rs run --chip MSPM0G3507`. (use `probe-rs chip list` to find your chip) | ||
| 18 | * [ ] Update Cargo.toml to have the correct `embassy-mspm0` feature. For example for G3507 it should be `mspm0g3507`. Look in the `Cargo.toml` file of the `embassy-mspm0` project to find the correct feature flag for your chip. | ||
| 19 | * [ ] If your board has a special clock or power configuration, make sure that it is set up appropriately. | ||
| 20 | * [ ] If your board has different pin mapping, update any pin numbers or peripherals in the given example code to match your schematic | ||
| 21 | |||
| 22 | If you are unsure, please drop by the Embassy Matrix chat for support, and let us know: | ||
| 23 | |||
| 24 | * Which example you are trying to run | ||
| 25 | * Which chip and board you are using | ||
| 26 | |||
| 27 | Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org | ||
diff --git a/examples/mspm0g3507/build.rs b/examples/mspm0g3507/build.rs new file mode 100644 index 000000000..30691aa97 --- /dev/null +++ b/examples/mspm0g3507/build.rs | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | //! This build script copies the `memory.x` file from the crate root into | ||
| 2 | //! a directory where the linker can always find it at build time. | ||
| 3 | //! For many projects this is optional, as the linker always searches the | ||
| 4 | //! project root directory -- wherever `Cargo.toml` is. However, if you | ||
| 5 | //! are using a workspace or have a more complicated build setup, this | ||
| 6 | //! build script becomes required. Additionally, by requesting that | ||
| 7 | //! Cargo re-run the build script whenever `memory.x` is changed, | ||
| 8 | //! updating `memory.x` ensures a rebuild of the application with the | ||
| 9 | //! new memory settings. | ||
| 10 | |||
| 11 | use std::env; | ||
| 12 | use std::fs::File; | ||
| 13 | use std::io::Write; | ||
| 14 | use std::path::PathBuf; | ||
| 15 | |||
| 16 | fn main() { | ||
| 17 | // Put `memory.x` in our output directory and ensure it's | ||
| 18 | // on the linker search path. | ||
| 19 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
| 20 | File::create(out.join("memory.x")) | ||
| 21 | .unwrap() | ||
| 22 | .write_all(include_bytes!("memory.x")) | ||
| 23 | .unwrap(); | ||
| 24 | println!("cargo:rustc-link-search={}", out.display()); | ||
| 25 | |||
| 26 | // By default, Cargo will re-run a build script whenever | ||
| 27 | // any file in the project changes. By specifying `memory.x` | ||
| 28 | // here, we ensure the build script is only re-run when | ||
| 29 | // `memory.x` is changed. | ||
| 30 | println!("cargo:rerun-if-changed=memory.x"); | ||
| 31 | |||
| 32 | println!("cargo:rustc-link-arg-bins=--nmagic"); | ||
| 33 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 34 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||
| 35 | } | ||
diff --git a/examples/mspm0g3507/memory.x b/examples/mspm0g3507/memory.x new file mode 100644 index 000000000..37e381fbd --- /dev/null +++ b/examples/mspm0g3507/memory.x | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | FLASH : ORIGIN = 0x00000000, LENGTH = 128K | ||
| 4 | /* Select non-parity range of SRAM due to SRAM_ERR_01 errata in SLAZ758 */ | ||
| 5 | RAM : ORIGIN = 0x20200000, LENGTH = 32K | ||
| 6 | } | ||
diff --git a/examples/mspm0g3507/src/bin/blinky.rs b/examples/mspm0g3507/src/bin/blinky.rs new file mode 100644 index 000000000..055a5cd81 --- /dev/null +++ b/examples/mspm0g3507/src/bin/blinky.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Level, Output}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use embassy_time::Timer; | ||
| 9 | use {defmt_rtt as _, panic_halt as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) -> ! { | ||
| 13 | info!("Hello world!"); | ||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let mut led1 = Output::new(p.PA0, Level::Low); | ||
| 17 | led1.set_inversion(true); | ||
| 18 | |||
| 19 | loop { | ||
| 20 | Timer::after_millis(400).await; | ||
| 21 | |||
| 22 | info!("Toggle"); | ||
| 23 | led1.toggle(); | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/examples/mspm0g3507/src/bin/button.rs b/examples/mspm0g3507/src/bin/button.rs new file mode 100644 index 000000000..cde1f2892 --- /dev/null +++ b/examples/mspm0g3507/src/bin/button.rs | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Input, Level, Output, Pull}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use {defmt_rtt as _, panic_halt as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) -> ! { | ||
| 12 | info!("Hello world!"); | ||
| 13 | |||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let led1 = p.PA0; | ||
| 17 | let s2 = p.PB21; | ||
| 18 | |||
| 19 | let mut led1 = Output::new(led1, Level::Low); | ||
| 20 | |||
| 21 | let mut s2 = Input::new(s2, Pull::Up); | ||
| 22 | |||
| 23 | // led1 is active low | ||
| 24 | led1.set_high(); | ||
| 25 | |||
| 26 | loop { | ||
| 27 | s2.wait_for_falling_edge().await; | ||
| 28 | |||
| 29 | info!("Switch 2 was pressed"); | ||
| 30 | |||
| 31 | led1.toggle(); | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/examples/mspm0g3519/.cargo/config.toml b/examples/mspm0g3519/.cargo/config.toml new file mode 100644 index 000000000..7bba4646f --- /dev/null +++ b/examples/mspm0g3519/.cargo/config.toml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
| 2 | # replace MSPM0G3519 with your chip as listed in `probe-rs chip list` | ||
| 3 | runner = "probe-rs run --restore-unwritten --verify --chip MSPM0G3519 --protocol=swd" | ||
| 4 | |||
| 5 | [build] | ||
| 6 | target = "thumbv6m-none-eabi" | ||
| 7 | |||
| 8 | [env] | ||
| 9 | DEFMT_LOG = "trace" | ||
diff --git a/examples/mspm0g3519/Cargo.toml b/examples/mspm0g3519/Cargo.toml new file mode 100644 index 000000000..a28ce2f11 --- /dev/null +++ b/examples/mspm0g3519/Cargo.toml | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | [package] | ||
| 2 | edition = "2021" | ||
| 3 | name = "embassy-mspm0-g3519-examples" | ||
| 4 | version = "0.1.0" | ||
| 5 | license = "MIT OR Apache-2.0" | ||
| 6 | |||
| 7 | [dependencies] | ||
| 8 | embassy-mspm0 = { version = "0.1.0", path = "../../embassy-mspm0", features = ["mspm0g351x", "rt", "time-driver-any"] } | ||
| 9 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } | ||
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | ||
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } | ||
| 12 | panic-halt = "0.2.0" | ||
| 13 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | ||
| 14 | cortex-m-rt = { version = "0.7.0"} | ||
| 15 | defmt = "0.3" | ||
| 16 | defmt-rtt = "0.4" | ||
| 17 | panic-probe = { version = "0.3.2", features = ["print-defmt"] } | ||
| 18 | panic-semihosting = "0.6.0" | ||
| 19 | |||
| 20 | [profile.release] | ||
| 21 | debug = 2 | ||
diff --git a/examples/mspm0g3519/README.md b/examples/mspm0g3519/README.md new file mode 100644 index 000000000..5034b1913 --- /dev/null +++ b/examples/mspm0g3519/README.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # Examples for MSPM0G351x family | ||
| 2 | |||
| 3 | Run individual examples with | ||
| 4 | ``` | ||
| 5 | cargo run --bin <module-name> | ||
| 6 | ``` | ||
| 7 | for example | ||
| 8 | ``` | ||
| 9 | cargo run --bin blinky | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## Checklist before running examples | ||
| 13 | A large number of the examples are written for the [LP-MSPM0G3519](https://www.ti.com/tool/LP-MSPM0G3519) board. | ||
| 14 | |||
| 15 | You might need to adjust `.cargo/config.toml`, `Cargo.toml` and possibly update pin numbers or peripherals to match the specific MCU or board you are using. | ||
| 16 | |||
| 17 | * [ ] Update .cargo/config.toml with the correct probe-rs command to use your specific MCU. For example for G3519 it should be `probe-rs run --chip MSPM0G3519`. (use `probe-rs chip list` to find your chip) | ||
| 18 | * [ ] Update Cargo.toml to have the correct `embassy-mspm0` feature. For example for G3519 it should be `mspm0g3519`. Look in the `Cargo.toml` file of the `embassy-mspm0` project to find the correct feature flag for your chip. | ||
| 19 | * [ ] If your board has a special clock or power configuration, make sure that it is set up appropriately. | ||
| 20 | * [ ] If your board has different pin mapping, update any pin numbers or peripherals in the given example code to match your schematic | ||
| 21 | |||
| 22 | If you are unsure, please drop by the Embassy Matrix chat for support, and let us know: | ||
| 23 | |||
| 24 | * Which example you are trying to run | ||
| 25 | * Which chip and board you are using | ||
| 26 | |||
| 27 | Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org | ||
diff --git a/examples/mspm0g3519/build.rs b/examples/mspm0g3519/build.rs new file mode 100644 index 000000000..30691aa97 --- /dev/null +++ b/examples/mspm0g3519/build.rs | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | //! This build script copies the `memory.x` file from the crate root into | ||
| 2 | //! a directory where the linker can always find it at build time. | ||
| 3 | //! For many projects this is optional, as the linker always searches the | ||
| 4 | //! project root directory -- wherever `Cargo.toml` is. However, if you | ||
| 5 | //! are using a workspace or have a more complicated build setup, this | ||
| 6 | //! build script becomes required. Additionally, by requesting that | ||
| 7 | //! Cargo re-run the build script whenever `memory.x` is changed, | ||
| 8 | //! updating `memory.x` ensures a rebuild of the application with the | ||
| 9 | //! new memory settings. | ||
| 10 | |||
| 11 | use std::env; | ||
| 12 | use std::fs::File; | ||
| 13 | use std::io::Write; | ||
| 14 | use std::path::PathBuf; | ||
| 15 | |||
| 16 | fn main() { | ||
| 17 | // Put `memory.x` in our output directory and ensure it's | ||
| 18 | // on the linker search path. | ||
| 19 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
| 20 | File::create(out.join("memory.x")) | ||
| 21 | .unwrap() | ||
| 22 | .write_all(include_bytes!("memory.x")) | ||
| 23 | .unwrap(); | ||
| 24 | println!("cargo:rustc-link-search={}", out.display()); | ||
| 25 | |||
| 26 | // By default, Cargo will re-run a build script whenever | ||
| 27 | // any file in the project changes. By specifying `memory.x` | ||
| 28 | // here, we ensure the build script is only re-run when | ||
| 29 | // `memory.x` is changed. | ||
| 30 | println!("cargo:rerun-if-changed=memory.x"); | ||
| 31 | |||
| 32 | println!("cargo:rustc-link-arg-bins=--nmagic"); | ||
| 33 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 34 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||
| 35 | } | ||
diff --git a/examples/mspm0g3519/memory.x b/examples/mspm0g3519/memory.x new file mode 100644 index 000000000..e6e0ec9e9 --- /dev/null +++ b/examples/mspm0g3519/memory.x | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | FLASH : ORIGIN = 0x00000000, LENGTH = 512K | ||
| 4 | /* Select non-parity range of SRAM due to SRAM_ERR_01 errata in SLAZ758 */ | ||
| 5 | RAM : ORIGIN = 0x20200000, LENGTH = 128K | ||
| 6 | } | ||
diff --git a/examples/mspm0g3519/src/bin/blinky.rs b/examples/mspm0g3519/src/bin/blinky.rs new file mode 100644 index 000000000..055a5cd81 --- /dev/null +++ b/examples/mspm0g3519/src/bin/blinky.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Level, Output}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use embassy_time::Timer; | ||
| 9 | use {defmt_rtt as _, panic_halt as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) -> ! { | ||
| 13 | info!("Hello world!"); | ||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let mut led1 = Output::new(p.PA0, Level::Low); | ||
| 17 | led1.set_inversion(true); | ||
| 18 | |||
| 19 | loop { | ||
| 20 | Timer::after_millis(400).await; | ||
| 21 | |||
| 22 | info!("Toggle"); | ||
| 23 | led1.toggle(); | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/examples/mspm0g3519/src/bin/button.rs b/examples/mspm0g3519/src/bin/button.rs new file mode 100644 index 000000000..c81cc2918 --- /dev/null +++ b/examples/mspm0g3519/src/bin/button.rs | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Input, Level, Output, Pull}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use {defmt_rtt as _, panic_halt as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) -> ! { | ||
| 12 | info!("Hello world!"); | ||
| 13 | |||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let led1 = p.PA0; | ||
| 17 | let s2 = p.PB3; | ||
| 18 | |||
| 19 | let mut led1 = Output::new(led1, Level::Low); | ||
| 20 | |||
| 21 | let mut s2 = Input::new(s2, Pull::Up); | ||
| 22 | |||
| 23 | // led1 is active low | ||
| 24 | led1.set_high(); | ||
| 25 | |||
| 26 | loop { | ||
| 27 | s2.wait_for_falling_edge().await; | ||
| 28 | |||
| 29 | info!("Switch 2 was pressed"); | ||
| 30 | |||
| 31 | led1.toggle(); | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/examples/mspm0l1306/.cargo/config.toml b/examples/mspm0l1306/.cargo/config.toml new file mode 100644 index 000000000..93f148a71 --- /dev/null +++ b/examples/mspm0l1306/.cargo/config.toml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
| 2 | # replace MSPM0L1306 with your chip as listed in `probe-rs chip list` | ||
| 3 | runner = "probe-rs run --chip MSPM0L1306 --protocol=swd" | ||
| 4 | |||
| 5 | [build] | ||
| 6 | target = "thumbv6m-none-eabi" | ||
| 7 | |||
| 8 | [env] | ||
| 9 | DEFMT_LOG = "trace" | ||
diff --git a/examples/mspm0l1306/Cargo.toml b/examples/mspm0l1306/Cargo.toml new file mode 100644 index 000000000..3962eb156 --- /dev/null +++ b/examples/mspm0l1306/Cargo.toml | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | [package] | ||
| 2 | edition = "2021" | ||
| 3 | name = "embassy-mspm0-l1306-examples" | ||
| 4 | version = "0.1.0" | ||
| 5 | license = "MIT OR Apache-2.0" | ||
| 6 | |||
| 7 | [dependencies] | ||
| 8 | embassy-mspm0 = { version = "0.1.0", path = "../../embassy-mspm0", features = ["mspm0l130x", "rt", "time-driver-any"] } | ||
| 9 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } | ||
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | ||
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } | ||
| 12 | panic-halt = "0.2.0" | ||
| 13 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | ||
| 14 | cortex-m-rt = { version = "0.7.0"} | ||
| 15 | defmt = "0.3" | ||
| 16 | defmt-rtt = "0.4" | ||
| 17 | panic-probe = { version = "0.3.2", features = ["print-defmt"] } | ||
| 18 | panic-semihosting = "0.6.0" | ||
| 19 | |||
| 20 | [profile.release] | ||
| 21 | debug = 2 | ||
diff --git a/examples/mspm0l1306/README.md b/examples/mspm0l1306/README.md new file mode 100644 index 000000000..5a55d721e --- /dev/null +++ b/examples/mspm0l1306/README.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # Examples for MSPM0L130x family | ||
| 2 | |||
| 3 | Run individual examples with | ||
| 4 | ``` | ||
| 5 | cargo run --bin <module-name> | ||
| 6 | ``` | ||
| 7 | for example | ||
| 8 | ``` | ||
| 9 | cargo run --bin blinky | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## Checklist before running examples | ||
| 13 | A large number of the examples are written for the [LP-MSPM0L1306](https://www.ti.com/tool/LP-MSPM0L1306) board. | ||
| 14 | |||
| 15 | You might need to adjust `.cargo/config.toml`, `Cargo.toml` and possibly update pin numbers or peripherals to match the specific MCU or board you are using. | ||
| 16 | |||
| 17 | * [ ] Update .cargo/config.toml with the correct probe-rs command to use your specific MCU. For example for L1306 it should be `probe-rs run --chip MSPM0L1306`. (use `probe-rs chip list` to find your chip) | ||
| 18 | * [ ] Update Cargo.toml to have the correct `embassy-mspm0` feature. For example for L1306 it should be `mspm0l1306`. Look in the `Cargo.toml` file of the `embassy-mspm0` project to find the correct feature flag for your chip. | ||
| 19 | * [ ] If your board has a special clock or power configuration, make sure that it is set up appropriately. | ||
| 20 | * [ ] If your board has different pin mapping, update any pin numbers or peripherals in the given example code to match your schematic | ||
| 21 | |||
| 22 | If you are unsure, please drop by the Embassy Matrix chat for support, and let us know: | ||
| 23 | |||
| 24 | * Which example you are trying to run | ||
| 25 | * Which chip and board you are using | ||
| 26 | |||
| 27 | Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org | ||
diff --git a/examples/mspm0l1306/build.rs b/examples/mspm0l1306/build.rs new file mode 100644 index 000000000..30691aa97 --- /dev/null +++ b/examples/mspm0l1306/build.rs | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | //! This build script copies the `memory.x` file from the crate root into | ||
| 2 | //! a directory where the linker can always find it at build time. | ||
| 3 | //! For many projects this is optional, as the linker always searches the | ||
| 4 | //! project root directory -- wherever `Cargo.toml` is. However, if you | ||
| 5 | //! are using a workspace or have a more complicated build setup, this | ||
| 6 | //! build script becomes required. Additionally, by requesting that | ||
| 7 | //! Cargo re-run the build script whenever `memory.x` is changed, | ||
| 8 | //! updating `memory.x` ensures a rebuild of the application with the | ||
| 9 | //! new memory settings. | ||
| 10 | |||
| 11 | use std::env; | ||
| 12 | use std::fs::File; | ||
| 13 | use std::io::Write; | ||
| 14 | use std::path::PathBuf; | ||
| 15 | |||
| 16 | fn main() { | ||
| 17 | // Put `memory.x` in our output directory and ensure it's | ||
| 18 | // on the linker search path. | ||
| 19 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
| 20 | File::create(out.join("memory.x")) | ||
| 21 | .unwrap() | ||
| 22 | .write_all(include_bytes!("memory.x")) | ||
| 23 | .unwrap(); | ||
| 24 | println!("cargo:rustc-link-search={}", out.display()); | ||
| 25 | |||
| 26 | // By default, Cargo will re-run a build script whenever | ||
| 27 | // any file in the project changes. By specifying `memory.x` | ||
| 28 | // here, we ensure the build script is only re-run when | ||
| 29 | // `memory.x` is changed. | ||
| 30 | println!("cargo:rerun-if-changed=memory.x"); | ||
| 31 | |||
| 32 | println!("cargo:rustc-link-arg-bins=--nmagic"); | ||
| 33 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 34 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||
| 35 | } | ||
diff --git a/examples/mspm0l1306/memory.x b/examples/mspm0l1306/memory.x new file mode 100644 index 000000000..d93b61f44 --- /dev/null +++ b/examples/mspm0l1306/memory.x | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | FLASH : ORIGIN = 0x00000000, LENGTH = 64K | ||
| 4 | RAM : ORIGIN = 0x20000000, LENGTH = 4K | ||
| 5 | } | ||
diff --git a/examples/mspm0l1306/src/bin/blinky.rs b/examples/mspm0l1306/src/bin/blinky.rs new file mode 100644 index 000000000..055a5cd81 --- /dev/null +++ b/examples/mspm0l1306/src/bin/blinky.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Level, Output}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use embassy_time::Timer; | ||
| 9 | use {defmt_rtt as _, panic_halt as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) -> ! { | ||
| 13 | info!("Hello world!"); | ||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let mut led1 = Output::new(p.PA0, Level::Low); | ||
| 17 | led1.set_inversion(true); | ||
| 18 | |||
| 19 | loop { | ||
| 20 | Timer::after_millis(400).await; | ||
| 21 | |||
| 22 | info!("Toggle"); | ||
| 23 | led1.toggle(); | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/examples/mspm0l1306/src/bin/button.rs b/examples/mspm0l1306/src/bin/button.rs new file mode 100644 index 000000000..d8c85947f --- /dev/null +++ b/examples/mspm0l1306/src/bin/button.rs | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Input, Level, Output, Pull}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use {defmt_rtt as _, panic_halt as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) -> ! { | ||
| 12 | info!("Hello world!"); | ||
| 13 | |||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let led1 = p.PA0; | ||
| 17 | let s2 = p.PA14; | ||
| 18 | |||
| 19 | let mut led1 = Output::new(led1, Level::Low); | ||
| 20 | |||
| 21 | let mut s2 = Input::new(s2, Pull::Up); | ||
| 22 | |||
| 23 | // led1 is active low | ||
| 24 | led1.set_high(); | ||
| 25 | |||
| 26 | loop { | ||
| 27 | s2.wait_for_falling_edge().await; | ||
| 28 | |||
| 29 | info!("Switch 2 was pressed"); | ||
| 30 | |||
| 31 | led1.toggle(); | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/examples/mspm0l2228/.cargo/config.toml b/examples/mspm0l2228/.cargo/config.toml new file mode 100644 index 000000000..f383afd9e --- /dev/null +++ b/examples/mspm0l2228/.cargo/config.toml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
| 2 | # replace MSPM0L2228 with your chip as listed in `probe-rs chip list` | ||
| 3 | runner = "probe-rs run --restore-unwritten --verify --chip MSPM0L2228 --protocol=swd" | ||
| 4 | |||
| 5 | [build] | ||
| 6 | target = "thumbv6m-none-eabi" | ||
| 7 | |||
| 8 | [env] | ||
| 9 | DEFMT_LOG = "trace" | ||
diff --git a/examples/mspm0l2228/Cargo.toml b/examples/mspm0l2228/Cargo.toml new file mode 100644 index 000000000..abebcc00d --- /dev/null +++ b/examples/mspm0l2228/Cargo.toml | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | [package] | ||
| 2 | edition = "2021" | ||
| 3 | name = "embassy-mspm0-l2228-examples" | ||
| 4 | version = "0.1.0" | ||
| 5 | license = "MIT OR Apache-2.0" | ||
| 6 | |||
| 7 | [dependencies] | ||
| 8 | embassy-mspm0 = { version = "0.1.0", path = "../../embassy-mspm0", features = ["mspm0l222x", "rt", "time-driver-any"] } | ||
| 9 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } | ||
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | ||
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } | ||
| 12 | panic-halt = "0.2.0" | ||
| 13 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | ||
| 14 | cortex-m-rt = { version = "0.7.0"} | ||
| 15 | defmt = "0.3" | ||
| 16 | defmt-rtt = "0.4" | ||
| 17 | panic-probe = { version = "0.3.2", features = ["print-defmt"] } | ||
| 18 | panic-semihosting = "0.6.0" | ||
| 19 | |||
| 20 | [profile.release] | ||
| 21 | debug = 2 | ||
diff --git a/examples/mspm0l2228/README.md b/examples/mspm0l2228/README.md new file mode 100644 index 000000000..c73fa13b6 --- /dev/null +++ b/examples/mspm0l2228/README.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # Examples for MSPM0L222x family | ||
| 2 | |||
| 3 | Run individual examples with | ||
| 4 | ``` | ||
| 5 | cargo run --bin <module-name> | ||
| 6 | ``` | ||
| 7 | for example | ||
| 8 | ``` | ||
| 9 | cargo run --bin blinky | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## Checklist before running examples | ||
| 13 | A large number of the examples are written for the [LP-MSPM0L2228](https://www.ti.com/tool/LP-MSPM0L2228) board. | ||
| 14 | |||
| 15 | You might need to adjust `.cargo/config.toml`, `Cargo.toml` and possibly update pin numbers or peripherals to match the specific MCU or board you are using. | ||
| 16 | |||
| 17 | * [ ] Update .cargo/config.toml with the correct probe-rs command to use your specific MCU. For example for L2228 it should be `probe-rs run --chip MSPM0L2228`. (use `probe-rs chip list` to find your chip) | ||
| 18 | * [ ] Update Cargo.toml to have the correct `embassy-mspm0` feature. For example for L2228 it should be `mspm0l2228`. Look in the `Cargo.toml` file of the `embassy-mspm0` project to find the correct feature flag for your chip. | ||
| 19 | * [ ] If your board has a special clock or power configuration, make sure that it is set up appropriately. | ||
| 20 | * [ ] If your board has different pin mapping, update any pin numbers or peripherals in the given example code to match your schematic | ||
| 21 | |||
| 22 | If you are unsure, please drop by the Embassy Matrix chat for support, and let us know: | ||
| 23 | |||
| 24 | * Which example you are trying to run | ||
| 25 | * Which chip and board you are using | ||
| 26 | |||
| 27 | Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org | ||
diff --git a/examples/mspm0l2228/build.rs b/examples/mspm0l2228/build.rs new file mode 100644 index 000000000..30691aa97 --- /dev/null +++ b/examples/mspm0l2228/build.rs | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | //! This build script copies the `memory.x` file from the crate root into | ||
| 2 | //! a directory where the linker can always find it at build time. | ||
| 3 | //! For many projects this is optional, as the linker always searches the | ||
| 4 | //! project root directory -- wherever `Cargo.toml` is. However, if you | ||
| 5 | //! are using a workspace or have a more complicated build setup, this | ||
| 6 | //! build script becomes required. Additionally, by requesting that | ||
| 7 | //! Cargo re-run the build script whenever `memory.x` is changed, | ||
| 8 | //! updating `memory.x` ensures a rebuild of the application with the | ||
| 9 | //! new memory settings. | ||
| 10 | |||
| 11 | use std::env; | ||
| 12 | use std::fs::File; | ||
| 13 | use std::io::Write; | ||
| 14 | use std::path::PathBuf; | ||
| 15 | |||
| 16 | fn main() { | ||
| 17 | // Put `memory.x` in our output directory and ensure it's | ||
| 18 | // on the linker search path. | ||
| 19 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
| 20 | File::create(out.join("memory.x")) | ||
| 21 | .unwrap() | ||
| 22 | .write_all(include_bytes!("memory.x")) | ||
| 23 | .unwrap(); | ||
| 24 | println!("cargo:rustc-link-search={}", out.display()); | ||
| 25 | |||
| 26 | // By default, Cargo will re-run a build script whenever | ||
| 27 | // any file in the project changes. By specifying `memory.x` | ||
| 28 | // here, we ensure the build script is only re-run when | ||
| 29 | // `memory.x` is changed. | ||
| 30 | println!("cargo:rerun-if-changed=memory.x"); | ||
| 31 | |||
| 32 | println!("cargo:rustc-link-arg-bins=--nmagic"); | ||
| 33 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 34 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||
| 35 | } | ||
diff --git a/examples/mspm0l2228/memory.x b/examples/mspm0l2228/memory.x new file mode 100644 index 000000000..aba414a88 --- /dev/null +++ b/examples/mspm0l2228/memory.x | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | FLASH : ORIGIN = 0x00000000, LENGTH = 256K | ||
| 4 | /* Select non-parity range of SRAM due to SRAM_ERR_01 errata in SLAZ758 */ | ||
| 5 | RAM : ORIGIN = 0x20200000, LENGTH = 32K | ||
| 6 | } | ||
diff --git a/examples/mspm0l2228/src/bin/blinky.rs b/examples/mspm0l2228/src/bin/blinky.rs new file mode 100644 index 000000000..055a5cd81 --- /dev/null +++ b/examples/mspm0l2228/src/bin/blinky.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Level, Output}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use embassy_time::Timer; | ||
| 9 | use {defmt_rtt as _, panic_halt as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) -> ! { | ||
| 13 | info!("Hello world!"); | ||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let mut led1 = Output::new(p.PA0, Level::Low); | ||
| 17 | led1.set_inversion(true); | ||
| 18 | |||
| 19 | loop { | ||
| 20 | Timer::after_millis(400).await; | ||
| 21 | |||
| 22 | info!("Toggle"); | ||
| 23 | led1.toggle(); | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/examples/mspm0l2228/src/bin/button.rs b/examples/mspm0l2228/src/bin/button.rs new file mode 100644 index 000000000..47bfd274b --- /dev/null +++ b/examples/mspm0l2228/src/bin/button.rs | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_mspm0::gpio::{Input, Level, Output, Pull}; | ||
| 7 | use embassy_mspm0::Config; | ||
| 8 | use {defmt_rtt as _, panic_halt as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) -> ! { | ||
| 12 | info!("Hello world!"); | ||
| 13 | |||
| 14 | let p = embassy_mspm0::init(Config::default()); | ||
| 15 | |||
| 16 | let led1 = p.PA0; | ||
| 17 | let s2 = p.PB8; | ||
| 18 | |||
| 19 | let mut led1 = Output::new(led1, Level::Low); | ||
| 20 | |||
| 21 | let mut s2 = Input::new(s2, Pull::Up); | ||
| 22 | |||
| 23 | // led1 is active low | ||
| 24 | led1.set_high(); | ||
| 25 | |||
| 26 | loop { | ||
| 27 | s2.wait_for_falling_edge().await; | ||
| 28 | |||
| 29 | info!("Switch 2 was pressed"); | ||
| 30 | |||
| 31 | led1.toggle(); | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/examples/nrf51/Cargo.toml b/examples/nrf51/Cargo.toml index b6760a428..97b5b924a 100644 --- a/examples/nrf51/Cargo.toml +++ b/examples/nrf51/Cargo.toml | |||
| @@ -5,7 +5,7 @@ version = "0.1.0" | |||
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-4096", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 8 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 9 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 9 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 10 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf51", "gpiote", "time-driver-rtc1", "unstable-pac", "time", "rt"] } | 10 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf51", "gpiote", "time-driver-rtc1", "unstable-pac", "time", "rt"] } |
| 11 | 11 | ||
diff --git a/examples/nrf52810/Cargo.toml b/examples/nrf52810/Cargo.toml index 297a52537..cd59b86c3 100644 --- a/examples/nrf52810/Cargo.toml +++ b/examples/nrf52810/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 8 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 12 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf52810", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 12 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf52810", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 13 | 13 | ||
diff --git a/examples/nrf52840-rtic/src/bin/blinky.rs b/examples/nrf52840-rtic/src/bin/blinky.rs index 5a074ea17..719e22729 100644 --- a/examples/nrf52840-rtic/src/bin/blinky.rs +++ b/examples/nrf52840-rtic/src/bin/blinky.rs | |||
| @@ -8,7 +8,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 8 | mod app { | 8 | mod app { |
| 9 | use defmt::info; | 9 | use defmt::info; |
| 10 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 10 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 11 | use embassy_nrf::peripherals; | 11 | use embassy_nrf::{peripherals, Peri}; |
| 12 | use embassy_time::Timer; | 12 | use embassy_time::Timer; |
| 13 | 13 | ||
| 14 | #[shared] | 14 | #[shared] |
| @@ -28,7 +28,7 @@ mod app { | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | #[task(priority = 1)] | 30 | #[task(priority = 1)] |
| 31 | async fn blink(_cx: blink::Context, pin: peripherals::P0_13) { | 31 | async fn blink(_cx: blink::Context, pin: Peri<'static, peripherals::P0_13>) { |
| 32 | let mut led = Output::new(pin, Level::Low, OutputDrive::Standard); | 32 | let mut led = Output::new(pin, Level::Low, OutputDrive::Standard); |
| 33 | 33 | ||
| 34 | loop { | 34 | loop { |
diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml index f479d6af6..902193f3a 100644 --- a/examples/nrf52840/Cargo.toml +++ b/examples/nrf52840/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 8 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 12 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 12 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } | 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } |
diff --git a/examples/nrf52840/src/bin/channel_sender_receiver.rs b/examples/nrf52840/src/bin/channel_sender_receiver.rs index 29f70f91c..74c62ca20 100644 --- a/examples/nrf52840/src/bin/channel_sender_receiver.rs +++ b/examples/nrf52840/src/bin/channel_sender_receiver.rs | |||
| @@ -3,7 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::unwrap; | 4 | use defmt::unwrap; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; | 6 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive}; |
| 7 | use embassy_nrf::Peri; | ||
| 7 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; | 8 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 8 | use embassy_sync::channel::{Channel, Receiver, Sender}; | 9 | use embassy_sync::channel::{Channel, Receiver, Sender}; |
| 9 | use embassy_time::Timer; | 10 | use embassy_time::Timer; |
| @@ -28,7 +29,7 @@ async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) { | |||
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | #[embassy_executor::task] | 31 | #[embassy_executor::task] |
| 31 | async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedState, 1>) { | 32 | async fn recv_task(led: Peri<'static, AnyPin>, receiver: Receiver<'static, NoopRawMutex, LedState, 1>) { |
| 32 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); | 33 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); |
| 33 | 34 | ||
| 34 | loop { | 35 | loop { |
| @@ -45,5 +46,5 @@ async fn main(spawner: Spawner) { | |||
| 45 | let channel = CHANNEL.init(Channel::new()); | 46 | let channel = CHANNEL.init(Channel::new()); |
| 46 | 47 | ||
| 47 | unwrap!(spawner.spawn(send_task(channel.sender()))); | 48 | unwrap!(spawner.spawn(send_task(channel.sender()))); |
| 48 | unwrap!(spawner.spawn(recv_task(p.P0_13.degrade(), channel.receiver()))); | 49 | unwrap!(spawner.spawn(recv_task(p.P0_13.into(), channel.receiver()))); |
| 49 | } | 50 | } |
diff --git a/examples/nrf52840/src/bin/pdm_continuous.rs b/examples/nrf52840/src/bin/pdm_continuous.rs index e948203a5..0d76636b0 100644 --- a/examples/nrf52840/src/bin/pdm_continuous.rs +++ b/examples/nrf52840/src/bin/pdm_continuous.rs | |||
| @@ -20,14 +20,14 @@ bind_interrupts!(struct Irqs { | |||
| 20 | 20 | ||
| 21 | #[embassy_executor::main] | 21 | #[embassy_executor::main] |
| 22 | async fn main(_p: Spawner) { | 22 | async fn main(_p: Spawner) { |
| 23 | let mut p = embassy_nrf::init(Default::default()); | 23 | let p = embassy_nrf::init(Default::default()); |
| 24 | let mut config = Config::default(); | 24 | let mut config = Config::default(); |
| 25 | // Pins are correct for the onboard microphone on the Feather nRF52840 Sense. | 25 | // Pins are correct for the onboard microphone on the Feather nRF52840 Sense. |
| 26 | config.frequency = Frequency::_1280K; // 16 kHz sample rate | 26 | config.frequency = Frequency::_1280K; // 16 kHz sample rate |
| 27 | config.ratio = Ratio::RATIO80; | 27 | config.ratio = Ratio::RATIO80; |
| 28 | config.operation_mode = OperationMode::Mono; | 28 | config.operation_mode = OperationMode::Mono; |
| 29 | config.gain_left = I7F1::from_bits(5); // 2.5 dB | 29 | config.gain_left = I7F1::from_bits(5); // 2.5 dB |
| 30 | let mut pdm = Pdm::new(p.PDM, Irqs, &mut p.P0_00, &mut p.P0_01, config); | 30 | let mut pdm = Pdm::new(p.PDM, Irqs, p.P0_00, p.P0_01, config); |
| 31 | 31 | ||
| 32 | let mut bufs = [[0; 1024]; 2]; | 32 | let mut bufs = [[0; 1024]; 2]; |
| 33 | 33 | ||
diff --git a/examples/nrf52840/src/bin/qspi_lowpower.rs b/examples/nrf52840/src/bin/qspi_lowpower.rs index 516c9b481..238a0d941 100644 --- a/examples/nrf52840/src/bin/qspi_lowpower.rs +++ b/examples/nrf52840/src/bin/qspi_lowpower.rs | |||
| @@ -37,14 +37,14 @@ async fn main(_p: Spawner) { | |||
| 37 | }); | 37 | }); |
| 38 | 38 | ||
| 39 | let mut q = qspi::Qspi::new( | 39 | let mut q = qspi::Qspi::new( |
| 40 | &mut p.QSPI, | 40 | p.QSPI.reborrow(), |
| 41 | Irqs, | 41 | Irqs, |
| 42 | &mut p.P0_19, | 42 | p.P0_19.reborrow(), |
| 43 | &mut p.P0_17, | 43 | p.P0_17.reborrow(), |
| 44 | &mut p.P0_20, | 44 | p.P0_20.reborrow(), |
| 45 | &mut p.P0_21, | 45 | p.P0_21.reborrow(), |
| 46 | &mut p.P0_22, | 46 | p.P0_22.reborrow(), |
| 47 | &mut p.P0_23, | 47 | p.P0_23.reborrow(), |
| 48 | config, | 48 | config, |
| 49 | ); | 49 | ); |
| 50 | 50 | ||
diff --git a/examples/nrf52840/src/bin/saadc.rs b/examples/nrf52840/src/bin/saadc.rs index 653b7d606..cf2d860ab 100644 --- a/examples/nrf52840/src/bin/saadc.rs +++ b/examples/nrf52840/src/bin/saadc.rs | |||
| @@ -16,7 +16,7 @@ bind_interrupts!(struct Irqs { | |||
| 16 | async fn main(_p: Spawner) { | 16 | async fn main(_p: Spawner) { |
| 17 | let mut p = embassy_nrf::init(Default::default()); | 17 | let mut p = embassy_nrf::init(Default::default()); |
| 18 | let config = Config::default(); | 18 | let config = Config::default(); |
| 19 | let channel_config = ChannelConfig::single_ended(&mut p.P0_02); | 19 | let channel_config = ChannelConfig::single_ended(p.P0_02.reborrow()); |
| 20 | let mut saadc = Saadc::new(p.SAADC, Irqs, config, [channel_config]); | 20 | let mut saadc = Saadc::new(p.SAADC, Irqs, config, [channel_config]); |
| 21 | 21 | ||
| 22 | loop { | 22 | loop { |
diff --git a/examples/nrf52840/src/bin/saadc_continuous.rs b/examples/nrf52840/src/bin/saadc_continuous.rs index f76fa3570..e8f169c8c 100644 --- a/examples/nrf52840/src/bin/saadc_continuous.rs +++ b/examples/nrf52840/src/bin/saadc_continuous.rs | |||
| @@ -18,9 +18,9 @@ bind_interrupts!(struct Irqs { | |||
| 18 | async fn main(_p: Spawner) { | 18 | async fn main(_p: Spawner) { |
| 19 | let mut p = embassy_nrf::init(Default::default()); | 19 | let mut p = embassy_nrf::init(Default::default()); |
| 20 | let config = Config::default(); | 20 | let config = Config::default(); |
| 21 | let channel_1_config = ChannelConfig::single_ended(&mut p.P0_02); | 21 | let channel_1_config = ChannelConfig::single_ended(p.P0_02.reborrow()); |
| 22 | let channel_2_config = ChannelConfig::single_ended(&mut p.P0_03); | 22 | let channel_2_config = ChannelConfig::single_ended(p.P0_03.reborrow()); |
| 23 | let channel_3_config = ChannelConfig::single_ended(&mut p.P0_04); | 23 | let channel_3_config = ChannelConfig::single_ended(p.P0_04.reborrow()); |
| 24 | let mut saadc = Saadc::new( | 24 | let mut saadc = Saadc::new( |
| 25 | p.SAADC, | 25 | p.SAADC, |
| 26 | Irqs, | 26 | Irqs, |
| @@ -40,9 +40,9 @@ async fn main(_p: Spawner) { | |||
| 40 | 40 | ||
| 41 | saadc | 41 | saadc |
| 42 | .run_task_sampler( | 42 | .run_task_sampler( |
| 43 | &mut p.TIMER0, | 43 | p.TIMER0.reborrow(), |
| 44 | &mut p.PPI_CH0, | 44 | p.PPI_CH0.reborrow(), |
| 45 | &mut p.PPI_CH1, | 45 | p.PPI_CH1.reborrow(), |
| 46 | Frequency::F1MHz, | 46 | Frequency::F1MHz, |
| 47 | 1000, // We want to sample at 1KHz | 47 | 1000, // We want to sample at 1KHz |
| 48 | &mut bufs, | 48 | &mut bufs, |
diff --git a/examples/nrf52840/src/bin/twim_lowpower.rs b/examples/nrf52840/src/bin/twim_lowpower.rs index e2efbdd8d..8a6f958eb 100644 --- a/examples/nrf52840/src/bin/twim_lowpower.rs +++ b/examples/nrf52840/src/bin/twim_lowpower.rs | |||
| @@ -32,7 +32,13 @@ async fn main(_p: Spawner) { | |||
| 32 | let config = twim::Config::default(); | 32 | let config = twim::Config::default(); |
| 33 | 33 | ||
| 34 | // Create the TWIM instance with borrowed singletons, so they're not consumed. | 34 | // Create the TWIM instance with borrowed singletons, so they're not consumed. |
| 35 | let mut twi = Twim::new(&mut p.TWISPI0, Irqs, &mut p.P0_03, &mut p.P0_04, config); | 35 | let mut twi = Twim::new( |
| 36 | p.TWISPI0.reborrow(), | ||
| 37 | Irqs, | ||
| 38 | p.P0_03.reborrow(), | ||
| 39 | p.P0_04.reborrow(), | ||
| 40 | config, | ||
| 41 | ); | ||
| 36 | 42 | ||
| 37 | info!("Reading..."); | 43 | info!("Reading..."); |
| 38 | 44 | ||
diff --git a/examples/nrf5340/Cargo.toml b/examples/nrf5340/Cargo.toml index 2a83633b4..459c43221 100644 --- a/examples/nrf5340/Cargo.toml +++ b/examples/nrf5340/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 8 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 12 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf5340-app-s", "time-driver-rtc1", "gpiote", "unstable-pac"] } | 12 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf5340-app-s", "time-driver-rtc1", "gpiote", "unstable-pac"] } |
| 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } | 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } |
diff --git a/examples/nrf54l15/Cargo.toml b/examples/nrf54l15/Cargo.toml index 12808fc2a..8848065d8 100644 --- a/examples/nrf54l15/Cargo.toml +++ b/examples/nrf54l15/Cargo.toml | |||
| @@ -5,7 +5,7 @@ version = "0.1.0" | |||
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 8 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 9 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 9 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 10 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf54l15-app-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 10 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf54l15-app-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 11 | 11 | ||
diff --git a/examples/nrf9151/ns/Cargo.toml b/examples/nrf9151/ns/Cargo.toml index 27def8455..03f38fd63 100644 --- a/examples/nrf9151/ns/Cargo.toml +++ b/examples/nrf9151/ns/Cargo.toml | |||
| @@ -5,7 +5,7 @@ version = "0.1.0" | |||
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.7.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 8 | embassy-executor = { version = "0.7.0", path = "../../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 9 | embassy-time = { version = "0.4.0", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 9 | embassy-time = { version = "0.4.0", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 10 | embassy-nrf = { version = "0.3.1", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-ns", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 10 | embassy-nrf = { version = "0.3.1", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-ns", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 11 | 11 | ||
diff --git a/examples/nrf9151/s/Cargo.toml b/examples/nrf9151/s/Cargo.toml index e57f199c6..ba88f6da3 100644 --- a/examples/nrf9151/s/Cargo.toml +++ b/examples/nrf9151/s/Cargo.toml | |||
| @@ -5,7 +5,7 @@ version = "0.1.0" | |||
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.7.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 8 | embassy-executor = { version = "0.7.0", path = "../../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 9 | embassy-time = { version = "0.4.0", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 9 | embassy-time = { version = "0.4.0", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 10 | embassy-nrf = { version = "0.3.1", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 10 | embassy-nrf = { version = "0.3.1", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 11 | 11 | ||
diff --git a/examples/nrf9160/Cargo.toml b/examples/nrf9160/Cargo.toml index 6965ce202..a720f2d61 100644 --- a/examples/nrf9160/Cargo.toml +++ b/examples/nrf9160/Cargo.toml | |||
| @@ -5,7 +5,7 @@ version = "0.1.0" | |||
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 8 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 9 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 9 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 10 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf9160-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 10 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "nrf9160-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 11 | embassy-net-nrf91 = { version = "0.1.0", path = "../../embassy-net-nrf91", features = ["defmt"] } | 11 | embassy-net-nrf91 = { version = "0.1.0", path = "../../embassy-net-nrf91", features = ["defmt"] } |
diff --git a/examples/nrf9160/src/bin/modem_tcp_client.rs b/examples/nrf9160/src/bin/modem_tcp_client.rs index 35900cdd8..2ba964b1f 100644 --- a/examples/nrf9160/src/bin/modem_tcp_client.rs +++ b/examples/nrf9160/src/bin/modem_tcp_client.rs | |||
| @@ -13,9 +13,9 @@ use embassy_net::{Ipv4Cidr, Stack, StackResources}; | |||
| 13 | use embassy_net_nrf91::context::Status; | 13 | use embassy_net_nrf91::context::Status; |
| 14 | use embassy_net_nrf91::{context, Runner, State, TraceBuffer, TraceReader}; | 14 | use embassy_net_nrf91::{context, Runner, State, TraceBuffer, TraceReader}; |
| 15 | use embassy_nrf::buffered_uarte::{self, BufferedUarteTx}; | 15 | use embassy_nrf::buffered_uarte::{self, BufferedUarteTx}; |
| 16 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; | 16 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive}; |
| 17 | use embassy_nrf::uarte::Baudrate; | 17 | use embassy_nrf::uarte::Baudrate; |
| 18 | use embassy_nrf::{bind_interrupts, interrupt, peripherals, uarte}; | 18 | use embassy_nrf::{bind_interrupts, interrupt, peripherals, uarte, Peri}; |
| 19 | use embassy_time::{Duration, Timer}; | 19 | use embassy_time::{Duration, Timer}; |
| 20 | use embedded_io_async::Write; | 20 | use embedded_io_async::Write; |
| 21 | use heapless::Vec; | 21 | use heapless::Vec; |
| @@ -91,7 +91,7 @@ fn status_to_config(status: &Status) -> embassy_net::ConfigV4 { | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | #[embassy_executor::task] | 93 | #[embassy_executor::task] |
| 94 | async fn blink_task(pin: AnyPin) { | 94 | async fn blink_task(pin: Peri<'static, AnyPin>) { |
| 95 | let mut led = Output::new(pin, Level::Low, OutputDrive::Standard); | 95 | let mut led = Output::new(pin, Level::Low, OutputDrive::Standard); |
| 96 | loop { | 96 | loop { |
| 97 | led.set_high(); | 97 | led.set_high(); |
| @@ -112,7 +112,7 @@ async fn main(spawner: Spawner) { | |||
| 112 | 112 | ||
| 113 | info!("Hello World!"); | 113 | info!("Hello World!"); |
| 114 | 114 | ||
| 115 | unwrap!(spawner.spawn(blink_task(p.P0_02.degrade()))); | 115 | unwrap!(spawner.spawn(blink_task(p.P0_02.into()))); |
| 116 | 116 | ||
| 117 | let ipc_mem = unsafe { | 117 | let ipc_mem = unsafe { |
| 118 | let ipc_start = &__start_ipc as *const u8 as *mut MaybeUninit<u8>; | 118 | let ipc_start = &__start_ipc as *const u8 as *mut MaybeUninit<u8>; |
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index cde804a15..45ca30e4c 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal", features = ["defmt"] } | 9 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal", features = ["defmt"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-98304", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 13 | embassy-rp = { version = "0.4.0", path = "../../embassy-rp", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl", "rp2040"] } | 13 | embassy-rp = { version = "0.4.0", path = "../../embassy-rp", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl", "rp2040"] } |
| 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
| @@ -30,7 +30,7 @@ serde = { version = "1.0.203", default-features = false, features = ["derive"] } | |||
| 30 | serde-json-core = "0.5.1" | 30 | serde-json-core = "0.5.1" |
| 31 | 31 | ||
| 32 | # for assign resources example | 32 | # for assign resources example |
| 33 | assign-resources = { git = "https://github.com/adamgreig/assign-resources", rev = "94ad10e2729afdf0fd5a77cd12e68409a982f58a" } | 33 | assign-resources = { git = "https://github.com/adamgreig/assign-resources", rev = "bd22cb7a92031fb16f74a5da42469d466c33383e" } |
| 34 | 34 | ||
| 35 | #cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | 35 | #cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } |
| 36 | cortex-m = { version = "0.7.6", features = ["inline-asm"] } | 36 | cortex-m = { version = "0.7.6", features = ["inline-asm"] } |
diff --git a/examples/rp/src/bin/adc_dma.rs b/examples/rp/src/bin/adc_dma.rs index f755cf5bf..b42c13fde 100644 --- a/examples/rp/src/bin/adc_dma.rs +++ b/examples/rp/src/bin/adc_dma.rs | |||
| @@ -38,13 +38,13 @@ async fn main(_spawner: Spawner) { | |||
| 38 | // Read 100 samples from a single channel | 38 | // Read 100 samples from a single channel |
| 39 | let mut buf = [0_u16; BLOCK_SIZE]; | 39 | let mut buf = [0_u16; BLOCK_SIZE]; |
| 40 | let div = 479; // 100kHz sample rate (48Mhz / 100kHz - 1) | 40 | let div = 479; // 100kHz sample rate (48Mhz / 100kHz - 1) |
| 41 | adc.read_many(&mut pin, &mut buf, div, &mut dma).await.unwrap(); | 41 | adc.read_many(&mut pin, &mut buf, div, dma.reborrow()).await.unwrap(); |
| 42 | info!("single: {:?} ...etc", buf[..8]); | 42 | info!("single: {:?} ...etc", buf[..8]); |
| 43 | 43 | ||
| 44 | // Read 100 samples from 4 channels interleaved | 44 | // Read 100 samples from 4 channels interleaved |
| 45 | let mut buf = [0_u16; { BLOCK_SIZE * NUM_CHANNELS }]; | 45 | let mut buf = [0_u16; { BLOCK_SIZE * NUM_CHANNELS }]; |
| 46 | let div = 119; // 100kHz sample rate (48Mhz / 100kHz * 4ch - 1) | 46 | let div = 119; // 100kHz sample rate (48Mhz / 100kHz * 4ch - 1) |
| 47 | adc.read_many_multichannel(&mut pins, &mut buf, div, &mut dma) | 47 | adc.read_many_multichannel(&mut pins, &mut buf, div, dma.reborrow()) |
| 48 | .await | 48 | .await |
| 49 | .unwrap(); | 49 | .unwrap(); |
| 50 | info!("multi: {:?} ...etc", buf[..NUM_CHANNELS * 2]); | 50 | info!("multi: {:?} ...etc", buf[..NUM_CHANNELS * 2]); |
diff --git a/examples/rp/src/bin/assign_resources.rs b/examples/rp/src/bin/assign_resources.rs index ff6eff4a2..341f54d22 100644 --- a/examples/rp/src/bin/assign_resources.rs +++ b/examples/rp/src/bin/assign_resources.rs | |||
| @@ -16,6 +16,7 @@ use defmt::*; | |||
| 16 | use embassy_executor::Spawner; | 16 | use embassy_executor::Spawner; |
| 17 | use embassy_rp::gpio::{Level, Output}; | 17 | use embassy_rp::gpio::{Level, Output}; |
| 18 | use embassy_rp::peripherals::{self, PIN_20, PIN_21}; | 18 | use embassy_rp::peripherals::{self, PIN_20, PIN_21}; |
| 19 | use embassy_rp::Peri; | ||
| 19 | use embassy_time::Timer; | 20 | use embassy_time::Timer; |
| 20 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| 21 | 22 | ||
| @@ -38,7 +39,11 @@ async fn main(spawner: Spawner) { | |||
| 38 | 39 | ||
| 39 | // 1) Assigning a resource to a task by passing parts of the peripherals. | 40 | // 1) Assigning a resource to a task by passing parts of the peripherals. |
| 40 | #[embassy_executor::task] | 41 | #[embassy_executor::task] |
| 41 | async fn double_blinky_manually_assigned(_spawner: Spawner, pin_20: PIN_20, pin_21: PIN_21) { | 42 | async fn double_blinky_manually_assigned( |
| 43 | _spawner: Spawner, | ||
| 44 | pin_20: Peri<'static, PIN_20>, | ||
| 45 | pin_21: Peri<'static, PIN_21>, | ||
| 46 | ) { | ||
| 42 | let mut led_20 = Output::new(pin_20, Level::Low); | 47 | let mut led_20 = Output::new(pin_20, Level::Low); |
| 43 | let mut led_21 = Output::new(pin_21, Level::High); | 48 | let mut led_21 = Output::new(pin_21, Level::High); |
| 44 | 49 | ||
diff --git a/examples/rp/src/bin/blinky_two_channels.rs b/examples/rp/src/bin/blinky_two_channels.rs index b2eec2a21..51e139e94 100644 --- a/examples/rp/src/bin/blinky_two_channels.rs +++ b/examples/rp/src/bin/blinky_two_channels.rs | |||
| @@ -11,7 +11,7 @@ use embassy_rp::gpio; | |||
| 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; | 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; |
| 12 | use embassy_sync::channel::{Channel, Sender}; | 12 | use embassy_sync::channel::{Channel, Sender}; |
| 13 | use embassy_time::{Duration, Ticker}; | 13 | use embassy_time::{Duration, Ticker}; |
| 14 | use gpio::{AnyPin, Level, Output}; | 14 | use gpio::{Level, Output}; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 16 | ||
| 17 | enum LedState { | 17 | enum LedState { |
| @@ -22,7 +22,7 @@ static CHANNEL: Channel<ThreadModeRawMutex, LedState, 64> = Channel::new(); | |||
| 22 | #[embassy_executor::main] | 22 | #[embassy_executor::main] |
| 23 | async fn main(spawner: Spawner) { | 23 | async fn main(spawner: Spawner) { |
| 24 | let p = embassy_rp::init(Default::default()); | 24 | let p = embassy_rp::init(Default::default()); |
| 25 | let mut led = Output::new(AnyPin::from(p.PIN_25), Level::High); | 25 | let mut led = Output::new(p.PIN_25, Level::High); |
| 26 | 26 | ||
| 27 | let dt = 100 * 1_000_000; | 27 | let dt = 100 * 1_000_000; |
| 28 | let k = 1.003; | 28 | let k = 1.003; |
diff --git a/examples/rp/src/bin/blinky_two_tasks.rs b/examples/rp/src/bin/blinky_two_tasks.rs index a57b513d6..67a9108c0 100644 --- a/examples/rp/src/bin/blinky_two_tasks.rs +++ b/examples/rp/src/bin/blinky_two_tasks.rs | |||
| @@ -11,7 +11,7 @@ use embassy_rp::gpio; | |||
| 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; | 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; |
| 12 | use embassy_sync::mutex::Mutex; | 12 | use embassy_sync::mutex::Mutex; |
| 13 | use embassy_time::{Duration, Ticker}; | 13 | use embassy_time::{Duration, Ticker}; |
| 14 | use gpio::{AnyPin, Level, Output}; | 14 | use gpio::{Level, Output}; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 16 | ||
| 17 | type LedType = Mutex<ThreadModeRawMutex, Option<Output<'static>>>; | 17 | type LedType = Mutex<ThreadModeRawMutex, Option<Output<'static>>>; |
| @@ -21,7 +21,7 @@ static LED: LedType = Mutex::new(None); | |||
| 21 | async fn main(spawner: Spawner) { | 21 | async fn main(spawner: Spawner) { |
| 22 | let p = embassy_rp::init(Default::default()); | 22 | let p = embassy_rp::init(Default::default()); |
| 23 | // set the content of the global LED reference to the real LED pin | 23 | // set the content of the global LED reference to the real LED pin |
| 24 | let led = Output::new(AnyPin::from(p.PIN_25), Level::High); | 24 | let led = Output::new(p.PIN_25, Level::High); |
| 25 | // inner scope is so that once the mutex is written to, the MutexGuard is dropped, thus the | 25 | // inner scope is so that once the mutex is written to, the MutexGuard is dropped, thus the |
| 26 | // Mutex is released | 26 | // Mutex is released |
| 27 | { | 27 | { |
diff --git a/examples/rp/src/bin/orchestrate_tasks.rs b/examples/rp/src/bin/orchestrate_tasks.rs index 7ff004860..5e2775793 100644 --- a/examples/rp/src/bin/orchestrate_tasks.rs +++ b/examples/rp/src/bin/orchestrate_tasks.rs | |||
| @@ -24,7 +24,7 @@ use embassy_futures::select::{select, Either}; | |||
| 24 | use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler}; | 24 | use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler}; |
| 25 | use embassy_rp::clocks::RoscRng; | 25 | use embassy_rp::clocks::RoscRng; |
| 26 | use embassy_rp::gpio::{Input, Pull}; | 26 | use embassy_rp::gpio::{Input, Pull}; |
| 27 | use embassy_rp::{bind_interrupts, peripherals}; | 27 | use embassy_rp::{bind_interrupts, peripherals, Peri}; |
| 28 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | 28 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; |
| 29 | use embassy_sync::mutex::Mutex; | 29 | use embassy_sync::mutex::Mutex; |
| 30 | use embassy_sync::{channel, signal}; | 30 | use embassy_sync::{channel, signal}; |
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index 08c702347..bf6dbee69 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -4,10 +4,10 @@ | |||
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | ||
| 8 | use embassy_rp::peripherals::PIO0; | 7 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | 8 | use embassy_rp::pio::program::pio_asm; |
| 10 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; | 9 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; |
| 10 | use embassy_rp::{bind_interrupts, Peri}; | ||
| 11 | use fixed::traits::ToFixed; | 11 | use fixed::traits::ToFixed; |
| 12 | use fixed_macro::types::U56F8; | 12 | use fixed_macro::types::U56F8; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -16,7 +16,7 @@ bind_interrupts!(struct Irqs { | |||
| 16 | PIO0_IRQ_0 => InterruptHandler<PIO0>; | 16 | PIO0_IRQ_0 => InterruptHandler<PIO0>; |
| 17 | }); | 17 | }); |
| 18 | 18 | ||
| 19 | fn setup_pio_task_sm0<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, PIO0, 0>, pin: impl PioPin) { | 19 | fn setup_pio_task_sm0<'d>(pio: &mut Common<'d, PIO0>, sm: &mut StateMachine<'d, PIO0, 0>, pin: Peri<'d, impl PioPin>) { |
| 20 | // Setup sm0 | 20 | // Setup sm0 |
| 21 | 21 | ||
| 22 | // Send data serially to pin | 22 | // Send data serially to pin |
| @@ -50,7 +50,7 @@ async fn pio_task_sm0(mut sm: StateMachine<'static, PIO0, 0>) { | |||
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | fn setup_pio_task_sm1<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, PIO0, 1>) { | 53 | fn setup_pio_task_sm1<'d>(pio: &mut Common<'d, PIO0>, sm: &mut StateMachine<'d, PIO0, 1>) { |
| 54 | // Setupm sm1 | 54 | // Setupm sm1 |
| 55 | 55 | ||
| 56 | // Read 0b10101 repeatedly until ISR is full | 56 | // Read 0b10101 repeatedly until ISR is full |
| @@ -80,7 +80,7 @@ async fn pio_task_sm1(mut sm: StateMachine<'static, PIO0, 1>) { | |||
| 80 | } | 80 | } |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | fn setup_pio_task_sm2<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, PIO0, 2>) { | 83 | fn setup_pio_task_sm2<'d>(pio: &mut Common<'d, PIO0>, sm: &mut StateMachine<'d, PIO0, 2>) { |
| 84 | // Setup sm2 | 84 | // Setup sm2 |
| 85 | 85 | ||
| 86 | // Repeatedly trigger IRQ 3 | 86 | // Repeatedly trigger IRQ 3 |
diff --git a/examples/rp/src/bin/pio_dma.rs b/examples/rp/src/bin/pio_dma.rs index da6e47a1b..64d603ba4 100644 --- a/examples/rp/src/bin/pio_dma.rs +++ b/examples/rp/src/bin/pio_dma.rs | |||
| @@ -5,10 +5,10 @@ | |||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_futures::join::join; | 7 | use embassy_futures::join::join; |
| 8 | use embassy_rp::bind_interrupts; | ||
| 8 | use embassy_rp::peripherals::PIO0; | 9 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | 10 | use embassy_rp::pio::program::pio_asm; |
| 10 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; | 11 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; |
| 11 | use embassy_rp::{bind_interrupts, Peripheral}; | ||
| 12 | use fixed::traits::ToFixed; | 12 | use fixed::traits::ToFixed; |
| 13 | use fixed_macro::types::U56F8; | 13 | use fixed_macro::types::U56F8; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -62,8 +62,8 @@ async fn main(_spawner: Spawner) { | |||
| 62 | sm.set_config(&cfg); | 62 | sm.set_config(&cfg); |
| 63 | sm.set_enable(true); | 63 | sm.set_enable(true); |
| 64 | 64 | ||
| 65 | let mut dma_out_ref = p.DMA_CH0.into_ref(); | 65 | let mut dma_out_ref = p.DMA_CH0; |
| 66 | let mut dma_in_ref = p.DMA_CH1.into_ref(); | 66 | let mut dma_in_ref = p.DMA_CH1; |
| 67 | let mut dout = [0x12345678u32; 29]; | 67 | let mut dout = [0x12345678u32; 29]; |
| 68 | for i in 1..dout.len() { | 68 | for i in 1..dout.len() { |
| 69 | dout[i] = (dout[i - 1] & 0x0fff_ffff) * 13 + 7; | 69 | dout[i] = (dout[i - 1] & 0x0fff_ffff) * 13 + 7; |
diff --git a/examples/rp/src/bin/pio_i2s.rs b/examples/rp/src/bin/pio_i2s.rs index 447100ddf..192c8f854 100644 --- a/examples/rp/src/bin/pio_i2s.rs +++ b/examples/rp/src/bin/pio_i2s.rs | |||
| @@ -14,6 +14,7 @@ use core::mem; | |||
| 14 | 14 | ||
| 15 | use embassy_executor::Spawner; | 15 | use embassy_executor::Spawner; |
| 16 | use embassy_rp::bind_interrupts; | 16 | use embassy_rp::bind_interrupts; |
| 17 | use embassy_rp::bootsel::is_bootsel_pressed; | ||
| 17 | use embassy_rp::peripherals::PIO0; | 18 | use embassy_rp::peripherals::PIO0; |
| 18 | use embassy_rp::pio::{InterruptHandler, Pio}; | 19 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 19 | use embassy_rp::pio_programs::i2s::{PioI2sOut, PioI2sOutProgram}; | 20 | use embassy_rp::pio_programs::i2s::{PioI2sOut, PioI2sOutProgram}; |
| @@ -70,7 +71,11 @@ async fn main(_spawner: Spawner) { | |||
| 70 | let dma_future = i2s.write(front_buffer); | 71 | let dma_future = i2s.write(front_buffer); |
| 71 | 72 | ||
| 72 | // fade in audio when bootsel is pressed | 73 | // fade in audio when bootsel is pressed |
| 73 | let fade_target = if p.BOOTSEL.is_pressed() { i32::MAX } else { 0 }; | 74 | let fade_target = if is_bootsel_pressed(p.BOOTSEL.reborrow()) { |
| 75 | i32::MAX | ||
| 76 | } else { | ||
| 77 | 0 | ||
| 78 | }; | ||
| 74 | 79 | ||
| 75 | // fill back buffer with fresh audio samples before awaiting the dma future | 80 | // fill back buffer with fresh audio samples before awaiting the dma future |
| 76 | for s in back_buffer.iter_mut() { | 81 | for s in back_buffer.iter_mut() { |
diff --git a/examples/rp/src/bin/pwm.rs b/examples/rp/src/bin/pwm.rs index 2f5f94870..04374323d 100644 --- a/examples/rp/src/bin/pwm.rs +++ b/examples/rp/src/bin/pwm.rs | |||
| @@ -11,6 +11,7 @@ use defmt::*; | |||
| 11 | use embassy_executor::Spawner; | 11 | use embassy_executor::Spawner; |
| 12 | use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4}; | 12 | use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4}; |
| 13 | use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; | 13 | use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; |
| 14 | use embassy_rp::Peri; | ||
| 14 | use embassy_time::Timer; | 15 | use embassy_time::Timer; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 17 | ||
| @@ -26,7 +27,7 @@ async fn main(spawner: Spawner) { | |||
| 26 | /// Using the onboard led, if You are using a different Board than plain Pico2 (i.e. W variant) | 27 | /// Using the onboard led, if You are using a different Board than plain Pico2 (i.e. W variant) |
| 27 | /// you must use another slice & pin and an appropriate resistor. | 28 | /// you must use another slice & pin and an appropriate resistor. |
| 28 | #[embassy_executor::task] | 29 | #[embassy_executor::task] |
| 29 | async fn pwm_set_config(slice4: PWM_SLICE4, pin25: PIN_25) { | 30 | async fn pwm_set_config(slice4: Peri<'static, PWM_SLICE4>, pin25: Peri<'static, PIN_25>) { |
| 30 | let mut c = Config::default(); | 31 | let mut c = Config::default(); |
| 31 | c.top = 32_768; | 32 | c.top = 32_768; |
| 32 | c.compare_b = 8; | 33 | c.compare_b = 8; |
| @@ -44,7 +45,7 @@ async fn pwm_set_config(slice4: PWM_SLICE4, pin25: PIN_25) { | |||
| 44 | /// | 45 | /// |
| 45 | /// Using GP4 in Slice2, make sure to use an appropriate resistor. | 46 | /// Using GP4 in Slice2, make sure to use an appropriate resistor. |
| 46 | #[embassy_executor::task] | 47 | #[embassy_executor::task] |
| 47 | async fn pwm_set_dutycycle(slice2: PWM_SLICE2, pin4: PIN_4) { | 48 | async fn pwm_set_dutycycle(slice2: Peri<'static, PWM_SLICE2>, pin4: Peri<'static, PIN_4>) { |
| 48 | // If we aim for a specific frequency, here is how we can calculate the top value. | 49 | // If we aim for a specific frequency, here is how we can calculate the top value. |
| 49 | // The top value sets the period of the PWM cycle, so a counter goes from 0 to top and then wraps around to 0. | 50 | // The top value sets the period of the PWM cycle, so a counter goes from 0 to top and then wraps around to 0. |
| 50 | // Every such wraparound is one PWM cycle. So here is how we get 25KHz: | 51 | // Every such wraparound is one PWM cycle. So here is how we get 25KHz: |
diff --git a/examples/rp/src/bin/shared_bus.rs b/examples/rp/src/bin/shared_bus.rs index c6cb5d64c..9267dfccb 100644 --- a/examples/rp/src/bin/shared_bus.rs +++ b/examples/rp/src/bin/shared_bus.rs | |||
| @@ -8,7 +8,7 @@ use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; | |||
| 8 | use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice; | 8 | use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_rp::bind_interrupts; | 10 | use embassy_rp::bind_interrupts; |
| 11 | use embassy_rp::gpio::{AnyPin, Level, Output}; | 11 | use embassy_rp::gpio::{Level, Output}; |
| 12 | use embassy_rp::i2c::{self, I2c, InterruptHandler}; | 12 | use embassy_rp::i2c::{self, I2c, InterruptHandler}; |
| 13 | use embassy_rp::peripherals::{I2C1, SPI1}; | 13 | use embassy_rp::peripherals::{I2C1, SPI1}; |
| 14 | use embassy_rp::spi::{self, Spi}; | 14 | use embassy_rp::spi::{self, Spi}; |
| @@ -45,8 +45,8 @@ async fn main(spawner: Spawner) { | |||
| 45 | let spi_bus = SPI_BUS.init(Mutex::new(spi)); | 45 | let spi_bus = SPI_BUS.init(Mutex::new(spi)); |
| 46 | 46 | ||
| 47 | // Chip select pins for the SPI devices | 47 | // Chip select pins for the SPI devices |
| 48 | let cs_a = Output::new(AnyPin::from(p.PIN_0), Level::High); | 48 | let cs_a = Output::new(p.PIN_0, Level::High); |
| 49 | let cs_b = Output::new(AnyPin::from(p.PIN_1), Level::High); | 49 | let cs_b = Output::new(p.PIN_1, Level::High); |
| 50 | 50 | ||
| 51 | spawner.must_spawn(spi_task_a(spi_bus, cs_a)); | 51 | spawner.must_spawn(spi_task_a(spi_bus, cs_a)); |
| 52 | spawner.must_spawn(spi_task_b(spi_bus, cs_b)); | 52 | spawner.must_spawn(spi_task_b(spi_bus, cs_b)); |
diff --git a/examples/rp/src/bin/zerocopy.rs b/examples/rp/src/bin/zerocopy.rs index 39f03c8e4..d1fb0eb00 100644 --- a/examples/rp/src/bin/zerocopy.rs +++ b/examples/rp/src/bin/zerocopy.rs | |||
| @@ -9,9 +9,9 @@ use core::sync::atomic::{AtomicU16, Ordering}; | |||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; | 11 | use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; |
| 12 | use embassy_rp::bind_interrupts; | ||
| 13 | use embassy_rp::gpio::Pull; | 12 | use embassy_rp::gpio::Pull; |
| 14 | use embassy_rp::peripherals::DMA_CH0; | 13 | use embassy_rp::peripherals::DMA_CH0; |
| 14 | use embassy_rp::{bind_interrupts, Peri}; | ||
| 15 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; | 15 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 16 | use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; | 16 | use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; |
| 17 | use embassy_time::{Duration, Ticker, Timer}; | 17 | use embassy_time::{Duration, Ticker, Timer}; |
| @@ -31,7 +31,7 @@ static MAX: AtomicU16 = AtomicU16::new(0); | |||
| 31 | struct AdcParts { | 31 | struct AdcParts { |
| 32 | adc: Adc<'static, Async>, | 32 | adc: Adc<'static, Async>, |
| 33 | pin: adc::Channel<'static>, | 33 | pin: adc::Channel<'static>, |
| 34 | dma: DMA_CH0, | 34 | dma: Peri<'static, DMA_CH0>, |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | #[embassy_executor::main] | 37 | #[embassy_executor::main] |
| @@ -70,7 +70,10 @@ async fn producer(mut sender: Sender<'static, NoopRawMutex, SampleBuffer>, mut a | |||
| 70 | let buf = sender.send().await; | 70 | let buf = sender.send().await; |
| 71 | 71 | ||
| 72 | // Fill it with data | 72 | // Fill it with data |
| 73 | adc.adc.read_many(&mut adc.pin, buf, 1, &mut adc.dma).await.unwrap(); | 73 | adc.adc |
| 74 | .read_many(&mut adc.pin, buf, 1, adc.dma.reborrow()) | ||
| 75 | .await | ||
| 76 | .unwrap(); | ||
| 74 | 77 | ||
| 75 | // Notify the channel that the buffer is now ready to be received | 78 | // Notify the channel that the buffer is now ready to be received |
| 76 | sender.send_done(); | 79 | sender.send_done(); |
diff --git a/examples/rp235x/Cargo.toml b/examples/rp235x/Cargo.toml index 4e9c93e7c..345a915af 100644 --- a/examples/rp235x/Cargo.toml +++ b/examples/rp235x/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal", features = ["defmt"] } | 9 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal", features = ["defmt"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-98304", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 13 | embassy-rp = { version = "0.4.0", path = "../../embassy-rp", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl", "rp235xa", "binary-info"] } | 13 | embassy-rp = { version = "0.4.0", path = "../../embassy-rp", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl", "rp235xa", "binary-info"] } |
| 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
| @@ -28,7 +28,7 @@ serde = { version = "1.0.203", default-features = false, features = ["derive"] } | |||
| 28 | serde-json-core = "0.5.1" | 28 | serde-json-core = "0.5.1" |
| 29 | 29 | ||
| 30 | # for assign resources example | 30 | # for assign resources example |
| 31 | assign-resources = { git = "https://github.com/adamgreig/assign-resources", rev = "94ad10e2729afdf0fd5a77cd12e68409a982f58a" } | 31 | assign-resources = { git = "https://github.com/adamgreig/assign-resources", rev = "bd22cb7a92031fb16f74a5da42469d466c33383e" } |
| 32 | 32 | ||
| 33 | # for TB6612FNG example | 33 | # for TB6612FNG example |
| 34 | tb6612fng = "1.0.0" | 34 | tb6612fng = "1.0.0" |
diff --git a/examples/rp235x/src/bin/adc_dma.rs b/examples/rp235x/src/bin/adc_dma.rs index f755cf5bf..b42c13fde 100644 --- a/examples/rp235x/src/bin/adc_dma.rs +++ b/examples/rp235x/src/bin/adc_dma.rs | |||
| @@ -38,13 +38,13 @@ async fn main(_spawner: Spawner) { | |||
| 38 | // Read 100 samples from a single channel | 38 | // Read 100 samples from a single channel |
| 39 | let mut buf = [0_u16; BLOCK_SIZE]; | 39 | let mut buf = [0_u16; BLOCK_SIZE]; |
| 40 | let div = 479; // 100kHz sample rate (48Mhz / 100kHz - 1) | 40 | let div = 479; // 100kHz sample rate (48Mhz / 100kHz - 1) |
| 41 | adc.read_many(&mut pin, &mut buf, div, &mut dma).await.unwrap(); | 41 | adc.read_many(&mut pin, &mut buf, div, dma.reborrow()).await.unwrap(); |
| 42 | info!("single: {:?} ...etc", buf[..8]); | 42 | info!("single: {:?} ...etc", buf[..8]); |
| 43 | 43 | ||
| 44 | // Read 100 samples from 4 channels interleaved | 44 | // Read 100 samples from 4 channels interleaved |
| 45 | let mut buf = [0_u16; { BLOCK_SIZE * NUM_CHANNELS }]; | 45 | let mut buf = [0_u16; { BLOCK_SIZE * NUM_CHANNELS }]; |
| 46 | let div = 119; // 100kHz sample rate (48Mhz / 100kHz * 4ch - 1) | 46 | let div = 119; // 100kHz sample rate (48Mhz / 100kHz * 4ch - 1) |
| 47 | adc.read_many_multichannel(&mut pins, &mut buf, div, &mut dma) | 47 | adc.read_many_multichannel(&mut pins, &mut buf, div, dma.reborrow()) |
| 48 | .await | 48 | .await |
| 49 | .unwrap(); | 49 | .unwrap(); |
| 50 | info!("multi: {:?} ...etc", buf[..NUM_CHANNELS * 2]); | 50 | info!("multi: {:?} ...etc", buf[..NUM_CHANNELS * 2]); |
diff --git a/examples/rp235x/src/bin/assign_resources.rs b/examples/rp235x/src/bin/assign_resources.rs index ff6eff4a2..341f54d22 100644 --- a/examples/rp235x/src/bin/assign_resources.rs +++ b/examples/rp235x/src/bin/assign_resources.rs | |||
| @@ -16,6 +16,7 @@ use defmt::*; | |||
| 16 | use embassy_executor::Spawner; | 16 | use embassy_executor::Spawner; |
| 17 | use embassy_rp::gpio::{Level, Output}; | 17 | use embassy_rp::gpio::{Level, Output}; |
| 18 | use embassy_rp::peripherals::{self, PIN_20, PIN_21}; | 18 | use embassy_rp::peripherals::{self, PIN_20, PIN_21}; |
| 19 | use embassy_rp::Peri; | ||
| 19 | use embassy_time::Timer; | 20 | use embassy_time::Timer; |
| 20 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| 21 | 22 | ||
| @@ -38,7 +39,11 @@ async fn main(spawner: Spawner) { | |||
| 38 | 39 | ||
| 39 | // 1) Assigning a resource to a task by passing parts of the peripherals. | 40 | // 1) Assigning a resource to a task by passing parts of the peripherals. |
| 40 | #[embassy_executor::task] | 41 | #[embassy_executor::task] |
| 41 | async fn double_blinky_manually_assigned(_spawner: Spawner, pin_20: PIN_20, pin_21: PIN_21) { | 42 | async fn double_blinky_manually_assigned( |
| 43 | _spawner: Spawner, | ||
| 44 | pin_20: Peri<'static, PIN_20>, | ||
| 45 | pin_21: Peri<'static, PIN_21>, | ||
| 46 | ) { | ||
| 42 | let mut led_20 = Output::new(pin_20, Level::Low); | 47 | let mut led_20 = Output::new(pin_20, Level::Low); |
| 43 | let mut led_21 = Output::new(pin_21, Level::High); | 48 | let mut led_21 = Output::new(pin_21, Level::High); |
| 44 | 49 | ||
diff --git a/examples/rp235x/src/bin/blinky_two_channels.rs b/examples/rp235x/src/bin/blinky_two_channels.rs index b2eec2a21..51e139e94 100644 --- a/examples/rp235x/src/bin/blinky_two_channels.rs +++ b/examples/rp235x/src/bin/blinky_two_channels.rs | |||
| @@ -11,7 +11,7 @@ use embassy_rp::gpio; | |||
| 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; | 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; |
| 12 | use embassy_sync::channel::{Channel, Sender}; | 12 | use embassy_sync::channel::{Channel, Sender}; |
| 13 | use embassy_time::{Duration, Ticker}; | 13 | use embassy_time::{Duration, Ticker}; |
| 14 | use gpio::{AnyPin, Level, Output}; | 14 | use gpio::{Level, Output}; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 16 | ||
| 17 | enum LedState { | 17 | enum LedState { |
| @@ -22,7 +22,7 @@ static CHANNEL: Channel<ThreadModeRawMutex, LedState, 64> = Channel::new(); | |||
| 22 | #[embassy_executor::main] | 22 | #[embassy_executor::main] |
| 23 | async fn main(spawner: Spawner) { | 23 | async fn main(spawner: Spawner) { |
| 24 | let p = embassy_rp::init(Default::default()); | 24 | let p = embassy_rp::init(Default::default()); |
| 25 | let mut led = Output::new(AnyPin::from(p.PIN_25), Level::High); | 25 | let mut led = Output::new(p.PIN_25, Level::High); |
| 26 | 26 | ||
| 27 | let dt = 100 * 1_000_000; | 27 | let dt = 100 * 1_000_000; |
| 28 | let k = 1.003; | 28 | let k = 1.003; |
diff --git a/examples/rp235x/src/bin/blinky_two_tasks.rs b/examples/rp235x/src/bin/blinky_two_tasks.rs index a57b513d6..67a9108c0 100644 --- a/examples/rp235x/src/bin/blinky_two_tasks.rs +++ b/examples/rp235x/src/bin/blinky_two_tasks.rs | |||
| @@ -11,7 +11,7 @@ use embassy_rp::gpio; | |||
| 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; | 11 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; |
| 12 | use embassy_sync::mutex::Mutex; | 12 | use embassy_sync::mutex::Mutex; |
| 13 | use embassy_time::{Duration, Ticker}; | 13 | use embassy_time::{Duration, Ticker}; |
| 14 | use gpio::{AnyPin, Level, Output}; | 14 | use gpio::{Level, Output}; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 16 | ||
| 17 | type LedType = Mutex<ThreadModeRawMutex, Option<Output<'static>>>; | 17 | type LedType = Mutex<ThreadModeRawMutex, Option<Output<'static>>>; |
| @@ -21,7 +21,7 @@ static LED: LedType = Mutex::new(None); | |||
| 21 | async fn main(spawner: Spawner) { | 21 | async fn main(spawner: Spawner) { |
| 22 | let p = embassy_rp::init(Default::default()); | 22 | let p = embassy_rp::init(Default::default()); |
| 23 | // set the content of the global LED reference to the real LED pin | 23 | // set the content of the global LED reference to the real LED pin |
| 24 | let led = Output::new(AnyPin::from(p.PIN_25), Level::High); | 24 | let led = Output::new(p.PIN_25, Level::High); |
| 25 | // inner scope is so that once the mutex is written to, the MutexGuard is dropped, thus the | 25 | // inner scope is so that once the mutex is written to, the MutexGuard is dropped, thus the |
| 26 | // Mutex is released | 26 | // Mutex is released |
| 27 | { | 27 | { |
diff --git a/examples/rp235x/src/bin/pio_async.rs b/examples/rp235x/src/bin/pio_async.rs index 08c702347..baf567b58 100644 --- a/examples/rp235x/src/bin/pio_async.rs +++ b/examples/rp235x/src/bin/pio_async.rs | |||
| @@ -4,10 +4,10 @@ | |||
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | ||
| 8 | use embassy_rp::peripherals::PIO0; | 7 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | 8 | use embassy_rp::pio::program::pio_asm; |
| 10 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; | 9 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; |
| 10 | use embassy_rp::{bind_interrupts, Peri}; | ||
| 11 | use fixed::traits::ToFixed; | 11 | use fixed::traits::ToFixed; |
| 12 | use fixed_macro::types::U56F8; | 12 | use fixed_macro::types::U56F8; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -16,7 +16,7 @@ bind_interrupts!(struct Irqs { | |||
| 16 | PIO0_IRQ_0 => InterruptHandler<PIO0>; | 16 | PIO0_IRQ_0 => InterruptHandler<PIO0>; |
| 17 | }); | 17 | }); |
| 18 | 18 | ||
| 19 | fn setup_pio_task_sm0<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, PIO0, 0>, pin: impl PioPin) { | 19 | fn setup_pio_task_sm0<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, PIO0, 0>, pin: Peri<'a, impl PioPin>) { |
| 20 | // Setup sm0 | 20 | // Setup sm0 |
| 21 | 21 | ||
| 22 | // Send data serially to pin | 22 | // Send data serially to pin |
diff --git a/examples/rp235x/src/bin/pio_dma.rs b/examples/rp235x/src/bin/pio_dma.rs index da6e47a1b..64d603ba4 100644 --- a/examples/rp235x/src/bin/pio_dma.rs +++ b/examples/rp235x/src/bin/pio_dma.rs | |||
| @@ -5,10 +5,10 @@ | |||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_futures::join::join; | 7 | use embassy_futures::join::join; |
| 8 | use embassy_rp::bind_interrupts; | ||
| 8 | use embassy_rp::peripherals::PIO0; | 9 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | 10 | use embassy_rp::pio::program::pio_asm; |
| 10 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; | 11 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; |
| 11 | use embassy_rp::{bind_interrupts, Peripheral}; | ||
| 12 | use fixed::traits::ToFixed; | 12 | use fixed::traits::ToFixed; |
| 13 | use fixed_macro::types::U56F8; | 13 | use fixed_macro::types::U56F8; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -62,8 +62,8 @@ async fn main(_spawner: Spawner) { | |||
| 62 | sm.set_config(&cfg); | 62 | sm.set_config(&cfg); |
| 63 | sm.set_enable(true); | 63 | sm.set_enable(true); |
| 64 | 64 | ||
| 65 | let mut dma_out_ref = p.DMA_CH0.into_ref(); | 65 | let mut dma_out_ref = p.DMA_CH0; |
| 66 | let mut dma_in_ref = p.DMA_CH1.into_ref(); | 66 | let mut dma_in_ref = p.DMA_CH1; |
| 67 | let mut dout = [0x12345678u32; 29]; | 67 | let mut dout = [0x12345678u32; 29]; |
| 68 | for i in 1..dout.len() { | 68 | for i in 1..dout.len() { |
| 69 | dout[i] = (dout[i - 1] & 0x0fff_ffff) * 13 + 7; | 69 | dout[i] = (dout[i - 1] & 0x0fff_ffff) * 13 + 7; |
diff --git a/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs b/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs index 0216c131b..ccc601661 100644 --- a/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs +++ b/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs | |||
| @@ -9,7 +9,7 @@ use embassy_executor::Spawner; | |||
| 9 | use embassy_rp::gpio::Pull; | 9 | use embassy_rp::gpio::Pull; |
| 10 | use embassy_rp::peripherals::PIO0; | 10 | use embassy_rp::peripherals::PIO0; |
| 11 | use embassy_rp::pio::program::pio_asm; | 11 | use embassy_rp::pio::program::pio_asm; |
| 12 | use embassy_rp::{bind_interrupts, pio}; | 12 | use embassy_rp::{bind_interrupts, pio, Peri}; |
| 13 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 14 | use fixed::traits::ToFixed; | 14 | use fixed::traits::ToFixed; |
| 15 | use pio::{Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftDirection, StateMachine}; | 15 | use pio::{Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftDirection, StateMachine}; |
| @@ -37,8 +37,8 @@ impl<'d, T: Instance, const SM: usize> PioEncoder<'d, T, SM> { | |||
| 37 | pub fn new( | 37 | pub fn new( |
| 38 | pio: &mut Common<'d, T>, | 38 | pio: &mut Common<'d, T>, |
| 39 | mut sm: StateMachine<'d, T, SM>, | 39 | mut sm: StateMachine<'d, T, SM>, |
| 40 | pin_a: impl PioPin, | 40 | pin_a: Peri<'d, impl PioPin>, |
| 41 | pin_b: impl PioPin, | 41 | pin_b: Peri<'d, impl PioPin>, |
| 42 | ) -> Self { | 42 | ) -> Self { |
| 43 | let mut pin_a = pio.make_pio_pin(pin_a); | 43 | let mut pin_a = pio.make_pio_pin(pin_a); |
| 44 | let mut pin_b = pio.make_pio_pin(pin_b); | 44 | let mut pin_b = pio.make_pio_pin(pin_b); |
diff --git a/examples/rp235x/src/bin/pwm.rs b/examples/rp235x/src/bin/pwm.rs index a3c0f7e49..da1acc18a 100644 --- a/examples/rp235x/src/bin/pwm.rs +++ b/examples/rp235x/src/bin/pwm.rs | |||
| @@ -11,6 +11,7 @@ use defmt::*; | |||
| 11 | use embassy_executor::Spawner; | 11 | use embassy_executor::Spawner; |
| 12 | use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4}; | 12 | use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4}; |
| 13 | use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; | 13 | use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; |
| 14 | use embassy_rp::Peri; | ||
| 14 | use embassy_time::Timer; | 15 | use embassy_time::Timer; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 17 | ||
| @@ -26,7 +27,7 @@ async fn main(spawner: Spawner) { | |||
| 26 | /// Using the onboard led, if You are using a different Board than plain Pico2 (i.e. W variant) | 27 | /// Using the onboard led, if You are using a different Board than plain Pico2 (i.e. W variant) |
| 27 | /// you must use another slice & pin and an appropriate resistor. | 28 | /// you must use another slice & pin and an appropriate resistor. |
| 28 | #[embassy_executor::task] | 29 | #[embassy_executor::task] |
| 29 | async fn pwm_set_config(slice4: PWM_SLICE4, pin25: PIN_25) { | 30 | async fn pwm_set_config(slice4: Peri<'static, PWM_SLICE4>, pin25: Peri<'static, PIN_25>) { |
| 30 | let mut c = Config::default(); | 31 | let mut c = Config::default(); |
| 31 | c.top = 32_768; | 32 | c.top = 32_768; |
| 32 | c.compare_b = 8; | 33 | c.compare_b = 8; |
| @@ -44,7 +45,7 @@ async fn pwm_set_config(slice4: PWM_SLICE4, pin25: PIN_25) { | |||
| 44 | /// | 45 | /// |
| 45 | /// Using GP4 in Slice2, make sure to use an appropriate resistor. | 46 | /// Using GP4 in Slice2, make sure to use an appropriate resistor. |
| 46 | #[embassy_executor::task] | 47 | #[embassy_executor::task] |
| 47 | async fn pwm_set_dutycycle(slice2: PWM_SLICE2, pin4: PIN_4) { | 48 | async fn pwm_set_dutycycle(slice2: Peri<'static, PWM_SLICE2>, pin4: Peri<'static, PIN_4>) { |
| 48 | // If we aim for a specific frequency, here is how we can calculate the top value. | 49 | // If we aim for a specific frequency, here is how we can calculate the top value. |
| 49 | // The top value sets the period of the PWM cycle, so a counter goes from 0 to top and then wraps around to 0. | 50 | // The top value sets the period of the PWM cycle, so a counter goes from 0 to top and then wraps around to 0. |
| 50 | // Every such wraparound is one PWM cycle. So here is how we get 25KHz: | 51 | // Every such wraparound is one PWM cycle. So here is how we get 25KHz: |
diff --git a/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs b/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs index 3b700884c..2cfb2038d 100644 --- a/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs +++ b/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs | |||
| @@ -10,7 +10,7 @@ use defmt::*; | |||
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_rp::config::Config; | 11 | use embassy_rp::config::Config; |
| 12 | use embassy_rp::gpio::Output; | 12 | use embassy_rp::gpio::Output; |
| 13 | use embassy_rp::{gpio, peripherals, pwm}; | 13 | use embassy_rp::{gpio, peripherals, pwm, Peri}; |
| 14 | use embassy_time::{Duration, Timer}; | 14 | use embassy_time::{Duration, Timer}; |
| 15 | use tb6612fng::{DriveCommand, Motor, Tb6612fng}; | 15 | use tb6612fng::{DriveCommand, Motor, Tb6612fng}; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
diff --git a/examples/rp235x/src/bin/shared_bus.rs b/examples/rp235x/src/bin/shared_bus.rs index c6cb5d64c..9267dfccb 100644 --- a/examples/rp235x/src/bin/shared_bus.rs +++ b/examples/rp235x/src/bin/shared_bus.rs | |||
| @@ -8,7 +8,7 @@ use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; | |||
| 8 | use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice; | 8 | use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_rp::bind_interrupts; | 10 | use embassy_rp::bind_interrupts; |
| 11 | use embassy_rp::gpio::{AnyPin, Level, Output}; | 11 | use embassy_rp::gpio::{Level, Output}; |
| 12 | use embassy_rp::i2c::{self, I2c, InterruptHandler}; | 12 | use embassy_rp::i2c::{self, I2c, InterruptHandler}; |
| 13 | use embassy_rp::peripherals::{I2C1, SPI1}; | 13 | use embassy_rp::peripherals::{I2C1, SPI1}; |
| 14 | use embassy_rp::spi::{self, Spi}; | 14 | use embassy_rp::spi::{self, Spi}; |
| @@ -45,8 +45,8 @@ async fn main(spawner: Spawner) { | |||
| 45 | let spi_bus = SPI_BUS.init(Mutex::new(spi)); | 45 | let spi_bus = SPI_BUS.init(Mutex::new(spi)); |
| 46 | 46 | ||
| 47 | // Chip select pins for the SPI devices | 47 | // Chip select pins for the SPI devices |
| 48 | let cs_a = Output::new(AnyPin::from(p.PIN_0), Level::High); | 48 | let cs_a = Output::new(p.PIN_0, Level::High); |
| 49 | let cs_b = Output::new(AnyPin::from(p.PIN_1), Level::High); | 49 | let cs_b = Output::new(p.PIN_1, Level::High); |
| 50 | 50 | ||
| 51 | spawner.must_spawn(spi_task_a(spi_bus, cs_a)); | 51 | spawner.must_spawn(spi_task_a(spi_bus, cs_a)); |
| 52 | spawner.must_spawn(spi_task_b(spi_bus, cs_b)); | 52 | spawner.must_spawn(spi_task_b(spi_bus, cs_b)); |
diff --git a/examples/rp235x/src/bin/zerocopy.rs b/examples/rp235x/src/bin/zerocopy.rs index 39f03c8e4..d1fb0eb00 100644 --- a/examples/rp235x/src/bin/zerocopy.rs +++ b/examples/rp235x/src/bin/zerocopy.rs | |||
| @@ -9,9 +9,9 @@ use core::sync::atomic::{AtomicU16, Ordering}; | |||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; | 11 | use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; |
| 12 | use embassy_rp::bind_interrupts; | ||
| 13 | use embassy_rp::gpio::Pull; | 12 | use embassy_rp::gpio::Pull; |
| 14 | use embassy_rp::peripherals::DMA_CH0; | 13 | use embassy_rp::peripherals::DMA_CH0; |
| 14 | use embassy_rp::{bind_interrupts, Peri}; | ||
| 15 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; | 15 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 16 | use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; | 16 | use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; |
| 17 | use embassy_time::{Duration, Ticker, Timer}; | 17 | use embassy_time::{Duration, Ticker, Timer}; |
| @@ -31,7 +31,7 @@ static MAX: AtomicU16 = AtomicU16::new(0); | |||
| 31 | struct AdcParts { | 31 | struct AdcParts { |
| 32 | adc: Adc<'static, Async>, | 32 | adc: Adc<'static, Async>, |
| 33 | pin: adc::Channel<'static>, | 33 | pin: adc::Channel<'static>, |
| 34 | dma: DMA_CH0, | 34 | dma: Peri<'static, DMA_CH0>, |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | #[embassy_executor::main] | 37 | #[embassy_executor::main] |
| @@ -70,7 +70,10 @@ async fn producer(mut sender: Sender<'static, NoopRawMutex, SampleBuffer>, mut a | |||
| 70 | let buf = sender.send().await; | 70 | let buf = sender.send().await; |
| 71 | 71 | ||
| 72 | // Fill it with data | 72 | // Fill it with data |
| 73 | adc.adc.read_many(&mut adc.pin, buf, 1, &mut adc.dma).await.unwrap(); | 73 | adc.adc |
| 74 | .read_many(&mut adc.pin, buf, 1, adc.dma.reborrow()) | ||
| 75 | .await | ||
| 76 | .unwrap(); | ||
| 74 | 77 | ||
| 75 | // Notify the channel that the buffer is now ready to be received | 78 | // Notify the channel that the buffer is now ready to be received |
| 76 | sender.send_done(); | 79 | sender.send_done(); |
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml index a32e75d08..f00953167 100644 --- a/examples/std/Cargo.toml +++ b/examples/std/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["log"] } | 8 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["log"] } |
| 9 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-std", "executor-thread", "log"] } | 9 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-std", "executor-thread", "log"] } |
| 10 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["log", "std", ] } | 10 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["log", "std", ] } |
| 11 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features=[ "log", "medium-ethernet", "medium-ip", "tcp", "udp", "dns", "dhcpv4", "proto-ipv6"] } | 11 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features=[ "log", "medium-ethernet", "medium-ip", "tcp", "udp", "dns", "dhcpv4", "proto-ipv6"] } |
| 12 | embassy-net-tuntap = { version = "0.1.0", path = "../../embassy-net-tuntap" } | 12 | embassy-net-tuntap = { version = "0.1.0", path = "../../embassy-net-tuntap" } |
diff --git a/examples/stm32c0/src/bin/adc.rs b/examples/stm32c0/src/bin/adc.rs index 10481f4d2..1f54b0b18 100644 --- a/examples/stm32c0/src/bin/adc.rs +++ b/examples/stm32c0/src/bin/adc.rs | |||
| @@ -36,7 +36,8 @@ async fn main(_spawner: Spawner) { | |||
| 36 | ); | 36 | ); |
| 37 | 37 | ||
| 38 | let channels_seqence: [&mut AnyAdcChannel<ADC1>; 3] = [&mut vref, &mut temp, &mut pin0]; | 38 | let channels_seqence: [&mut AnyAdcChannel<ADC1>; 3] = [&mut vref, &mut temp, &mut pin0]; |
| 39 | adc.read(&mut dma, channels_seqence.into_iter(), &mut read_buffer).await; | 39 | adc.read(dma.reborrow(), channels_seqence.into_iter(), &mut read_buffer) |
| 40 | .await; | ||
| 40 | // Values are ordered according to hardware ADC channel number! | 41 | // Values are ordered according to hardware ADC channel number! |
| 41 | info!( | 42 | info!( |
| 42 | "DMA ADC read in set: vref = {}, temp = {}, pin0 = {}.", | 43 | "DMA ADC read in set: vref = {}, temp = {}, pin0 = {}.", |
| @@ -45,7 +46,7 @@ async fn main(_spawner: Spawner) { | |||
| 45 | 46 | ||
| 46 | let hw_channel_selection: u32 = | 47 | let hw_channel_selection: u32 = |
| 47 | (1 << temp.get_hw_channel()) + (1 << vref.get_hw_channel()) + (1 << pin0.get_hw_channel()); | 48 | (1 << temp.get_hw_channel()) + (1 << vref.get_hw_channel()) + (1 << pin0.get_hw_channel()); |
| 48 | adc.read_in_hw_order(&mut dma, hw_channel_selection, Scandir::UP, &mut read_buffer) | 49 | adc.read_in_hw_order(dma.reborrow(), hw_channel_selection, Scandir::UP, &mut read_buffer) |
| 49 | .await; | 50 | .await; |
| 50 | info!( | 51 | info!( |
| 51 | "DMA ADC read in hardware order: vref = {}, temp = {}, pin0 = {}.", | 52 | "DMA ADC read in hardware order: vref = {}, temp = {}, pin0 = {}.", |
diff --git a/examples/stm32f0/src/bin/button_controlled_blink.rs b/examples/stm32f0/src/bin/button_controlled_blink.rs index 4465483d9..744df3e3b 100644 --- a/examples/stm32f0/src/bin/button_controlled_blink.rs +++ b/examples/stm32f0/src/bin/button_controlled_blink.rs | |||
| @@ -8,14 +8,15 @@ use core::sync::atomic::{AtomicU32, Ordering}; | |||
| 8 | use defmt::info; | 8 | use defmt::info; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::ExtiInput; |
| 11 | use embassy_stm32::gpio::{AnyPin, Level, Output, Pin, Pull, Speed}; | 11 | use embassy_stm32::gpio::{AnyPin, Level, Output, Pull, Speed}; |
| 12 | use embassy_stm32::Peri; | ||
| 12 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 15 | ||
| 15 | static BLINK_MS: AtomicU32 = AtomicU32::new(0); | 16 | static BLINK_MS: AtomicU32 = AtomicU32::new(0); |
| 16 | 17 | ||
| 17 | #[embassy_executor::task] | 18 | #[embassy_executor::task] |
| 18 | async fn led_task(led: AnyPin) { | 19 | async fn led_task(led: Peri<'static, AnyPin>) { |
| 19 | // Configure the LED pin as a push pull output and obtain handler. | 20 | // Configure the LED pin as a push pull output and obtain handler. |
| 20 | // On the Nucleo F091RC there's an on-board LED connected to pin PA5. | 21 | // On the Nucleo F091RC there's an on-board LED connected to pin PA5. |
| 21 | let mut led = Output::new(led, Level::Low, Speed::Low); | 22 | let mut led = Output::new(led, Level::Low, Speed::Low); |
| @@ -45,7 +46,7 @@ async fn main(spawner: Spawner) { | |||
| 45 | BLINK_MS.store(del_var, Ordering::Relaxed); | 46 | BLINK_MS.store(del_var, Ordering::Relaxed); |
| 46 | 47 | ||
| 47 | // Spawn LED blinking task | 48 | // Spawn LED blinking task |
| 48 | spawner.spawn(led_task(p.PA5.degrade())).unwrap(); | 49 | spawner.spawn(led_task(p.PA5.into())).unwrap(); |
| 49 | 50 | ||
| 50 | loop { | 51 | loop { |
| 51 | // Check if button got pressed | 52 | // Check if button got pressed |
diff --git a/examples/stm32f1/src/bin/input_capture.rs b/examples/stm32f1/src/bin/input_capture.rs index 5e2dab9e6..6fe8e0b50 100644 --- a/examples/stm32f1/src/bin/input_capture.rs +++ b/examples/stm32f1/src/bin/input_capture.rs | |||
| @@ -7,14 +7,14 @@ use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | |||
| 7 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; | 8 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; |
| 9 | use embassy_stm32::timer::{self, Channel}; | 9 | use embassy_stm32::timer::{self, Channel}; |
| 10 | use embassy_stm32::{bind_interrupts, peripherals}; | 10 | use embassy_stm32::{bind_interrupts, peripherals, Peri}; |
| 11 | use embassy_time::Timer; | 11 | use embassy_time::Timer; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | /// Connect PA2 and PC13 with a 1k Ohm resistor | 14 | /// Connect PA2 and PC13 with a 1k Ohm resistor |
| 15 | 15 | ||
| 16 | #[embassy_executor::task] | 16 | #[embassy_executor::task] |
| 17 | async fn blinky(led: peripherals::PC13) { | 17 | async fn blinky(led: Peri<'static, peripherals::PC13>) { |
| 18 | let mut led = Output::new(led, Level::High, Speed::Low); | 18 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 19 | 19 | ||
| 20 | loop { | 20 | loop { |
diff --git a/examples/stm32f1/src/bin/pwm_input.rs b/examples/stm32f1/src/bin/pwm_input.rs index f74853d4e..afbef3edb 100644 --- a/examples/stm32f1/src/bin/pwm_input.rs +++ b/examples/stm32f1/src/bin/pwm_input.rs | |||
| @@ -6,14 +6,14 @@ use embassy_executor::Spawner; | |||
| 6 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | 6 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 7 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::pwm_input::PwmInput; | 8 | use embassy_stm32::timer::pwm_input::PwmInput; |
| 9 | use embassy_stm32::{bind_interrupts, peripherals, timer}; | 9 | use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; |
| 10 | use embassy_time::Timer; | 10 | use embassy_time::Timer; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | /// Connect PA0 and PC13 with a 1k Ohm resistor | 13 | /// Connect PA0 and PC13 with a 1k Ohm resistor |
| 14 | 14 | ||
| 15 | #[embassy_executor::task] | 15 | #[embassy_executor::task] |
| 16 | async fn blinky(led: peripherals::PC13) { | 16 | async fn blinky(led: Peri<'static, peripherals::PC13>) { |
| 17 | let mut led = Output::new(led, Level::High, Speed::Low); | 17 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 18 | 18 | ||
| 19 | loop { | 19 | loop { |
diff --git a/examples/stm32f1/src/bin/usb_serial.rs b/examples/stm32f1/src/bin/usb_serial.rs index ee99acf41..77ec307b9 100644 --- a/examples/stm32f1/src/bin/usb_serial.rs +++ b/examples/stm32f1/src/bin/usb_serial.rs | |||
| @@ -47,7 +47,7 @@ async fn main(_spawner: Spawner) { | |||
| 47 | // Pull the D+ pin down to send a RESET condition to the USB bus. | 47 | // Pull the D+ pin down to send a RESET condition to the USB bus. |
| 48 | // This forced reset is needed only for development, without it host | 48 | // This forced reset is needed only for development, without it host |
| 49 | // will not reset your device when you upload new firmware. | 49 | // will not reset your device when you upload new firmware. |
| 50 | let _dp = Output::new(&mut p.PA12, Level::Low, Speed::Low); | 50 | let _dp = Output::new(p.PA12.reborrow(), Level::Low, Speed::Low); |
| 51 | Timer::after_millis(10).await; | 51 | Timer::after_millis(10).await; |
| 52 | } | 52 | } |
| 53 | 53 | ||
diff --git a/examples/stm32f334/src/bin/opamp.rs b/examples/stm32f334/src/bin/opamp.rs index 2dbf1bdab..b30445ead 100644 --- a/examples/stm32f334/src/bin/opamp.rs +++ b/examples/stm32f334/src/bin/opamp.rs | |||
| @@ -48,7 +48,7 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 48 | 48 | ||
| 49 | let mut vrefint = adc.enable_vref(); | 49 | let mut vrefint = adc.enable_vref(); |
| 50 | let mut temperature = adc.enable_temperature(); | 50 | let mut temperature = adc.enable_temperature(); |
| 51 | let mut buffer = opamp.buffer_ext(&mut p.PA7, &mut p.PA6, OpAmpGain::Mul1); | 51 | let mut buffer = opamp.buffer_ext(p.PA7.reborrow(), p.PA6.reborrow(), OpAmpGain::Mul1); |
| 52 | 52 | ||
| 53 | loop { | 53 | loop { |
| 54 | let vref = adc.read(&mut vrefint).await; | 54 | let vref = adc.read(&mut vrefint).await; |
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml index e611564eb..7aa4354ca 100644 --- a/examples/stm32f4/Cargo.toml +++ b/examples/stm32f4/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32f429zi to your chip name, if necessary. | 8 | # Change stm32f429zi to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-tim4", "exti", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-tim4", "exti", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt" ] } | 13 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt" ] } |
| 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } | 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } |
diff --git a/examples/stm32f4/src/bin/can.rs b/examples/stm32f4/src/bin/can.rs index 8e3beee24..fd90e0d6d 100644 --- a/examples/stm32f4/src/bin/can.rs +++ b/examples/stm32f4/src/bin/can.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | // To synchronise to the bus the RX input needs to see a high level. | 30 | // To synchronise to the bus the RX input needs to see a high level. |
| 31 | // Use `mem::forget()` to release the borrow on the pin but keep the | 31 | // Use `mem::forget()` to release the borrow on the pin but keep the |
| 32 | // pull-up resistor enabled. | 32 | // pull-up resistor enabled. |
| 33 | let rx_pin = Input::new(&mut p.PA11, Pull::Up); | 33 | let rx_pin = Input::new(p.PA11.reborrow(), Pull::Up); |
| 34 | core::mem::forget(rx_pin); | 34 | core::mem::forget(rx_pin); |
| 35 | 35 | ||
| 36 | let mut can = Can::new(p.CAN1, p.PA11, p.PA12, Irqs); | 36 | let mut can = Can::new(p.CAN1, p.PA11, p.PA12, Irqs); |
diff --git a/examples/stm32f4/src/bin/dac.rs b/examples/stm32f4/src/bin/dac.rs index dd2a45718..68fe6cabd 100644 --- a/examples/stm32f4/src/bin/dac.rs +++ b/examples/stm32f4/src/bin/dac.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::dac::{DacCh1, Value}; | 6 | use embassy_stm32::dac::{DacCh1, Value}; |
| 7 | use embassy_stm32::dma::NoDma; | ||
| 8 | use {defmt_rtt as _, panic_probe as _}; | 7 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 8 | ||
| 10 | #[embassy_executor::main] | 9 | #[embassy_executor::main] |
| @@ -12,7 +11,7 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 12 | let p = embassy_stm32::init(Default::default()); | 11 | let p = embassy_stm32::init(Default::default()); |
| 13 | info!("Hello World, dude!"); | 12 | info!("Hello World, dude!"); |
| 14 | 13 | ||
| 15 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); | 14 | let mut dac = DacCh1::new_blocking(p.DAC1, p.PA4); |
| 16 | 15 | ||
| 17 | loop { | 16 | loop { |
| 18 | for v in 0..=255 { | 17 | for v in 0..=255 { |
diff --git a/examples/stm32f4/src/bin/flash_async.rs b/examples/stm32f4/src/bin/flash_async.rs index 493a536f3..755713542 100644 --- a/examples/stm32f4/src/bin/flash_async.rs +++ b/examples/stm32f4/src/bin/flash_async.rs | |||
| @@ -3,9 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::{info, unwrap}; | 4 | use defmt::{info, unwrap}; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::bind_interrupts; | ||
| 7 | use embassy_stm32::flash::{Flash, InterruptHandler}; | 6 | use embassy_stm32::flash::{Flash, InterruptHandler}; |
| 8 | use embassy_stm32::gpio::{AnyPin, Level, Output, Pin, Speed}; | 7 | use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; |
| 8 | use embassy_stm32::{bind_interrupts, Peri}; | ||
| 9 | use embassy_time::Timer; | 9 | use embassy_time::Timer; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| @@ -21,14 +21,14 @@ async fn main(spawner: Spawner) { | |||
| 21 | let mut f = Flash::new(p.FLASH, Irqs); | 21 | let mut f = Flash::new(p.FLASH, Irqs); |
| 22 | 22 | ||
| 23 | // Led should blink uninterrupted during ~2sec erase operation | 23 | // Led should blink uninterrupted during ~2sec erase operation |
| 24 | spawner.spawn(blinky(p.PB7.degrade())).unwrap(); | 24 | spawner.spawn(blinky(p.PB7.into())).unwrap(); |
| 25 | 25 | ||
| 26 | // Test on bank 2 in order not to stall CPU. | 26 | // Test on bank 2 in order not to stall CPU. |
| 27 | test_flash(&mut f, 1024 * 1024, 128 * 1024).await; | 27 | test_flash(&mut f, 1024 * 1024, 128 * 1024).await; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | #[embassy_executor::task] | 30 | #[embassy_executor::task] |
| 31 | async fn blinky(p: AnyPin) { | 31 | async fn blinky(p: Peri<'static, AnyPin>) { |
| 32 | let mut led = Output::new(p, Level::High, Speed::Low); | 32 | let mut led = Output::new(p, Level::High, Speed::Low); |
| 33 | 33 | ||
| 34 | loop { | 34 | loop { |
diff --git a/examples/stm32f4/src/bin/input_capture.rs b/examples/stm32f4/src/bin/input_capture.rs index 49de33d2b..fe5e2bdfc 100644 --- a/examples/stm32f4/src/bin/input_capture.rs +++ b/examples/stm32f4/src/bin/input_capture.rs | |||
| @@ -7,14 +7,14 @@ use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | |||
| 7 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; | 8 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; |
| 9 | use embassy_stm32::timer::{self, Channel}; | 9 | use embassy_stm32::timer::{self, Channel}; |
| 10 | use embassy_stm32::{bind_interrupts, peripherals}; | 10 | use embassy_stm32::{bind_interrupts, peripherals, Peri}; |
| 11 | use embassy_time::Timer; | 11 | use embassy_time::Timer; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | /// Connect PB2 and PB10 with a 1k Ohm resistor | 14 | /// Connect PB2 and PB10 with a 1k Ohm resistor |
| 15 | 15 | ||
| 16 | #[embassy_executor::task] | 16 | #[embassy_executor::task] |
| 17 | async fn blinky(led: peripherals::PB2) { | 17 | async fn blinky(led: Peri<'static, peripherals::PB2>) { |
| 18 | let mut led = Output::new(led, Level::High, Speed::Low); | 18 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 19 | 19 | ||
| 20 | loop { | 20 | loop { |
diff --git a/examples/stm32f4/src/bin/pwm_input.rs b/examples/stm32f4/src/bin/pwm_input.rs index ce200549d..465cbe4f5 100644 --- a/examples/stm32f4/src/bin/pwm_input.rs +++ b/examples/stm32f4/src/bin/pwm_input.rs | |||
| @@ -6,14 +6,14 @@ use embassy_executor::Spawner; | |||
| 6 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | 6 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 7 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::pwm_input::PwmInput; | 8 | use embassy_stm32::timer::pwm_input::PwmInput; |
| 9 | use embassy_stm32::{bind_interrupts, peripherals, timer}; | 9 | use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; |
| 10 | use embassy_time::Timer; | 10 | use embassy_time::Timer; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | /// Connect PB2 and PA6 with a 1k Ohm resistor | 13 | /// Connect PB2 and PA6 with a 1k Ohm resistor |
| 14 | 14 | ||
| 15 | #[embassy_executor::task] | 15 | #[embassy_executor::task] |
| 16 | async fn blinky(led: peripherals::PB2) { | 16 | async fn blinky(led: Peri<'static, peripherals::PB2>) { |
| 17 | let mut led = Output::new(led, Level::High, Speed::Low); | 17 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 18 | 18 | ||
| 19 | loop { | 19 | loop { |
diff --git a/examples/stm32f4/src/bin/ws2812_pwm.rs b/examples/stm32f4/src/bin/ws2812_pwm.rs index 3ab93d6e0..ca924e181 100644 --- a/examples/stm32f4/src/bin/ws2812_pwm.rs +++ b/examples/stm32f4/src/bin/ws2812_pwm.rs | |||
| @@ -92,7 +92,7 @@ async fn main(_spawner: Spawner) { | |||
| 92 | loop { | 92 | loop { |
| 93 | for &color in color_list { | 93 | for &color in color_list { |
| 94 | // with &mut, we can easily reuse same DMA channel multiple times | 94 | // with &mut, we can easily reuse same DMA channel multiple times |
| 95 | ws2812_pwm.waveform_up(&mut dp.DMA1_CH2, pwm_channel, color).await; | 95 | ws2812_pwm.waveform_up(dp.DMA1_CH2.reborrow(), pwm_channel, color).await; |
| 96 | // ws2812 need at least 50 us low level input to confirm the input data and change it's state | 96 | // ws2812 need at least 50 us low level input to confirm the input data and change it's state |
| 97 | Timer::after_micros(50).await; | 97 | Timer::after_micros(50).await; |
| 98 | // wait until ticker tick | 98 | // wait until ticker tick |
diff --git a/examples/stm32f469/Cargo.toml b/examples/stm32f469/Cargo.toml index 2c0c9a6c8..4d403bae8 100644 --- a/examples/stm32f469/Cargo.toml +++ b/examples/stm32f469/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | # Specific examples only for stm32f469 | 8 | # Specific examples only for stm32f469 |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f469ni", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f469ni", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] } |
| 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 12 | 12 | ||
| 13 | defmt = "0.3" | 13 | defmt = "0.3" |
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml index e8b246184..9fbe2efc3 100644 --- a/examples/stm32f7/Cargo.toml +++ b/examples/stm32f7/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32f777zi to your chip name, if necessary. | 8 | # Change stm32f777zi to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } | 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } |
| 14 | embedded-io-async = { version = "0.6.1" } | 14 | embedded-io-async = { version = "0.6.1" } |
diff --git a/examples/stm32f7/src/bin/can.rs b/examples/stm32f7/src/bin/can.rs index a82e335a9..58ba940a8 100644 --- a/examples/stm32f7/src/bin/can.rs +++ b/examples/stm32f7/src/bin/can.rs | |||
| @@ -42,7 +42,7 @@ async fn main(spawner: Spawner) { | |||
| 42 | // To synchronise to the bus the RX input needs to see a high level. | 42 | // To synchronise to the bus the RX input needs to see a high level. |
| 43 | // Use `mem::forget()` to release the borrow on the pin but keep the | 43 | // Use `mem::forget()` to release the borrow on the pin but keep the |
| 44 | // pull-up resistor enabled. | 44 | // pull-up resistor enabled. |
| 45 | let rx_pin = Input::new(&mut p.PA15, Pull::Up); | 45 | let rx_pin = Input::new(p.PA15.reborrow(), Pull::Up); |
| 46 | core::mem::forget(rx_pin); | 46 | core::mem::forget(rx_pin); |
| 47 | 47 | ||
| 48 | static CAN: StaticCell<Can<'static>> = StaticCell::new(); | 48 | static CAN: StaticCell<Can<'static>> = StaticCell::new(); |
diff --git a/examples/stm32g0/src/bin/adc_dma.rs b/examples/stm32g0/src/bin/adc_dma.rs index 3713e5a21..d7515933c 100644 --- a/examples/stm32g0/src/bin/adc_dma.rs +++ b/examples/stm32g0/src/bin/adc_dma.rs | |||
| @@ -25,7 +25,7 @@ async fn main(_spawner: Spawner) { | |||
| 25 | 25 | ||
| 26 | loop { | 26 | loop { |
| 27 | adc.read( | 27 | adc.read( |
| 28 | &mut dma, | 28 | dma.reborrow(), |
| 29 | [ | 29 | [ |
| 30 | (&mut vrefint_channel, SampleTime::CYCLES160_5), | 30 | (&mut vrefint_channel, SampleTime::CYCLES160_5), |
| 31 | (&mut pa0, SampleTime::CYCLES160_5), | 31 | (&mut pa0, SampleTime::CYCLES160_5), |
diff --git a/examples/stm32g0/src/bin/input_capture.rs b/examples/stm32g0/src/bin/input_capture.rs index bc814cb13..08df4e043 100644 --- a/examples/stm32g0/src/bin/input_capture.rs +++ b/examples/stm32g0/src/bin/input_capture.rs | |||
| @@ -16,14 +16,14 @@ use embassy_stm32::time::khz; | |||
| 16 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; | 16 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; |
| 17 | use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; | 17 | use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; |
| 18 | use embassy_stm32::timer::Channel; | 18 | use embassy_stm32::timer::Channel; |
| 19 | use embassy_stm32::{bind_interrupts, peripherals, timer}; | 19 | use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; |
| 20 | use embassy_time::Timer; | 20 | use embassy_time::Timer; |
| 21 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| 22 | 22 | ||
| 23 | // Connect PB1 and PA6 with a 1k Ohm resistor | 23 | // Connect PB1 and PA6 with a 1k Ohm resistor |
| 24 | 24 | ||
| 25 | #[embassy_executor::task] | 25 | #[embassy_executor::task] |
| 26 | async fn blinky(led: peripherals::PB1) { | 26 | async fn blinky(led: Peri<'static, peripherals::PB1>) { |
| 27 | let mut led = Output::new(led, Level::High, Speed::Low); | 27 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 28 | 28 | ||
| 29 | loop { | 29 | loop { |
diff --git a/examples/stm32g0/src/bin/pwm_input.rs b/examples/stm32g0/src/bin/pwm_input.rs index db9cf4f8a..9d6b5fe97 100644 --- a/examples/stm32g0/src/bin/pwm_input.rs +++ b/examples/stm32g0/src/bin/pwm_input.rs | |||
| @@ -14,13 +14,13 @@ use embassy_stm32::gpio::{Level, Output, OutputType, Pull, Speed}; | |||
| 14 | use embassy_stm32::time::khz; | 14 | use embassy_stm32::time::khz; |
| 15 | use embassy_stm32::timer::pwm_input::PwmInput; | 15 | use embassy_stm32::timer::pwm_input::PwmInput; |
| 16 | use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; | 16 | use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; |
| 17 | use embassy_stm32::{bind_interrupts, peripherals, timer}; | 17 | use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; |
| 18 | use embassy_time::Timer; | 18 | use embassy_time::Timer; |
| 19 | use {defmt_rtt as _, panic_probe as _}; | 19 | use {defmt_rtt as _, panic_probe as _}; |
| 20 | 20 | ||
| 21 | // Connect PB1 and PA6 with a 1k Ohm resistor | 21 | // Connect PB1 and PA6 with a 1k Ohm resistor |
| 22 | #[embassy_executor::task] | 22 | #[embassy_executor::task] |
| 23 | async fn blinky(led: peripherals::PB1) { | 23 | async fn blinky(led: Peri<'static, peripherals::PB1>) { |
| 24 | let mut led = Output::new(led, Level::High, Speed::Low); | 24 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 25 | 25 | ||
| 26 | loop { | 26 | loop { |
diff --git a/examples/stm32g4/src/bin/adc_dma.rs b/examples/stm32g4/src/bin/adc_dma.rs index 970623b32..202704085 100644 --- a/examples/stm32g4/src/bin/adc_dma.rs +++ b/examples/stm32g4/src/bin/adc_dma.rs | |||
| @@ -41,7 +41,7 @@ async fn main(_spawner: Spawner) { | |||
| 41 | 41 | ||
| 42 | loop { | 42 | loop { |
| 43 | adc.read( | 43 | adc.read( |
| 44 | &mut dma, | 44 | dma.reborrow(), |
| 45 | [ | 45 | [ |
| 46 | (&mut vrefint_channel, SampleTime::CYCLES247_5), | 46 | (&mut vrefint_channel, SampleTime::CYCLES247_5), |
| 47 | (&mut pa0, SampleTime::CYCLES247_5), | 47 | (&mut pa0, SampleTime::CYCLES247_5), |
diff --git a/examples/stm32h5/Cargo.toml b/examples/stm32h5/Cargo.toml index 5b80e5486..5631ff746 100644 --- a/examples/stm32h5/Cargo.toml +++ b/examples/stm32h5/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32h563zi to your chip name, if necessary. | 8 | # Change stm32h563zi to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h563zi", "memory-x", "time-driver-any", "exti", "unstable-pac", "low-power"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h563zi", "memory-x", "time-driver-any", "exti", "unstable-pac", "low-power"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6"] } | 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6"] } |
| 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/stm32h5/src/bin/cordic.rs b/examples/stm32h5/src/bin/cordic.rs index 73e873574..cbf854704 100644 --- a/examples/stm32h5/src/bin/cordic.rs +++ b/examples/stm32h5/src/bin/cordic.rs | |||
| @@ -11,7 +11,7 @@ async fn main(_spawner: Spawner) { | |||
| 11 | let mut dp = embassy_stm32::init(Default::default()); | 11 | let mut dp = embassy_stm32::init(Default::default()); |
| 12 | 12 | ||
| 13 | let mut cordic = cordic::Cordic::new( | 13 | let mut cordic = cordic::Cordic::new( |
| 14 | &mut dp.CORDIC, | 14 | dp.CORDIC.reborrow(), |
| 15 | unwrap!(cordic::Config::new( | 15 | unwrap!(cordic::Config::new( |
| 16 | cordic::Function::Sin, | 16 | cordic::Function::Sin, |
| 17 | Default::default(), | 17 | Default::default(), |
| @@ -59,8 +59,8 @@ async fn main(_spawner: Spawner) { | |||
| 59 | let cnt1 = unwrap!( | 59 | let cnt1 = unwrap!( |
| 60 | cordic | 60 | cordic |
| 61 | .async_calc_32bit( | 61 | .async_calc_32bit( |
| 62 | &mut dp.GPDMA1_CH0, | 62 | dp.GPDMA1_CH0.reborrow(), |
| 63 | &mut dp.GPDMA1_CH1, | 63 | dp.GPDMA1_CH1.reborrow(), |
| 64 | &input_buf[..arg1.len() - 1], // limit input buf to its actual length | 64 | &input_buf[..arg1.len() - 1], // limit input buf to its actual length |
| 65 | &mut output_u32, | 65 | &mut output_u32, |
| 66 | true, | 66 | true, |
diff --git a/examples/stm32h5/src/bin/stop.rs b/examples/stm32h5/src/bin/stop.rs index 0d14c0668..e650791c5 100644 --- a/examples/stm32h5/src/bin/stop.rs +++ b/examples/stm32h5/src/bin/stop.rs | |||
| @@ -10,7 +10,7 @@ use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; | |||
| 10 | use embassy_stm32::low_power::Executor; | 10 | use embassy_stm32::low_power::Executor; |
| 11 | use embassy_stm32::rcc::{HSIPrescaler, LsConfig}; | 11 | use embassy_stm32::rcc::{HSIPrescaler, LsConfig}; |
| 12 | use embassy_stm32::rtc::{Rtc, RtcConfig}; | 12 | use embassy_stm32::rtc::{Rtc, RtcConfig}; |
| 13 | use embassy_stm32::Config; | 13 | use embassy_stm32::{Config, Peri}; |
| 14 | use embassy_time::Timer; | 14 | use embassy_time::Timer; |
| 15 | use static_cell::StaticCell; | 15 | use static_cell::StaticCell; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -48,7 +48,7 @@ async fn async_main(spawner: Spawner) { | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | #[embassy_executor::task] | 50 | #[embassy_executor::task] |
| 51 | async fn blinky(led: AnyPin) { | 51 | async fn blinky(led: Peri<'static, AnyPin>) { |
| 52 | let mut led = Output::new(led, Level::Low, Speed::Low); | 52 | let mut led = Output::new(led, Level::Low, Speed::Low); |
| 53 | loop { | 53 | loop { |
| 54 | info!("high"); | 54 | info!("high"); |
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index 4c18bb21c..2f98542bb 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml | |||
| @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" | |||
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743bi", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743bi", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } |
| 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } | 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } |
| 15 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 15 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/stm32h7/src/bin/adc_dma.rs b/examples/stm32h7/src/bin/adc_dma.rs index 0b905d227..dc775f18a 100644 --- a/examples/stm32h7/src/bin/adc_dma.rs +++ b/examples/stm32h7/src/bin/adc_dma.rs | |||
| @@ -57,7 +57,7 @@ async fn main(_spawner: Spawner) { | |||
| 57 | 57 | ||
| 58 | loop { | 58 | loop { |
| 59 | adc.read( | 59 | adc.read( |
| 60 | &mut dma, | 60 | dma.reborrow(), |
| 61 | [ | 61 | [ |
| 62 | (&mut vrefint_channel, SampleTime::CYCLES387_5), | 62 | (&mut vrefint_channel, SampleTime::CYCLES387_5), |
| 63 | (&mut pc0, SampleTime::CYCLES810_5), | 63 | (&mut pc0, SampleTime::CYCLES810_5), |
diff --git a/examples/stm32h7/src/bin/dac.rs b/examples/stm32h7/src/bin/dac.rs index a6f969aba..27df80336 100644 --- a/examples/stm32h7/src/bin/dac.rs +++ b/examples/stm32h7/src/bin/dac.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | use cortex_m_rt::entry; | 4 | use cortex_m_rt::entry; |
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_stm32::dac::{DacCh1, Value}; | 6 | use embassy_stm32::dac::{DacCh1, Value}; |
| 7 | use embassy_stm32::dma::NoDma; | ||
| 8 | use embassy_stm32::Config; | 7 | use embassy_stm32::Config; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 9 | ||
| @@ -44,7 +43,7 @@ fn main() -> ! { | |||
| 44 | } | 43 | } |
| 45 | let p = embassy_stm32::init(config); | 44 | let p = embassy_stm32::init(config); |
| 46 | 45 | ||
| 47 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); | 46 | let mut dac = DacCh1::new_blocking(p.DAC1, p.PA4); |
| 48 | 47 | ||
| 49 | loop { | 48 | loop { |
| 50 | for v in 0..=255 { | 49 | for v in 0..=255 { |
diff --git a/examples/stm32h7/src/bin/dac_dma.rs b/examples/stm32h7/src/bin/dac_dma.rs index 3a9887e3c..8314754bc 100644 --- a/examples/stm32h7/src/bin/dac_dma.rs +++ b/examples/stm32h7/src/bin/dac_dma.rs | |||
| @@ -4,11 +4,13 @@ | |||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; | 6 | use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; |
| 7 | use embassy_stm32::mode::Async; | ||
| 7 | use embassy_stm32::pac::timer::vals::Mms; | 8 | use embassy_stm32::pac::timer::vals::Mms; |
| 8 | use embassy_stm32::peripherals::{DAC1, DMA1_CH3, DMA1_CH4, TIM6, TIM7}; | 9 | use embassy_stm32::peripherals::{DAC1, TIM6, TIM7}; |
| 9 | use embassy_stm32::rcc::frequency; | 10 | use embassy_stm32::rcc::frequency; |
| 10 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 11 | use embassy_stm32::timer::low_level::Timer; | 12 | use embassy_stm32::timer::low_level::Timer; |
| 13 | use embassy_stm32::Peri; | ||
| 12 | use micromath::F32Ext; | 14 | use micromath::F32Ext; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 16 | ||
| @@ -56,7 +58,7 @@ async fn main(spawner: Spawner) { | |||
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | #[embassy_executor::task] | 60 | #[embassy_executor::task] |
| 59 | async fn dac_task1(tim: TIM6, mut dac: DacCh1<'static, DAC1, DMA1_CH3>) { | 61 | async fn dac_task1(tim: Peri<'static, TIM6>, mut dac: DacCh1<'static, DAC1, Async>) { |
| 60 | let data: &[u8; 256] = &calculate_array::<256>(); | 62 | let data: &[u8; 256] = &calculate_array::<256>(); |
| 61 | 63 | ||
| 62 | info!("TIM6 frequency is {}", frequency::<TIM6>()); | 64 | info!("TIM6 frequency is {}", frequency::<TIM6>()); |
| @@ -99,7 +101,7 @@ async fn dac_task1(tim: TIM6, mut dac: DacCh1<'static, DAC1, DMA1_CH3>) { | |||
| 99 | } | 101 | } |
| 100 | 102 | ||
| 101 | #[embassy_executor::task] | 103 | #[embassy_executor::task] |
| 102 | async fn dac_task2(tim: TIM7, mut dac: DacCh2<'static, DAC1, DMA1_CH4>) { | 104 | async fn dac_task2(tim: Peri<'static, TIM7>, mut dac: DacCh2<'static, DAC1, Async>) { |
| 103 | let data: &[u8; 256] = &calculate_array::<256>(); | 105 | let data: &[u8; 256] = &calculate_array::<256>(); |
| 104 | 106 | ||
| 105 | info!("TIM7 frequency is {}", frequency::<TIM6>()); | 107 | info!("TIM7 frequency is {}", frequency::<TIM6>()); |
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs index b796996ea..8de31ea5b 100644 --- a/examples/stm32h7/src/bin/low_level_timer_api.rs +++ b/examples/stm32h7/src/bin/low_level_timer_api.rs | |||
| @@ -7,7 +7,7 @@ use embassy_stm32::gpio::{AfType, Flex, OutputType, Speed}; | |||
| 7 | use embassy_stm32::time::{khz, Hertz}; | 7 | use embassy_stm32::time::{khz, Hertz}; |
| 8 | use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; | 8 | use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; |
| 9 | use embassy_stm32::timer::{Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin, GeneralInstance32bit4Channel}; | 9 | use embassy_stm32::timer::{Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin, GeneralInstance32bit4Channel}; |
| 10 | use embassy_stm32::{into_ref, Config, Peripheral}; | 10 | use embassy_stm32::{Config, Peri}; |
| 11 | use embassy_time::Timer; | 11 | use embassy_time::Timer; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| @@ -66,15 +66,13 @@ pub struct SimplePwm32<'d, T: GeneralInstance32bit4Channel> { | |||
| 66 | 66 | ||
| 67 | impl<'d, T: GeneralInstance32bit4Channel> SimplePwm32<'d, T> { | 67 | impl<'d, T: GeneralInstance32bit4Channel> SimplePwm32<'d, T> { |
| 68 | pub fn new( | 68 | pub fn new( |
| 69 | tim: impl Peripheral<P = T> + 'd, | 69 | tim: Peri<'d, T>, |
| 70 | ch1: impl Peripheral<P = impl Channel1Pin<T>> + 'd, | 70 | ch1: Peri<'d, impl Channel1Pin<T>>, |
| 71 | ch2: impl Peripheral<P = impl Channel2Pin<T>> + 'd, | 71 | ch2: Peri<'d, impl Channel2Pin<T>>, |
| 72 | ch3: impl Peripheral<P = impl Channel3Pin<T>> + 'd, | 72 | ch3: Peri<'d, impl Channel3Pin<T>>, |
| 73 | ch4: impl Peripheral<P = impl Channel4Pin<T>> + 'd, | 73 | ch4: Peri<'d, impl Channel4Pin<T>>, |
| 74 | freq: Hertz, | 74 | freq: Hertz, |
| 75 | ) -> Self { | 75 | ) -> Self { |
| 76 | into_ref!(ch1, ch2, ch3, ch4); | ||
| 77 | |||
| 78 | let af1 = ch1.af_num(); | 76 | let af1 = ch1.af_num(); |
| 79 | let af2 = ch2.af_num(); | 77 | let af2 = ch2.af_num(); |
| 80 | let af3 = ch3.af_num(); | 78 | let af3 = ch3.af_num(); |
diff --git a/examples/stm32h723/Cargo.toml b/examples/stm32h723/Cargo.toml index 148d09dd6..749fd78ae 100644 --- a/examples/stm32h723/Cargo.toml +++ b/examples/stm32h723/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32h723zg to your chip name, if necessary. | 8 | # Change stm32h723zg to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h723zg", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h723zg", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 13 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 14 | 14 | ||
diff --git a/examples/stm32h723/src/bin/spdifrx.rs b/examples/stm32h723/src/bin/spdifrx.rs index 69ef5cd07..bc8249ced 100644 --- a/examples/stm32h723/src/bin/spdifrx.rs +++ b/examples/stm32h723/src/bin/spdifrx.rs | |||
| @@ -77,14 +77,19 @@ async fn main(_spawner: Spawner) { | |||
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | let mut sai_transmitter = new_sai_transmitter( | 79 | let mut sai_transmitter = new_sai_transmitter( |
| 80 | &mut p.SAI4, | 80 | p.SAI4.reborrow(), |
| 81 | &mut p.PD13, | 81 | p.PD13.reborrow(), |
| 82 | &mut p.PC1, | 82 | p.PC1.reborrow(), |
| 83 | &mut p.PD12, | 83 | p.PD12.reborrow(), |
| 84 | &mut p.BDMA_CH0, | 84 | p.BDMA_CH0.reborrow(), |
| 85 | sai_buffer, | 85 | sai_buffer, |
| 86 | ); | 86 | ); |
| 87 | let mut spdif_receiver = new_spdif_receiver(&mut p.SPDIFRX1, &mut p.PD7, &mut p.DMA2_CH7, spdifrx_buffer); | 87 | let mut spdif_receiver = new_spdif_receiver( |
| 88 | p.SPDIFRX1.reborrow(), | ||
| 89 | p.PD7.reborrow(), | ||
| 90 | p.DMA2_CH7.reborrow(), | ||
| 91 | spdifrx_buffer, | ||
| 92 | ); | ||
| 88 | spdif_receiver.start(); | 93 | spdif_receiver.start(); |
| 89 | 94 | ||
| 90 | let mut renew_sai = false; | 95 | let mut renew_sai = false; |
| @@ -96,11 +101,11 @@ async fn main(_spawner: Spawner) { | |||
| 96 | trace!("Renew SAI."); | 101 | trace!("Renew SAI."); |
| 97 | drop(sai_transmitter); | 102 | drop(sai_transmitter); |
| 98 | sai_transmitter = new_sai_transmitter( | 103 | sai_transmitter = new_sai_transmitter( |
| 99 | &mut p.SAI4, | 104 | p.SAI4.reborrow(), |
| 100 | &mut p.PD13, | 105 | p.PD13.reborrow(), |
| 101 | &mut p.PC1, | 106 | p.PC1.reborrow(), |
| 102 | &mut p.PD12, | 107 | p.PD12.reborrow(), |
| 103 | &mut p.BDMA_CH0, | 108 | p.BDMA_CH0.reborrow(), |
| 104 | sai_buffer, | 109 | sai_buffer, |
| 105 | ); | 110 | ); |
| 106 | } | 111 | } |
| @@ -111,7 +116,12 @@ async fn main(_spawner: Spawner) { | |||
| 111 | Err(spdifrx::Error::RingbufferError(_)) => { | 116 | Err(spdifrx::Error::RingbufferError(_)) => { |
| 112 | trace!("SPDIFRX ringbuffer error. Renew."); | 117 | trace!("SPDIFRX ringbuffer error. Renew."); |
| 113 | drop(spdif_receiver); | 118 | drop(spdif_receiver); |
| 114 | spdif_receiver = new_spdif_receiver(&mut p.SPDIFRX1, &mut p.PD7, &mut p.DMA2_CH7, spdifrx_buffer); | 119 | spdif_receiver = new_spdif_receiver( |
| 120 | p.SPDIFRX1.reborrow(), | ||
| 121 | p.PD7.reborrow(), | ||
| 122 | p.DMA2_CH7.reborrow(), | ||
| 123 | spdifrx_buffer, | ||
| 124 | ); | ||
| 115 | spdif_receiver.start(); | 125 | spdif_receiver.start(); |
| 116 | continue; | 126 | continue; |
| 117 | } | 127 | } |
diff --git a/examples/stm32h735/Cargo.toml b/examples/stm32h735/Cargo.toml index 1ae6ed253..4d31dedf1 100644 --- a/examples/stm32h735/Cargo.toml +++ b/examples/stm32h735/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h735ig", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } | 8 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h735ig", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } |
| 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 10 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } | 10 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 13 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 14 | 14 | ||
diff --git a/examples/stm32h755cm4/Cargo.toml b/examples/stm32h755cm4/Cargo.toml index e3efa0aa2..7c17bc766 100644 --- a/examples/stm32h755cm4/Cargo.toml +++ b/examples/stm32h755cm4/Cargo.toml | |||
| @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" | |||
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h755zi-cm4", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h755zi-cm4", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } |
| 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } | 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } |
| 15 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 15 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/stm32h755cm7/Cargo.toml b/examples/stm32h755cm7/Cargo.toml index 1f05c71b5..3186929a8 100644 --- a/examples/stm32h755cm7/Cargo.toml +++ b/examples/stm32h755cm7/Cargo.toml | |||
| @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" | |||
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h755zi-cm7", "time-driver-tim3", "exti", "memory-x", "unstable-pac", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h755zi-cm7", "time-driver-tim3", "exti", "memory-x", "unstable-pac", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } |
| 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } | 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } |
| 15 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 15 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/stm32h7b0/Cargo.toml b/examples/stm32h7b0/Cargo.toml index e0db3c0cd..e5f2dfe86 100644 --- a/examples/stm32h7b0/Cargo.toml +++ b/examples/stm32h7b0/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h7b0vb", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } | 8 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h7b0vb", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } |
| 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 10 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } | 10 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } | 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } |
| 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/stm32h7rs/Cargo.toml b/examples/stm32h7rs/Cargo.toml index a47dbe21e..22d59be04 100644 --- a/examples/stm32h7rs/Cargo.toml +++ b/examples/stm32h7rs/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32h743bi to your chip name, if necessary. | 8 | # Change stm32h743bi to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h7s3l8", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32h7s3l8", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "udp", "medium-ethernet", "medium-ip", "proto-ipv4"] } | 13 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "udp", "medium-ethernet", "medium-ip", "proto-ipv4"] } |
| 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index 495c12936..b609110af 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32l4s5vi to your chip name, if necessary. | 8 | # Change stm32l4s5vi to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4r5zi", "memory-x", "time-driver-any", "exti", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4r5zi", "memory-x", "time-driver-any", "exti", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", ] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", ] } |
| 13 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } | 13 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } |
| 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/stm32l4/src/bin/dac.rs b/examples/stm32l4/src/bin/dac.rs index fdbf1d374..50db0e082 100644 --- a/examples/stm32l4/src/bin/dac.rs +++ b/examples/stm32l4/src/bin/dac.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_stm32::dac::{DacCh1, Value}; | 5 | use embassy_stm32::dac::{DacCh1, Value}; |
| 6 | use embassy_stm32::dma::NoDma; | ||
| 7 | use {defmt_rtt as _, panic_probe as _}; | 6 | use {defmt_rtt as _, panic_probe as _}; |
| 8 | 7 | ||
| 9 | #[cortex_m_rt::entry] | 8 | #[cortex_m_rt::entry] |
| @@ -11,7 +10,7 @@ fn main() -> ! { | |||
| 11 | let p = embassy_stm32::init(Default::default()); | 10 | let p = embassy_stm32::init(Default::default()); |
| 12 | info!("Hello World!"); | 11 | info!("Hello World!"); |
| 13 | 12 | ||
| 14 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); | 13 | let mut dac = DacCh1::new_blocking(p.DAC1, p.PA4); |
| 15 | 14 | ||
| 16 | loop { | 15 | loop { |
| 17 | for v in 0..=255 { | 16 | for v in 0..=255 { |
diff --git a/examples/stm32l4/src/bin/dac_dma.rs b/examples/stm32l4/src/bin/dac_dma.rs index d01b016c0..cde24f411 100644 --- a/examples/stm32l4/src/bin/dac_dma.rs +++ b/examples/stm32l4/src/bin/dac_dma.rs | |||
| @@ -4,11 +4,13 @@ | |||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; | 6 | use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; |
| 7 | use embassy_stm32::mode::Async; | ||
| 7 | use embassy_stm32::pac::timer::vals::Mms; | 8 | use embassy_stm32::pac::timer::vals::Mms; |
| 8 | use embassy_stm32::peripherals::{DAC1, DMA1_CH3, DMA1_CH4, TIM6, TIM7}; | 9 | use embassy_stm32::peripherals::{DAC1, TIM6, TIM7}; |
| 9 | use embassy_stm32::rcc::frequency; | 10 | use embassy_stm32::rcc::frequency; |
| 10 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 11 | use embassy_stm32::timer::low_level::Timer; | 12 | use embassy_stm32::timer::low_level::Timer; |
| 13 | use embassy_stm32::Peri; | ||
| 12 | use micromath::F32Ext; | 14 | use micromath::F32Ext; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 16 | ||
| @@ -27,7 +29,7 @@ async fn main(spawner: Spawner) { | |||
| 27 | } | 29 | } |
| 28 | 30 | ||
| 29 | #[embassy_executor::task] | 31 | #[embassy_executor::task] |
| 30 | async fn dac_task1(tim: TIM6, mut dac: DacCh1<'static, DAC1, DMA1_CH3>) { | 32 | async fn dac_task1(tim: Peri<'static, TIM6>, mut dac: DacCh1<'static, DAC1, Async>) { |
| 31 | let data: &[u8; 256] = &calculate_array::<256>(); | 33 | let data: &[u8; 256] = &calculate_array::<256>(); |
| 32 | 34 | ||
| 33 | info!("TIM6 frequency is {}", frequency::<TIM6>()); | 35 | info!("TIM6 frequency is {}", frequency::<TIM6>()); |
| @@ -70,7 +72,7 @@ async fn dac_task1(tim: TIM6, mut dac: DacCh1<'static, DAC1, DMA1_CH3>) { | |||
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | #[embassy_executor::task] | 74 | #[embassy_executor::task] |
| 73 | async fn dac_task2(tim: TIM7, mut dac: DacCh2<'static, DAC1, DMA1_CH4>) { | 75 | async fn dac_task2(tim: Peri<'static, TIM7>, mut dac: DacCh2<'static, DAC1, Async>) { |
| 74 | let data: &[u8; 256] = &calculate_array::<256>(); | 76 | let data: &[u8; 256] = &calculate_array::<256>(); |
| 75 | 77 | ||
| 76 | info!("TIM7 frequency is {}", frequency::<TIM7>()); | 78 | info!("TIM7 frequency is {}", frequency::<TIM7>()); |
diff --git a/examples/stm32l432/Cargo.toml b/examples/stm32l432/Cargo.toml index 71bff8667..e155b3e66 100644 --- a/examples/stm32l432/Cargo.toml +++ b/examples/stm32l432/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32l4s5vi to your chip name, if necessary. | 8 | # Change stm32l4s5vi to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l432kc", "memory-x", "time-driver-any", "exti", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l432kc", "memory-x", "time-driver-any", "exti", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = [ "defmt" ] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = [ "defmt" ] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = [ "task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt" ] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = [ "arch-cortex-m", "executor-thread", "defmt" ] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = [ "defmt", "defmt-timestamp-uptime", "tick-hz-32_768" ] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = [ "defmt", "defmt-timestamp-uptime", "tick-hz-32_768" ] } |
| 13 | defmt = "0.3" | 13 | defmt = "0.3" |
| 14 | defmt-rtt = "0.4" | 14 | defmt-rtt = "0.4" |
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml index 7894abb38..fbf68c890 100644 --- a/examples/stm32l5/Cargo.toml +++ b/examples/stm32l5/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32l552ze to your chip name, if necessary. | 8 | # Change stm32l552ze to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 13 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
| 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } | 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } |
diff --git a/examples/stm32l5/src/bin/stop.rs b/examples/stm32l5/src/bin/stop.rs index 32a736de8..d7a1efea9 100644 --- a/examples/stm32l5/src/bin/stop.rs +++ b/examples/stm32l5/src/bin/stop.rs | |||
| @@ -7,7 +7,7 @@ use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; | |||
| 7 | use embassy_stm32::low_power::Executor; | 7 | use embassy_stm32::low_power::Executor; |
| 8 | use embassy_stm32::rcc::LsConfig; | 8 | use embassy_stm32::rcc::LsConfig; |
| 9 | use embassy_stm32::rtc::{Rtc, RtcConfig}; | 9 | use embassy_stm32::rtc::{Rtc, RtcConfig}; |
| 10 | use embassy_stm32::Config; | 10 | use embassy_stm32::{Config, Peri}; |
| 11 | use embassy_time::Timer; | 11 | use embassy_time::Timer; |
| 12 | use static_cell::StaticCell; | 12 | use static_cell::StaticCell; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -39,7 +39,7 @@ async fn async_main(spawner: Spawner) { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | #[embassy_executor::task] | 41 | #[embassy_executor::task] |
| 42 | async fn blinky(led: AnyPin) -> ! { | 42 | async fn blinky(led: Peri<'static, AnyPin>) -> ! { |
| 43 | let mut led = Output::new(led, Level::Low, Speed::Low); | 43 | let mut led = Output::new(led, Level::Low, Speed::Low); |
| 44 | loop { | 44 | loop { |
| 45 | info!("high"); | 45 | info!("high"); |
diff --git a/examples/stm32u0/src/bin/dac.rs b/examples/stm32u0/src/bin/dac.rs index fdbf1d374..50db0e082 100644 --- a/examples/stm32u0/src/bin/dac.rs +++ b/examples/stm32u0/src/bin/dac.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_stm32::dac::{DacCh1, Value}; | 5 | use embassy_stm32::dac::{DacCh1, Value}; |
| 6 | use embassy_stm32::dma::NoDma; | ||
| 7 | use {defmt_rtt as _, panic_probe as _}; | 6 | use {defmt_rtt as _, panic_probe as _}; |
| 8 | 7 | ||
| 9 | #[cortex_m_rt::entry] | 8 | #[cortex_m_rt::entry] |
| @@ -11,7 +10,7 @@ fn main() -> ! { | |||
| 11 | let p = embassy_stm32::init(Default::default()); | 10 | let p = embassy_stm32::init(Default::default()); |
| 12 | info!("Hello World!"); | 11 | info!("Hello World!"); |
| 13 | 12 | ||
| 14 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); | 13 | let mut dac = DacCh1::new_blocking(p.DAC1, p.PA4); |
| 15 | 14 | ||
| 16 | loop { | 15 | loop { |
| 17 | for v in 0..=255 { | 16 | for v in 0..=255 { |
diff --git a/examples/stm32u5/Cargo.toml b/examples/stm32u5/Cargo.toml index 33e75cf1e..886c5cb2e 100644 --- a/examples/stm32u5/Cargo.toml +++ b/examples/stm32u5/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32u5g9zj to your chip name, if necessary. | 8 | # Change stm32u5g9zj to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32u5g9zj", "time-driver-any", "memory-x" ] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32u5g9zj", "time-driver-any", "memory-x" ] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } | 13 | embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } |
| 14 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 14 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
diff --git a/examples/stm32u5/src/bin/adc.rs b/examples/stm32u5/src/bin/adc.rs index 6ba21cc63..d2aa28087 100644 --- a/examples/stm32u5/src/bin/adc.rs +++ b/examples/stm32u5/src/bin/adc.rs | |||
| @@ -72,7 +72,7 @@ async fn main(_spawner: embassy_executor::Spawner) { | |||
| 72 | let mut measurements = [0u16; 2]; | 72 | let mut measurements = [0u16; 2]; |
| 73 | 73 | ||
| 74 | adc1.read( | 74 | adc1.read( |
| 75 | &mut p.GPDMA1_CH0, | 75 | p.GPDMA1_CH0.reborrow(), |
| 76 | [ | 76 | [ |
| 77 | (&mut degraded11, adc::SampleTime::CYCLES160_5), | 77 | (&mut degraded11, adc::SampleTime::CYCLES160_5), |
| 78 | (&mut degraded12, adc::SampleTime::CYCLES160_5), | 78 | (&mut degraded12, adc::SampleTime::CYCLES160_5), |
| @@ -96,7 +96,7 @@ async fn main(_spawner: embassy_executor::Spawner) { | |||
| 96 | 96 | ||
| 97 | // The channels must be in ascending order and can't repeat for ADC4 | 97 | // The channels must be in ascending order and can't repeat for ADC4 |
| 98 | adc4.read( | 98 | adc4.read( |
| 99 | &mut p.GPDMA1_CH1, | 99 | p.GPDMA1_CH1.reborrow(), |
| 100 | [&mut degraded42, &mut degraded41].into_iter(), | 100 | [&mut degraded42, &mut degraded41].into_iter(), |
| 101 | &mut measurements, | 101 | &mut measurements, |
| 102 | ) | 102 | ) |
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml index e9959b905..96f66f3af 100644 --- a/examples/stm32wb/Cargo.toml +++ b/examples/stm32wb/Cargo.toml | |||
| @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" | |||
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] } |
| 10 | embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", features = ["defmt", "stm32wb55rg"] } | 10 | embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", features = ["defmt", "stm32wb55rg"] } |
| 11 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 11 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true } | 14 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true } |
| 15 | 15 | ||
diff --git a/examples/stm32wba/Cargo.toml b/examples/stm32wba/Cargo.toml index 0f55bee39..60b09adb4 100644 --- a/examples/stm32wba/Cargo.toml +++ b/examples/stm32wba/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wba55cg", "time-driver-any", "memory-x", "exti"] } | 8 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wba55cg", "time-driver-any", "memory-x", "exti"] } |
| 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } | 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 12 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true } | 12 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true } |
| 13 | 13 | ||
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml index 194e58459..6b677914e 100644 --- a/examples/stm32wl/Cargo.toml +++ b/examples/stm32wl/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32wl55jc-cm4 to your chip name, if necessary. | 8 | # Change stm32wl55jc-cm4 to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "unstable-pac", "exti", "chrono"] } | 9 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "unstable-pac", "exti", "chrono"] } |
| 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-4096", "arch-cortex-m", "executor-thread", "defmt"] } | 11 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } |
| 13 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } | 13 | embassy-embedded-hal = { version = "0.3.0", path = "../../embassy-embedded-hal" } |
| 14 | 14 | ||
