aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDion Dokter <[email protected]>2024-08-05 11:21:21 +0200
committerDion Dokter <[email protected]>2024-08-05 11:21:21 +0200
commitab4d378dda5a74834dcc1fc0c872824f4a616911 (patch)
treed79824af61988c9adae883fa04e40b7b74e112a9
parent2a7fe16ceb53aca38f73ac01a923ea445654673c (diff)
parent0f685761e09b1617e435de4e50986fe9a548502e (diff)
Merge branch 'master' into stm-dualcore
-rwxr-xr-xci.sh17
-rw-r--r--cyw43-pio/Cargo.toml2
-rw-r--r--cyw43/Cargo.toml4
-rw-r--r--cyw43/src/control.rs2
-rw-r--r--cyw43/src/fmt.rs16
-rw-r--r--cyw43/src/lib.rs2
-rw-r--r--docs/examples/basic/Cargo.toml6
-rw-r--r--docs/examples/layer-by-layer/blinky-async/Cargo.toml2
-rw-r--r--docs/pages/basic_application.adoc2
-rw-r--r--docs/pages/faq.adoc7
-rw-r--r--docs/pages/new_project.adoc2
-rw-r--r--docs/pages/nrf.adoc2
-rw-r--r--docs/pages/overview.adoc2
-rw-r--r--docs/pages/sharing_peripherals.adoc10
-rw-r--r--docs/pages/stm32.adoc2
-rw-r--r--docs/pages/time_keeping.adoc4
-rw-r--r--embassy-boot-nrf/Cargo.toml6
-rw-r--r--embassy-boot-nrf/src/fmt.rs16
-rw-r--r--embassy-boot-rp/Cargo.toml8
-rw-r--r--embassy-boot-rp/src/fmt.rs16
-rw-r--r--embassy-boot-stm32/Cargo.toml2
-rw-r--r--embassy-boot-stm32/src/fmt.rs16
-rw-r--r--embassy-boot/Cargo.toml4
-rw-r--r--embassy-boot/src/boot_loader.rs8
-rw-r--r--embassy-boot/src/fmt.rs16
-rw-r--r--embassy-embedded-hal/CHANGELOG.md21
-rw-r--r--embassy-embedded-hal/Cargo.toml4
-rw-r--r--embassy-embedded-hal/src/flash/partition/asynch.rs10
-rw-r--r--embassy-embedded-hal/src/flash/partition/blocking.rs10
-rw-r--r--embassy-executor-macros/Cargo.toml2
-rw-r--r--embassy-executor-macros/src/macros/main.rs2
-rw-r--r--embassy-executor/CHANGELOG.md6
-rw-r--r--embassy-executor/Cargo.toml4
-rw-r--r--embassy-executor/build_common.rs21
-rw-r--r--embassy-executor/src/fmt.rs16
-rw-r--r--embassy-futures/src/fmt.rs16
-rw-r--r--embassy-hal-internal/Cargo.toml2
-rw-r--r--embassy-hal-internal/build_common.rs21
-rw-r--r--embassy-hal-internal/src/fmt.rs16
-rw-r--r--embassy-net-adin1110/Cargo.toml4
-rw-r--r--embassy-net-adin1110/README.md2
-rw-r--r--embassy-net-adin1110/src/crc8.rs2
-rw-r--r--embassy-net-adin1110/src/fmt.rs16
-rw-r--r--embassy-net-driver-channel/CHANGELOG.md7
-rw-r--r--embassy-net-driver-channel/Cargo.toml2
-rw-r--r--embassy-net-driver-channel/src/fmt.rs16
-rw-r--r--embassy-net-enc28j60/Cargo.toml2
-rw-r--r--embassy-net-enc28j60/src/fmt.rs16
-rw-r--r--embassy-net-esp-hosted/Cargo.toml4
-rw-r--r--embassy-net-esp-hosted/src/fmt.rs16
-rw-r--r--embassy-net-ppp/Cargo.toml2
-rw-r--r--embassy-net-ppp/src/fmt.rs16
-rw-r--r--embassy-net-wiznet/Cargo.toml4
-rw-r--r--embassy-net/Cargo.toml2
-rw-r--r--embassy-net/src/fmt.rs16
-rw-r--r--embassy-net/src/lib.rs18
-rw-r--r--embassy-net/src/tcp.rs16
-rw-r--r--embassy-nrf/CHANGELOG.md48
-rw-r--r--embassy-nrf/Cargo.toml25
-rw-r--r--embassy-nrf/src/buffered_uarte.rs18
-rw-r--r--embassy-nrf/src/chips/nrf9120.rs430
-rw-r--r--embassy-nrf/src/fmt.rs16
-rw-r--r--embassy-nrf/src/gpiote.rs12
-rw-r--r--embassy-nrf/src/lib.rs69
-rw-r--r--embassy-nrf/src/nvmc.rs8
-rw-r--r--embassy-nrf/src/pdm.rs8
-rw-r--r--embassy-nrf/src/saadc.rs4
-rw-r--r--embassy-nrf/src/wdt.rs8
-rw-r--r--embassy-rp/CHANGELOG.md32
-rw-r--r--embassy-rp/Cargo.toml10
-rw-r--r--embassy-rp/README.md2
-rw-r--r--embassy-rp/src/bootsel.rs4
-rw-r--r--embassy-rp/src/flash.rs12
-rw-r--r--embassy-rp/src/fmt.rs16
-rw-r--r--embassy-rp/src/i2c.rs18
-rw-r--r--embassy-rp/src/uart/buffered.rs34
-rw-r--r--embassy-rp/src/uart/mod.rs318
-rw-r--r--embassy-stm32-wpan/Cargo.toml6
-rw-r--r--embassy-stm32-wpan/src/fmt.rs16
-rw-r--r--embassy-stm32/Cargo.toml8
-rw-r--r--embassy-stm32/build_common.rs21
-rw-r--r--embassy-stm32/src/adc/mod.rs1
-rw-r--r--embassy-stm32/src/flash/f1f3.rs4
-rw-r--r--embassy-stm32/src/fmc.rs40
-rw-r--r--embassy-stm32/src/fmt.rs16
-rw-r--r--embassy-stm32/src/hsem/mod.rs5
-rw-r--r--embassy-stm32/src/opamp.rs18
-rw-r--r--embassy-stm32/src/ospi/mod.rs17
-rw-r--r--embassy-stm32/src/sdmmc/mod.rs86
-rw-r--r--embassy-stm32/src/spi/mod.rs1
-rw-r--r--embassy-stm32/src/tsc/mod.rs4
-rw-r--r--embassy-stm32/src/usart/buffered.rs18
-rw-r--r--embassy-sync/CHANGELOG.md2
-rw-r--r--embassy-sync/README.md1
-rw-r--r--embassy-sync/build_common.rs21
-rw-r--r--embassy-sync/src/fmt.rs16
-rw-r--r--embassy-sync/src/lazy_lock.rs152
-rw-r--r--embassy-sync/src/lib.rs1
-rw-r--r--embassy-time/CHANGELOG.md7
-rw-r--r--embassy-time/Cargo.toml4
-rw-r--r--embassy-time/src/fmt.rs16
-rw-r--r--embassy-usb-dfu/Cargo.toml6
-rw-r--r--embassy-usb-dfu/src/fmt.rs16
-rw-r--r--embassy-usb-logger/Cargo.toml2
-rw-r--r--embassy-usb-synopsys-otg/src/fmt.rs16
-rw-r--r--embassy-usb-synopsys-otg/src/lib.rs4
-rw-r--r--embassy-usb/CHANGELOG.md6
-rw-r--r--embassy-usb/Cargo.toml6
-rw-r--r--embassy-usb/src/fmt.rs16
-rw-r--r--embassy-usb/src/msos.rs2
-rw-r--r--examples/boot/application/nrf/Cargo.toml12
-rw-r--r--examples/boot/application/rp/Cargo.toml10
-rw-r--r--examples/boot/application/stm32f3/Cargo.toml6
-rw-r--r--examples/boot/application/stm32f7/Cargo.toml6
-rw-r--r--examples/boot/application/stm32h7/Cargo.toml6
-rw-r--r--examples/boot/application/stm32l0/Cargo.toml6
-rw-r--r--examples/boot/application/stm32l1/Cargo.toml6
-rw-r--r--examples/boot/application/stm32l4/Cargo.toml6
-rw-r--r--examples/boot/application/stm32wb-dfu/Cargo.toml8
-rw-r--r--examples/boot/application/stm32wl/Cargo.toml6
-rw-r--r--examples/boot/bootloader/rp/memory.x2
-rw-r--r--examples/boot/bootloader/stm32wb-dfu/Cargo.toml2
-rw-r--r--examples/nrf-rtos-trace/Cargo.toml6
-rw-r--r--examples/nrf51/Cargo.toml6
-rw-r--r--examples/nrf52810/Cargo.toml6
-rw-r--r--examples/nrf52840-rtic/Cargo.toml4
-rw-r--r--examples/nrf52840/Cargo.toml10
-rw-r--r--examples/nrf5340/Cargo.toml10
-rw-r--r--examples/nrf9151/ns/.cargo/config.toml9
-rw-r--r--examples/nrf9151/ns/Cargo.toml20
-rw-r--r--examples/nrf9151/ns/README.md4
-rw-r--r--examples/nrf9151/ns/build.rs35
-rw-r--r--examples/nrf9151/ns/flash_tfm.sh2
-rw-r--r--examples/nrf9151/ns/memory.x7
-rw-r--r--examples/nrf9151/ns/src/bin/blinky.rs22
-rw-r--r--examples/nrf9151/ns/src/bin/uart.rs37
-rw-r--r--examples/nrf9151/ns/tfm.hex1543
-rw-r--r--examples/nrf9151/s/.cargo/config.toml8
-rw-r--r--examples/nrf9151/s/Cargo.toml20
-rw-r--r--examples/nrf9151/s/build.rs35
-rw-r--r--examples/nrf9151/s/memory.x5
-rw-r--r--examples/nrf9151/s/src/bin/blinky.rs22
-rw-r--r--examples/nrf9160/.cargo/config.toml1
-rw-r--r--examples/nrf9160/Cargo.toml6
-rw-r--r--examples/rp/Cargo.toml15
-rw-r--r--examples/rp/src/bin/assign_resources.rs79
-rw-r--r--examples/rp/src/bin/shared_bus.rs115
-rw-r--r--examples/rp/src/bin/sharing.rs150
-rw-r--r--examples/rp/src/bin/uart_buffered_split.rs2
-rw-r--r--examples/std/Cargo.toml4
-rw-r--r--examples/stm32c0/Cargo.toml4
-rw-r--r--examples/stm32f0/Cargo.toml4
-rw-r--r--examples/stm32f1/Cargo.toml6
-rw-r--r--examples/stm32f2/Cargo.toml4
-rw-r--r--examples/stm32f3/Cargo.toml6
-rw-r--r--examples/stm32f3/src/bin/blocking-tsc.rs98
-rw-r--r--examples/stm32f334/Cargo.toml6
-rw-r--r--examples/stm32f4/Cargo.toml8
-rw-r--r--examples/stm32f469/Cargo.toml4
-rw-r--r--examples/stm32f7/Cargo.toml6
-rw-r--r--examples/stm32g0/Cargo.toml6
-rw-r--r--examples/stm32g4/Cargo.toml8
-rw-r--r--examples/stm32h5/Cargo.toml6
-rw-r--r--examples/stm32h7/Cargo.toml8
-rw-r--r--examples/stm32h735/Cargo.toml6
-rw-r--r--examples/stm32h7rs/Cargo.toml6
-rw-r--r--examples/stm32l0/Cargo.toml4
-rw-r--r--examples/stm32l0/src/bin/async-tsc.rs122
-rw-r--r--examples/stm32l0/src/bin/blocking-tsc.rs116
-rw-r--r--examples/stm32l1/Cargo.toml6
-rw-r--r--examples/stm32l4/Cargo.toml8
-rw-r--r--examples/stm32l5/Cargo.toml8
-rw-r--r--examples/stm32u0/Cargo.toml6
-rw-r--r--examples/stm32u5/Cargo.toml6
-rw-r--r--examples/stm32wb/Cargo.toml4
-rw-r--r--examples/stm32wba/Cargo.toml4
-rw-r--r--examples/stm32wl/Cargo.toml6
-rw-r--r--examples/wasm/Cargo.toml4
-rw-r--r--rust-toolchain-nightly.toml2
-rw-r--r--rust-toolchain.toml2
-rw-r--r--tests/nrf/Cargo.toml6
-rw-r--r--tests/perf-client/Cargo.toml2
-rw-r--r--tests/riscv32/Cargo.toml4
-rw-r--r--tests/rp/Cargo.toml8
-rw-r--r--tests/rp/src/bin/timer.rs25
-rw-r--r--tests/stm32/Cargo.toml4
186 files changed, 4142 insertions, 783 deletions
diff --git a/ci.sh b/ci.sh
index 8ac9e1ccd..4c9397cee 100755
--- a/ci.sh
+++ b/ci.sh
@@ -2,11 +2,13 @@
2 2
3set -eo pipefail 3set -eo pipefail
4 4
5# check-cfg is stable on rustc 1.79 but not cargo 1.79. 5if ! command -v cargo-batch &> /dev/null; then
6# however, our cargo-batch is currently based on cargo 1.80, which does support check-cfg. 6 echo "cargo-batch could not be found. Install it with the following command:"
7# so, force build.rs scripts to emit check-cfg commands. 7 echo ""
8# when 1.80 hits stable we can make build.rs unconditionally emit check-cfg and remove all this. 8 echo " cargo install --git https://github.com/embassy-rs/cargo-batch cargo --bin cargo-batch --locked"
9export EMBASSY_FORCE_CHECK_CFG=1 9 echo ""
10 exit 1
11fi
10 12
11export RUSTFLAGS=-Dwarnings 13export RUSTFLAGS=-Dwarnings
12export DEFMT_LOG=trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info 14export DEFMT_LOG=trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info
@@ -175,6 +177,7 @@ cargo batch \
175 --- build --release --manifest-path cyw43-pio/Cargo.toml --target thumbv6m-none-eabi --features 'overclock' \ 177 --- build --release --manifest-path cyw43-pio/Cargo.toml --target thumbv6m-none-eabi --features 'overclock' \
176 --- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ 178 --- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
177 --- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \ 179 --- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \
180 --- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9120-ns \
178 --- build --release --manifest-path embassy-boot-rp/Cargo.toml --target thumbv6m-none-eabi \ 181 --- build --release --manifest-path embassy-boot-rp/Cargo.toml --target thumbv6m-none-eabi \
179 --- build --release --manifest-path embassy-boot-stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \ 182 --- build --release --manifest-path embassy-boot-stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \
180 --- build --release --manifest-path docs/examples/basic/Cargo.toml --target thumbv7em-none-eabi \ 183 --- build --release --manifest-path docs/examples/basic/Cargo.toml --target thumbv7em-none-eabi \
@@ -186,6 +189,8 @@ cargo batch \
186 --- build --release --manifest-path examples/nrf52840/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/nrf52840 \ 189 --- build --release --manifest-path examples/nrf52840/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/nrf52840 \
187 --- build --release --manifest-path examples/nrf5340/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf5340 \ 190 --- build --release --manifest-path examples/nrf5340/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf5340 \
188 --- build --release --manifest-path examples/nrf9160/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9160 \ 191 --- build --release --manifest-path examples/nrf9160/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9160 \
192 --- build --release --manifest-path examples/nrf9151/s/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9151/s \
193 --- build --release --manifest-path examples/nrf9151/ns/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9151/ns \
189 --- build --release --manifest-path examples/nrf51/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/nrf51 \ 194 --- build --release --manifest-path examples/nrf51/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/nrf51 \
190 --- build --release --manifest-path examples/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/rp \ 195 --- build --release --manifest-path examples/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/rp \
191 --- build --release --manifest-path examples/stm32f0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32f0 \ 196 --- build --release --manifest-path examples/stm32f0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32f0 \
@@ -214,6 +219,7 @@ cargo batch \
214 --- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32wl \ 219 --- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32wl \
215 --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840,skip-include --out-dir out/examples/boot/nrf52840 \ 220 --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840,skip-include --out-dir out/examples/boot/nrf52840 \
216 --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns,skip-include --out-dir out/examples/boot/nrf9160 \ 221 --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns,skip-include --out-dir out/examples/boot/nrf9160 \
222 --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9120-ns,skip-include --out-dir out/examples/boot/nrf9120 \
217 --- build --release --manifest-path examples/boot/application/rp/Cargo.toml --target thumbv6m-none-eabi --features skip-include --out-dir out/examples/boot/rp \ 223 --- build --release --manifest-path examples/boot/application/rp/Cargo.toml --target thumbv6m-none-eabi --features skip-include --out-dir out/examples/boot/rp \
218 --- build --release --manifest-path examples/boot/application/stm32f3/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f3 \ 224 --- build --release --manifest-path examples/boot/application/stm32f3/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f3 \
219 --- build --release --manifest-path examples/boot/application/stm32f7/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f7 \ 225 --- build --release --manifest-path examples/boot/application/stm32f7/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f7 \
@@ -225,6 +231,7 @@ cargo batch \
225 --- build --release --manifest-path examples/boot/application/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32wb-dfu \ 231 --- build --release --manifest-path examples/boot/application/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32wb-dfu \
226 --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ 232 --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
227 --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \ 233 --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \
234 --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9120-ns \
228 --- build --release --manifest-path examples/boot/bootloader/rp/Cargo.toml --target thumbv6m-none-eabi \ 235 --- build --release --manifest-path examples/boot/bootloader/rp/Cargo.toml --target thumbv6m-none-eabi \
229 --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \ 236 --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \
230 --- build --release --manifest-path examples/boot/bootloader/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wb55rg \ 237 --- build --release --manifest-path examples/boot/bootloader/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wb55rg \
diff --git a/cyw43-pio/Cargo.toml b/cyw43-pio/Cargo.toml
index 157046b18..9c7acd779 100644
--- a/cyw43-pio/Cargo.toml
+++ b/cyw43-pio/Cargo.toml
@@ -16,7 +16,7 @@ overclock = []
16 16
17[dependencies] 17[dependencies]
18cyw43 = { version = "0.1.0", path = "../cyw43" } 18cyw43 = { version = "0.1.0", path = "../cyw43" }
19embassy-rp = { version = "0.1.0", path = "../embassy-rp" } 19embassy-rp = { version = "0.2.0", path = "../embassy-rp" }
20pio-proc = "0.2" 20pio-proc = "0.2"
21pio = "0.2.1" 21pio = "0.2.1"
22fixed = "1.23.1" 22fixed = "1.23.1"
diff --git a/cyw43/Cargo.toml b/cyw43/Cargo.toml
index c613698c1..3c90873de 100644
--- a/cyw43/Cargo.toml
+++ b/cyw43/Cargo.toml
@@ -17,10 +17,10 @@ log = ["dep:log"]
17firmware-logs = [] 17firmware-logs = []
18 18
19[dependencies] 19[dependencies]
20embassy-time = { version = "0.3.1", path = "../embassy-time"} 20embassy-time = { version = "0.3.2", path = "../embassy-time"}
21embassy-sync = { version = "0.6.0", path = "../embassy-sync"} 21embassy-sync = { version = "0.6.0", path = "../embassy-sync"}
22embassy-futures = { version = "0.1.0", path = "../embassy-futures"} 22embassy-futures = { version = "0.1.0", path = "../embassy-futures"}
23embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel"} 23embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel"}
24 24
25defmt = { version = "0.3", optional = true } 25defmt = { version = "0.3", optional = true }
26log = { version = "0.4.17", optional = true } 26log = { version = "0.4.17", optional = true }
diff --git a/cyw43/src/control.rs b/cyw43/src/control.rs
index 8944865c1..f0f179e2e 100644
--- a/cyw43/src/control.rs
+++ b/cyw43/src/control.rs
@@ -42,9 +42,11 @@ pub enum ScanType {
42 Passive, 42 Passive,
43} 43}
44 44
45/// Scan options.
45#[derive(Clone)] 46#[derive(Clone)]
46#[cfg_attr(feature = "defmt", derive(defmt::Format))] 47#[cfg_attr(feature = "defmt", derive(defmt::Format))]
47pub struct ScanOptions { 48pub struct ScanOptions {
49 /// SSID to scan for.
48 pub ssid: Option<heapless::String<32>>, 50 pub ssid: Option<heapless::String<32>>,
49 /// If set to `None`, all APs will be returned. If set to `Some`, only APs 51 /// If set to `None`, all APs will be returned. If set to `Some`, only APs
50 /// with the specified BSSID will be returned. 52 /// with the specified BSSID will be returned.
diff --git a/cyw43/src/fmt.rs b/cyw43/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/cyw43/src/fmt.rs
+++ b/cyw43/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/cyw43/src/lib.rs b/cyw43/src/lib.rs
index 19b0cb194..7c8f35da7 100644
--- a/cyw43/src/lib.rs
+++ b/cyw43/src/lib.rs
@@ -28,7 +28,7 @@ use ioctl::IoctlState;
28 28
29use crate::bus::Bus; 29use crate::bus::Bus;
30pub use crate::bus::SpiBusCyw43; 30pub use crate::bus::SpiBusCyw43;
31pub use crate::control::{AddMulticastAddressError, Control, Error as ControlError, Scanner}; 31pub use crate::control::{AddMulticastAddressError, Control, Error as ControlError, ScanOptions, Scanner};
32pub use crate::runner::Runner; 32pub use crate::runner::Runner;
33pub use crate::structs::BssInfo; 33pub use crate::structs::BssInfo;
34 34
diff --git a/docs/examples/basic/Cargo.toml b/docs/examples/basic/Cargo.toml
index e82165032..5d391adf3 100644
--- a/docs/examples/basic/Cargo.toml
+++ b/docs/examples/basic/Cargo.toml
@@ -6,9 +6,9 @@ version = "0.1.0"
6license = "MIT OR Apache-2.0" 6license = "MIT OR Apache-2.0"
7 7
8[dependencies] 8[dependencies]
9embassy-executor = { version = "0.5.0", path = "../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] } 9embassy-executor = { version = "0.6.0", path = "../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] }
10embassy-time = { version = "0.3.1", path = "../../../embassy-time", features = ["defmt"] } 10embassy-time = { version = "0.3.2", path = "../../../embassy-time", features = ["defmt"] }
11embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } 11embassy-nrf = { version = "0.2.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
12 12
13defmt = "0.3" 13defmt = "0.3"
14defmt-rtt = "0.3" 14defmt-rtt = "0.3"
diff --git a/docs/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
index 64f7e8403..7f8d8af3e 100644
--- a/docs/examples/layer-by-layer/blinky-async/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
8cortex-m = "0.7" 8cortex-m = "0.7"
9cortex-m-rt = "0.7" 9cortex-m-rt = "0.7"
10embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] } 10embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] }
11embassy-executor = { version = "0.5.0", features = ["arch-cortex-m", "executor-thread"] } 11embassy-executor = { version = "0.6.0", features = ["arch-cortex-m", "executor-thread"] }
12 12
13defmt = "0.3.0" 13defmt = "0.3.0"
14defmt-rtt = "0.3.0" 14defmt-rtt = "0.3.0"
diff --git a/docs/pages/basic_application.adoc b/docs/pages/basic_application.adoc
index 7b4ebda4f..5c4e3e8b3 100644
--- a/docs/pages/basic_application.adoc
+++ b/docs/pages/basic_application.adoc
@@ -4,7 +4,7 @@ So you've got one of the examples running, but what now? Let's go through a simp
4 4
5== Main 5== Main
6 6
7The full example can be found link:https://github.com/embassy-rs/embassy/tree/master/docs/examples/basic[here]. 7The full example can be found link:https://github.com/embassy-rs/embassy/tree/main/docs/examples/basic[here].
8 8
9NOTE: If you’re using VS Code and rust-analyzer to view and edit the examples, you may need to make some changes to `.vscode/settings.json` to tell it which project we’re working on. Follow the instructions commented in that file to get rust-analyzer working correctly. 9NOTE: If you’re using VS Code and rust-analyzer to view and edit the examples, you may need to make some changes to `.vscode/settings.json` to tell it which project we’re working on. Follow the instructions commented in that file to get rust-analyzer working correctly.
10 10
diff --git a/docs/pages/faq.adoc b/docs/pages/faq.adoc
index a2f56a539..4ab04e2a1 100644
--- a/docs/pages/faq.adoc
+++ b/docs/pages/faq.adoc
@@ -352,8 +352,13 @@ There are two main ways to handle concurrency in Embassy:
352 352
353In general, either of these approaches will work. The main differences of these approaches are: 353In general, either of these approaches will work. The main differences of these approaches are:
354 354
355When using **separate tasks**, each task needs its own RAM allocation, so there's a little overhead for each task, so one task that does three things will likely be a little bit smaller than three tasks that do one thing (not a lot, probably a couple dozen bytes). In contrast, with **multiple futures in one task**, you don't need multiple task allocations, and it will generally be easier to share data, or use borrowed resources, inside of a single task. 355When using **separate tasks**, each task needs its own RAM allocation, so there's a little overhead for each task, so one task that does three things will likely be a little bit smaller than three tasks that do one thing (not a lot, probably a couple dozen bytes). In contrast, with **multiple futures in one task**, you don't need multiple task allocations, and it will generally be easier to share data, or use borrowed resources, inside of a single task.
356An example showcasing some methods for sharing things between tasks link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here].
356 357
357But when it comes to "waking" tasks, for example when a data transfer is complete or a button is pressed, it's faster to wake a dedicated task, because that task does not need to check which future is actually ready. `join` and `select` must check ALL of the futures they are managing to see which one (or which ones) are ready to do more work. This is because all Rust executors (like Embassy or Tokio) only have the ability to wake tasks, not specific futures. This means you will use slightly less CPU time juggling futures when using dedicated tasks. 358But when it comes to "waking" tasks, for example when a data transfer is complete or a button is pressed, it's faster to wake a dedicated task, because that task does not need to check which future is actually ready. `join` and `select` must check ALL of the futures they are managing to see which one (or which ones) are ready to do more work. This is because all Rust executors (like Embassy or Tokio) only have the ability to wake tasks, not specific futures. This means you will use slightly less CPU time juggling futures when using dedicated tasks.
358 359
359Practically, there's not a LOT of difference either way - so go with what makes it easier for you and your code first, but there will be some details that are slightly different in each case. 360Practically, there's not a LOT of difference either way - so go with what makes it easier for you and your code first, but there will be some details that are slightly different in each case.
361
362== splitting peripherals resources between tasks
363
364There are two ways to split resources between tasks, either manually assigned or by a convenient macro. See link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/assign_resources.rs[this example] \ No newline at end of file
diff --git a/docs/pages/new_project.adoc b/docs/pages/new_project.adoc
index 346d9f0f8..821bcbd27 100644
--- a/docs/pages/new_project.adoc
+++ b/docs/pages/new_project.adoc
@@ -1,6 +1,6 @@
1= Starting a new project 1= Starting a new project
2 2
3Once you’ve successfully xref:getting_started.adoc[run some example projects], the next step is to make a standalone Embassy project. 3Once you’ve successfully xref:#_getting_started[run some example projects], the next step is to make a standalone Embassy project.
4 4
5== Tools for generating Embassy projects 5== Tools for generating Embassy projects
6 6
diff --git a/docs/pages/nrf.adoc b/docs/pages/nrf.adoc
index 1706087ae..de052b63f 100644
--- a/docs/pages/nrf.adoc
+++ b/docs/pages/nrf.adoc
@@ -1,6 +1,6 @@
1= Embassy nRF HAL 1= Embassy nRF HAL
2 2
3The link:https://github.com/embassy-rs/embassy/tree/master/embassy-nrf[Embassy nRF HAL] is based on the PACs (Peripheral Access Crate) from link:https://github.com/nrf-rs/[nrf-rs]. 3The link:https://github.com/embassy-rs/embassy/tree/main/embassy-nrf[Embassy nRF HAL] is based on the PACs (Peripheral Access Crate) from link:https://github.com/nrf-rs/[nrf-rs].
4 4
5== Timer driver 5== Timer driver
6 6
diff --git a/docs/pages/overview.adoc b/docs/pages/overview.adoc
index 1b9381bfe..7d59d5521 100644
--- a/docs/pages/overview.adoc
+++ b/docs/pages/overview.adoc
@@ -48,7 +48,7 @@ link:https://github.com/lora-rs/lora-rs[lora-rs] supports LoRa networking on a w
48link:https://docs.embassy.dev/embassy-usb/[embassy-usb] implements a device-side USB stack. Implementations for common classes such as USB serial (CDC ACM) and USB HID are available, and a rich builder API allows building your own. 48link:https://docs.embassy.dev/embassy-usb/[embassy-usb] implements a device-side USB stack. Implementations for common classes such as USB serial (CDC ACM) and USB HID are available, and a rich builder API allows building your own.
49 49
50=== Bootloader and DFU 50=== Bootloader and DFU
51link:https://github.com/embassy-rs/embassy/tree/master/embassy-boot[embassy-boot] is a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks. 51link:https://github.com/embassy-rs/embassy/tree/main/embassy-boot[embassy-boot] is a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks.
52 52
53== What is DMA? 53== What is DMA?
54 54
diff --git a/docs/pages/sharing_peripherals.adoc b/docs/pages/sharing_peripherals.adoc
index 6bcd56b01..dfb8c1ffe 100644
--- a/docs/pages/sharing_peripherals.adoc
+++ b/docs/pages/sharing_peripherals.adoc
@@ -8,7 +8,7 @@ The following examples shows different ways to use the on-board LED on a Raspber
8 8
9Using mutual exclusion is the simplest way to share a peripheral. 9Using mutual exclusion is the simplest way to share a peripheral.
10 10
11TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. 11TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
12[,rust] 12[,rust]
13---- 13----
14use defmt::*; 14use defmt::*;
@@ -78,7 +78,7 @@ To indicate that the pin will be set to an Output. The `AnyPin` could have been
78 78
79A channel is another way to ensure exclusive access to a resource. Using a channel is great in the cases where the access can happen at a later point in time, allowing you to enqueue operations and do other things. 79A channel is another way to ensure exclusive access to a resource. Using a channel is great in the cases where the access can happen at a later point in time, allowing you to enqueue operations and do other things.
80 80
81TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. 81TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
82[,rust] 82[,rust]
83---- 83----
84use defmt::*; 84use defmt::*;
@@ -126,3 +126,9 @@ async fn toggle_led(control: Sender<'static, ThreadModeRawMutex, LedState, 64>,
126 126
127This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure 127This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure
128that the operation is completed before continuing to do other work in your task. 128that the operation is completed before continuing to do other work in your task.
129
130An example showcasing more methods for sharing link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here].
131
132== Sharing an I2C or SPI bus between multiple devices
133
134An example of how to deal with multiple devices sharing a common I2C or SPI bus link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/shared_bus.rs[can be found here].
diff --git a/docs/pages/stm32.adoc b/docs/pages/stm32.adoc
index 7bfc0592b..df139a420 100644
--- a/docs/pages/stm32.adoc
+++ b/docs/pages/stm32.adoc
@@ -1,6 +1,6 @@
1= Embassy STM32 HAL 1= Embassy STM32 HAL
2 2
3The link:https://github.com/embassy-rs/embassy/tree/master/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project. 3The link:https://github.com/embassy-rs/embassy/tree/main/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project.
4 4
5== The infinite variant problem 5== The infinite variant problem
6 6
diff --git a/docs/pages/time_keeping.adoc b/docs/pages/time_keeping.adoc
index 17492a884..11ddb2b2b 100644
--- a/docs/pages/time_keeping.adoc
+++ b/docs/pages/time_keeping.adoc
@@ -16,7 +16,7 @@ The `embassy::time::Timer` type provides two timing methods.
16 16
17An example of a delay is provided as follows: 17An example of a delay is provided as follows:
18 18
19TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. 19TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
20[,rust] 20[,rust]
21---- 21----
22use embassy::executor::{task, Executor}; 22use embassy::executor::{task, Executor};
@@ -41,7 +41,7 @@ that expect a generic delay implementation to be provided.
41 41
42An example of how this can be used: 42An example of how this can be used:
43 43
44TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here]. 44TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
45[,rust] 45[,rust]
46---- 46----
47use embassy::executor::{task, Executor}; 47use embassy::executor::{task, Executor};
diff --git a/embassy-boot-nrf/Cargo.toml b/embassy-boot-nrf/Cargo.toml
index 86bfc21f4..27407ae92 100644
--- a/embassy-boot-nrf/Cargo.toml
+++ b/embassy-boot-nrf/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-nrf" 3name = "embassy-boot-nrf"
4version = "0.2.0" 4version = "0.3.0"
5description = "Bootloader lib for nRF chips" 5description = "Bootloader lib for nRF chips"
6license = "MIT OR Apache-2.0" 6license = "MIT OR Apache-2.0"
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
@@ -25,8 +25,8 @@ defmt = { version = "0.3", optional = true }
25log = { version = "0.4.17", optional = true } 25log = { version = "0.4.17", optional = true }
26 26
27embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 27embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
28embassy-nrf = { version = "0.1.0", path = "../embassy-nrf", default-features = false } 28embassy-nrf = { version = "0.2.0", path = "../embassy-nrf", default-features = false }
29embassy-boot = { version = "0.2.0", path = "../embassy-boot" } 29embassy-boot = { version = "0.3.0", path = "../embassy-boot" }
30cortex-m = { version = "0.7.6" } 30cortex-m = { version = "0.7.6" }
31cortex-m-rt = { version = "0.7" } 31cortex-m-rt = { version = "0.7" }
32embedded-storage = "0.3.1" 32embedded-storage = "0.3.1"
diff --git a/embassy-boot-nrf/src/fmt.rs b/embassy-boot-nrf/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-boot-nrf/src/fmt.rs
+++ b/embassy-boot-nrf/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-boot-rp/Cargo.toml b/embassy-boot-rp/Cargo.toml
index 23a8bb549..5b173638e 100644
--- a/embassy-boot-rp/Cargo.toml
+++ b/embassy-boot-rp/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-rp" 3name = "embassy-boot-rp"
4version = "0.2.0" 4version = "0.3.0"
5description = "Bootloader lib for RP2040 chips" 5description = "Bootloader lib for RP2040 chips"
6license = "MIT OR Apache-2.0" 6license = "MIT OR Apache-2.0"
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
@@ -24,9 +24,9 @@ defmt = { version = "0.3", optional = true }
24log = { version = "0.4", optional = true } 24log = { version = "0.4", optional = true }
25 25
26embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 26embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
27embassy-rp = { version = "0.1.0", path = "../embassy-rp", default-features = false } 27embassy-rp = { version = "0.2.0", path = "../embassy-rp", default-features = false }
28embassy-boot = { version = "0.2.0", path = "../embassy-boot" } 28embassy-boot = { version = "0.3.0", path = "../embassy-boot" }
29embassy-time = { version = "0.3.1", path = "../embassy-time" } 29embassy-time = { version = "0.3.2", path = "../embassy-time" }
30 30
31cortex-m = { version = "0.7.6" } 31cortex-m = { version = "0.7.6" }
32cortex-m-rt = { version = "0.7" } 32cortex-m-rt = { version = "0.7" }
diff --git a/embassy-boot-rp/src/fmt.rs b/embassy-boot-rp/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-boot-rp/src/fmt.rs
+++ b/embassy-boot-rp/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-boot-stm32/Cargo.toml b/embassy-boot-stm32/Cargo.toml
index 52ad1b463..e4ef9a612 100644
--- a/embassy-boot-stm32/Cargo.toml
+++ b/embassy-boot-stm32/Cargo.toml
@@ -26,7 +26,7 @@ log = { version = "0.4", optional = true }
26 26
27embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 27embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
28embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false } 28embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false }
29embassy-boot = { version = "0.2.0", path = "../embassy-boot" } 29embassy-boot = { version = "0.3.0", path = "../embassy-boot" }
30cortex-m = { version = "0.7.6" } 30cortex-m = { version = "0.7.6" }
31cortex-m-rt = { version = "0.7" } 31cortex-m-rt = { version = "0.7" }
32embedded-storage = "0.3.1" 32embedded-storage = "0.3.1"
diff --git a/embassy-boot-stm32/src/fmt.rs b/embassy-boot-stm32/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-boot-stm32/src/fmt.rs
+++ b/embassy-boot-stm32/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-boot/Cargo.toml b/embassy-boot/Cargo.toml
index 16dc52bcc..85b3695a1 100644
--- a/embassy-boot/Cargo.toml
+++ b/embassy-boot/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2edition = "2021" 2edition = "2021"
3name = "embassy-boot" 3name = "embassy-boot"
4version = "0.2.0" 4version = "0.3.0"
5description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks." 5description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks."
6license = "MIT OR Apache-2.0" 6license = "MIT OR Apache-2.0"
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
@@ -28,7 +28,7 @@ defmt = { version = "0.3", optional = true }
28digest = "0.10" 28digest = "0.10"
29log = { version = "0.4", optional = true } 29log = { version = "0.4", optional = true }
30ed25519-dalek = { version = "2", default_features = false, features = ["digest"], optional = true } 30ed25519-dalek = { version = "2", default_features = false, features = ["digest"], optional = true }
31embassy-embedded-hal = { version = "0.1.0", path = "../embassy-embedded-hal" } 31embassy-embedded-hal = { version = "0.2.0", path = "../embassy-embedded-hal" }
32embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 32embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
33embedded-storage = "0.3.1" 33embedded-storage = "0.3.1"
34embedded-storage-async = { version = "0.4.1" } 34embedded-storage-async = { version = "0.4.1" }
diff --git a/embassy-boot/src/boot_loader.rs b/embassy-boot/src/boot_loader.rs
index 789fa34c1..61d61b96e 100644
--- a/embassy-boot/src/boot_loader.rs
+++ b/embassy-boot/src/boot_loader.rs
@@ -236,10 +236,10 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S
236 /// 236 ///
237 pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> { 237 pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> {
238 const { 238 const {
239 assert!(Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32 == 0); 239 core::assert!(Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32 == 0);
240 assert!(Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32 == 0); 240 core::assert!(Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32 == 0);
241 assert!(Self::PAGE_SIZE % DFU::WRITE_SIZE as u32 == 0); 241 core::assert!(Self::PAGE_SIZE % DFU::WRITE_SIZE as u32 == 0);
242 assert!(Self::PAGE_SIZE % DFU::ERASE_SIZE as u32 == 0); 242 core::assert!(Self::PAGE_SIZE % DFU::ERASE_SIZE as u32 == 0);
243 } 243 }
244 244
245 // Ensure we have enough progress pages to store copy progress 245 // Ensure we have enough progress pages to store copy progress
diff --git a/embassy-boot/src/fmt.rs b/embassy-boot/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-boot/src/fmt.rs
+++ b/embassy-boot/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-embedded-hal/CHANGELOG.md b/embassy-embedded-hal/CHANGELOG.md
new file mode 100644
index 000000000..f8e272160
--- /dev/null
+++ b/embassy-embedded-hal/CHANGELOG.md
@@ -0,0 +1,21 @@
1# Changelog for embassy-embedded-hal
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8## Unreleased
9
10## 0.2.0 - 2024-08-05
11
12- Add Clone derive to flash Partition in embassy-embedded-hal
13- Add support for all word sizes to async shared spi
14- Add Copy and 'static constraint to Word type in SPI structs
15- Improve flexibility by introducing SPI word size as a generic parameter
16- Allow changing Spi/I2cDeviceWithConfig's config at runtime
17- Impl `MultiwriteNorFlash` for `BlockingAsync`
18
19## 0.1.0 - 2024-01-10
20
21- First release
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml
index 905439fe7..345dc3420 100644
--- a/embassy-embedded-hal/Cargo.toml
+++ b/embassy-embedded-hal/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-embedded-hal" 2name = "embassy-embedded-hal"
3version = "0.1.0" 3version = "0.2.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Collection of utilities to use `embedded-hal` and `embedded-storage` traits with Embassy." 6description = "Collection of utilities to use `embedded-hal` and `embedded-storage` traits with Embassy."
@@ -29,7 +29,7 @@ default = ["time"]
29[dependencies] 29[dependencies]
30embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 30embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
31embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 31embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
32embassy-time = { version = "0.3.1", path = "../embassy-time", optional = true } 32embassy-time = { version = "0.3.2", path = "../embassy-time", optional = true }
33embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ 33embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
34 "unproven", 34 "unproven",
35] } 35] }
diff --git a/embassy-embedded-hal/src/flash/partition/asynch.rs b/embassy-embedded-hal/src/flash/partition/asynch.rs
index 5920436dd..1b0c91232 100644
--- a/embassy-embedded-hal/src/flash/partition/asynch.rs
+++ b/embassy-embedded-hal/src/flash/partition/asynch.rs
@@ -18,6 +18,16 @@ pub struct Partition<'a, M: RawMutex, T: NorFlash> {
18 size: u32, 18 size: u32,
19} 19}
20 20
21impl<'a, M: RawMutex, T: NorFlash> Clone for Partition<'a, M, T> {
22 fn clone(&self) -> Self {
23 Self {
24 flash: self.flash,
25 offset: self.offset,
26 size: self.size,
27 }
28 }
29}
30
21impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> { 31impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> {
22 /// Create a new partition 32 /// Create a new partition
23 pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self { 33 pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self {
diff --git a/embassy-embedded-hal/src/flash/partition/blocking.rs b/embassy-embedded-hal/src/flash/partition/blocking.rs
index 2ddbe3de0..a68df7812 100644
--- a/embassy-embedded-hal/src/flash/partition/blocking.rs
+++ b/embassy-embedded-hal/src/flash/partition/blocking.rs
@@ -19,6 +19,16 @@ pub struct BlockingPartition<'a, M: RawMutex, T: NorFlash> {
19 size: u32, 19 size: u32,
20} 20}
21 21
22impl<'a, M: RawMutex, T: NorFlash> Clone for BlockingPartition<'a, M, T> {
23 fn clone(&self) -> Self {
24 Self {
25 flash: self.flash,
26 offset: self.offset,
27 size: self.size,
28 }
29 }
30}
31
22impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> { 32impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> {
23 /// Create a new partition 33 /// Create a new partition
24 pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self { 34 pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self {
diff --git a/embassy-executor-macros/Cargo.toml b/embassy-executor-macros/Cargo.toml
index 2953e7ccc..218e820ce 100644
--- a/embassy-executor-macros/Cargo.toml
+++ b/embassy-executor-macros/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-executor-macros" 2name = "embassy-executor-macros"
3version = "0.4.1" 3version = "0.5.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "macros for creating the entry point and tasks for embassy-executor" 6description = "macros for creating the entry point and tasks for embassy-executor"
diff --git a/embassy-executor-macros/src/macros/main.rs b/embassy-executor-macros/src/macros/main.rs
index 088e64d1c..26dfa2397 100644
--- a/embassy-executor-macros/src/macros/main.rs
+++ b/embassy-executor-macros/src/macros/main.rs
@@ -70,7 +70,7 @@ pub fn wasm() -> TokenStream {
70 let executor = ::std::boxed::Box::leak(::std::boxed::Box::new(::embassy_executor::Executor::new())); 70 let executor = ::std::boxed::Box::leak(::std::boxed::Box::new(::embassy_executor::Executor::new()));
71 71
72 executor.start(|spawner| { 72 executor.start(|spawner| {
73 spawner.spawn(__embassy_main(spawner)).unwrap(); 73 spawner.must_spawn(__embassy_main(spawner));
74 }); 74 });
75 75
76 Ok(()) 76 Ok(())
diff --git a/embassy-executor/CHANGELOG.md b/embassy-executor/CHANGELOG.md
index 77c64fd8e..5582b56ec 100644
--- a/embassy-executor/CHANGELOG.md
+++ b/embassy-executor/CHANGELOG.md
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8## Unreleased 8## Unreleased
9 9
10## 0.6.0 - 2024-08-05
11
12- Add collapse_debuginfo to fmt.rs macros.
13- initial support for avr
14- use nightly waker_getters APIs
15
10## 0.5.0 - 2024-01-11 16## 0.5.0 - 2024-01-11
11 17
12- Updated to `embassy-time-driver 0.1`, `embassy-time-queue-driver 0.1`, compatible with `embassy-time v0.3` and higher. 18- Updated to `embassy-time-driver 0.1`, `embassy-time-queue-driver 0.1`, compatible with `embassy-time v0.3` and higher.
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index 431165cee..5984cc49c 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-executor" 2name = "embassy-executor"
3version = "0.5.0" 3version = "0.6.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "async/await executor designed for embedded usage" 6description = "async/await executor designed for embedded usage"
@@ -33,7 +33,7 @@ defmt = { version = "0.3", optional = true }
33log = { version = "0.4.14", optional = true } 33log = { version = "0.4.14", optional = true }
34rtos-trace = { version = "0.1.2", optional = true } 34rtos-trace = { version = "0.1.2", optional = true }
35 35
36embassy-executor-macros = { version = "0.4.0", path = "../embassy-executor-macros" } 36embassy-executor-macros = { version = "0.5.0", path = "../embassy-executor-macros" }
37embassy-time-driver = { version = "0.1.0", path = "../embassy-time-driver", optional = true } 37embassy-time-driver = { version = "0.1.0", path = "../embassy-time-driver", optional = true }
38embassy-time-queue-driver = { version = "0.1.0", path = "../embassy-time-queue-driver", optional = true } 38embassy-time-queue-driver = { version = "0.1.0", path = "../embassy-time-queue-driver", optional = true }
39critical-section = "1.1" 39critical-section = "1.1"
diff --git a/embassy-executor/build_common.rs b/embassy-executor/build_common.rs
index 0487eb3c5..4f24e6d37 100644
--- a/embassy-executor/build_common.rs
+++ b/embassy-executor/build_common.rs
@@ -8,8 +8,6 @@
8 8
9use std::collections::HashSet; 9use std::collections::HashSet;
10use std::env; 10use std::env;
11use std::ffi::OsString;
12use std::process::Command;
13 11
14/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring 12/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring
15/// them (`cargo:rust-check-cfg=cfg(X)`). 13/// them (`cargo:rust-check-cfg=cfg(X)`).
@@ -17,7 +15,6 @@ use std::process::Command;
17pub struct CfgSet { 15pub struct CfgSet {
18 enabled: HashSet<String>, 16 enabled: HashSet<String>,
19 declared: HashSet<String>, 17 declared: HashSet<String>,
20 emit_declared: bool,
21} 18}
22 19
23impl CfgSet { 20impl CfgSet {
@@ -25,7 +22,6 @@ impl CfgSet {
25 Self { 22 Self {
26 enabled: HashSet::new(), 23 enabled: HashSet::new(),
27 declared: HashSet::new(), 24 declared: HashSet::new(),
28 emit_declared: is_rustc_nightly(),
29 } 25 }
30 } 26 }
31 27
@@ -49,7 +45,7 @@ impl CfgSet {
49 /// 45 ///
50 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. 46 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid.
51 pub fn declare(&mut self, cfg: impl AsRef<str>) { 47 pub fn declare(&mut self, cfg: impl AsRef<str>) {
52 if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { 48 if self.declared.insert(cfg.as_ref().to_owned()) {
53 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); 49 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref());
54 } 50 }
55 } 51 }
@@ -69,21 +65,6 @@ impl CfgSet {
69 } 65 }
70} 66}
71 67
72fn is_rustc_nightly() -> bool {
73 if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() {
74 return true;
75 }
76
77 let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
78
79 let output = Command::new(rustc)
80 .arg("--version")
81 .output()
82 .expect("failed to run `rustc --version`");
83
84 String::from_utf8_lossy(&output.stdout).contains("nightly")
85}
86
87/// Sets configs that describe the target platform. 68/// Sets configs that describe the target platform.
88pub fn set_target_cfgs(cfgs: &mut CfgSet) { 69pub fn set_target_cfgs(cfgs: &mut CfgSet) {
89 let target = env::var("TARGET").unwrap(); 70 let target = env::var("TARGET").unwrap();
diff --git a/embassy-executor/src/fmt.rs b/embassy-executor/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-executor/src/fmt.rs
+++ b/embassy-executor/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-futures/src/fmt.rs b/embassy-futures/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-futures/src/fmt.rs
+++ b/embassy-futures/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-hal-internal/Cargo.toml b/embassy-hal-internal/Cargo.toml
index c5013f365..d5ca95ac2 100644
--- a/embassy-hal-internal/Cargo.toml
+++ b/embassy-hal-internal/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-hal-internal" 2name = "embassy-hal-internal"
3version = "0.1.0" 3version = "0.2.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Internal implementation details for Embassy HALs. DO NOT USE DIRECTLY." 6description = "Internal implementation details for Embassy HALs. DO NOT USE DIRECTLY."
diff --git a/embassy-hal-internal/build_common.rs b/embassy-hal-internal/build_common.rs
index 0487eb3c5..4f24e6d37 100644
--- a/embassy-hal-internal/build_common.rs
+++ b/embassy-hal-internal/build_common.rs
@@ -8,8 +8,6 @@
8 8
9use std::collections::HashSet; 9use std::collections::HashSet;
10use std::env; 10use std::env;
11use std::ffi::OsString;
12use std::process::Command;
13 11
14/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring 12/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring
15/// them (`cargo:rust-check-cfg=cfg(X)`). 13/// them (`cargo:rust-check-cfg=cfg(X)`).
@@ -17,7 +15,6 @@ use std::process::Command;
17pub struct CfgSet { 15pub struct CfgSet {
18 enabled: HashSet<String>, 16 enabled: HashSet<String>,
19 declared: HashSet<String>, 17 declared: HashSet<String>,
20 emit_declared: bool,
21} 18}
22 19
23impl CfgSet { 20impl CfgSet {
@@ -25,7 +22,6 @@ impl CfgSet {
25 Self { 22 Self {
26 enabled: HashSet::new(), 23 enabled: HashSet::new(),
27 declared: HashSet::new(), 24 declared: HashSet::new(),
28 emit_declared: is_rustc_nightly(),
29 } 25 }
30 } 26 }
31 27
@@ -49,7 +45,7 @@ impl CfgSet {
49 /// 45 ///
50 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. 46 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid.
51 pub fn declare(&mut self, cfg: impl AsRef<str>) { 47 pub fn declare(&mut self, cfg: impl AsRef<str>) {
52 if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { 48 if self.declared.insert(cfg.as_ref().to_owned()) {
53 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); 49 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref());
54 } 50 }
55 } 51 }
@@ -69,21 +65,6 @@ impl CfgSet {
69 } 65 }
70} 66}
71 67
72fn is_rustc_nightly() -> bool {
73 if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() {
74 return true;
75 }
76
77 let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
78
79 let output = Command::new(rustc)
80 .arg("--version")
81 .output()
82 .expect("failed to run `rustc --version`");
83
84 String::from_utf8_lossy(&output.stdout).contains("nightly")
85}
86
87/// Sets configs that describe the target platform. 68/// Sets configs that describe the target platform.
88pub fn set_target_cfgs(cfgs: &mut CfgSet) { 69pub fn set_target_cfgs(cfgs: &mut CfgSet) {
89 let target = env::var("TARGET").unwrap(); 70 let target = env::var("TARGET").unwrap();
diff --git a/embassy-hal-internal/src/fmt.rs b/embassy-hal-internal/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-hal-internal/src/fmt.rs
+++ b/embassy-hal-internal/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-net-adin1110/Cargo.toml b/embassy-net-adin1110/Cargo.toml
index e75f76b16..0b2a6744d 100644
--- a/embassy-net-adin1110/Cargo.toml
+++ b/embassy-net-adin1110/Cargo.toml
@@ -16,8 +16,8 @@ log = { version = "0.4", default-features = false, optional = true }
16embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 16embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
17embedded-hal-async = { version = "1.0" } 17embedded-hal-async = { version = "1.0" }
18embedded-hal-bus = { version = "0.1", features = ["async"] } 18embedded-hal-bus = { version = "0.1", features = ["async"] }
19embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } 19embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel" }
20embassy-time = { version = "0.3.1", path = "../embassy-time" } 20embassy-time = { version = "0.3.2", path = "../embassy-time" }
21embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 21embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
22bitfield = "0.14.0" 22bitfield = "0.14.0"
23 23
diff --git a/embassy-net-adin1110/README.md b/embassy-net-adin1110/README.md
index 39a38960d..0514274b4 100644
--- a/embassy-net-adin1110/README.md
+++ b/embassy-net-adin1110/README.md
@@ -21,7 +21,7 @@ APL can be used in [`intrinsic safety applications/explosion hazardous areas`](h
21 21
22## Supported SPI modes 22## Supported SPI modes
23 23
24`ADIN1110` supports two SPI modes. `Generic` and [`OPEN Alliance 10BASE-T1x MAC-PHY serial interface`](https://opensig.org/download/document/OPEN_Alliance_10BASET1x_MAC-PHY_Serial_Interface_V1.1.pdf) 24`ADIN1110` supports two SPI modes. `Generic` and [`OPEN Alliance 10BASE-T1x MAC-PHY serial interface`](https://opensig.org/wp-content/uploads/2023/12/OPEN_Alliance_10BASET1x_MAC-PHY_Serial_Interface_V1.1.pdf)
25 25
26Both modes support with and without additional CRC. 26Both modes support with and without additional CRC.
27Currently only `Generic` SPI with or without CRC is supported. 27Currently only `Generic` SPI with or without CRC is supported.
diff --git a/embassy-net-adin1110/src/crc8.rs b/embassy-net-adin1110/src/crc8.rs
index 7d20a7401..321983e64 100644
--- a/embassy-net-adin1110/src/crc8.rs
+++ b/embassy-net-adin1110/src/crc8.rs
@@ -16,7 +16,7 @@ const CRC8X_TABLE: [u8; 256] = [
16 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3, 16 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3,
17]; 17];
18 18
19/// Calculate the crc of a pease of data. 19/// Calculate the crc of a piece of data.
20pub fn crc8(data: &[u8]) -> u8 { 20pub fn crc8(data: &[u8]) -> u8 {
21 data.iter().fold(0, |crc, &byte| CRC8X_TABLE[usize::from(byte ^ crc)]) 21 data.iter().fold(0, |crc, &byte| CRC8X_TABLE[usize::from(byte ^ crc)])
22} 22}
diff --git a/embassy-net-adin1110/src/fmt.rs b/embassy-net-adin1110/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-net-adin1110/src/fmt.rs
+++ b/embassy-net-adin1110/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-net-driver-channel/CHANGELOG.md b/embassy-net-driver-channel/CHANGELOG.md
index b04d0a86b..d7af7e55d 100644
--- a/embassy-net-driver-channel/CHANGELOG.md
+++ b/embassy-net-driver-channel/CHANGELOG.md
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 7
8## Unreleased
9
10## 0.3.0 - 2024-08-05
11
12- Add collapse_debuginfo to fmt.rs macros.
13- Update embassy-sync version
14
8## 0.2.0 - 2023-10-18 15## 0.2.0 - 2023-10-18
9 16
10- Update `embassy-net-driver` to v0.2 17- Update `embassy-net-driver` to v0.2
diff --git a/embassy-net-driver-channel/Cargo.toml b/embassy-net-driver-channel/Cargo.toml
index 3bd7d288a..abce9315b 100644
--- a/embassy-net-driver-channel/Cargo.toml
+++ b/embassy-net-driver-channel/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-net-driver-channel" 2name = "embassy-net-driver-channel"
3version = "0.2.0" 3version = "0.3.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "High-level channel-based driver for the `embassy-net` async TCP/IP network stack." 6description = "High-level channel-based driver for the `embassy-net` async TCP/IP network stack."
diff --git a/embassy-net-driver-channel/src/fmt.rs b/embassy-net-driver-channel/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-net-driver-channel/src/fmt.rs
+++ b/embassy-net-driver-channel/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-net-enc28j60/Cargo.toml b/embassy-net-enc28j60/Cargo.toml
index dd7aa031d..cafced4b2 100644
--- a/embassy-net-enc28j60/Cargo.toml
+++ b/embassy-net-enc28j60/Cargo.toml
@@ -13,7 +13,7 @@ documentation = "https://docs.embassy.dev/embassy-net-enc28j60"
13embedded-hal = { version = "1.0" } 13embedded-hal = { version = "1.0" }
14embedded-hal-async = { version = "1.0" } 14embedded-hal-async = { version = "1.0" }
15embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" } 15embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" }
16embassy-time = { version = "0.3.1", path = "../embassy-time" } 16embassy-time = { version = "0.3.2", path = "../embassy-time" }
17embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 17embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
18 18
19defmt = { version = "0.3", optional = true } 19defmt = { version = "0.3", optional = true }
diff --git a/embassy-net-enc28j60/src/fmt.rs b/embassy-net-enc28j60/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-net-enc28j60/src/fmt.rs
+++ b/embassy-net-enc28j60/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-net-esp-hosted/Cargo.toml b/embassy-net-esp-hosted/Cargo.toml
index 24b7d0806..915eba7a0 100644
--- a/embassy-net-esp-hosted/Cargo.toml
+++ b/embassy-net-esp-hosted/Cargo.toml
@@ -17,10 +17,10 @@ log = [ "dep:log" ]
17defmt = { version = "0.3", optional = true } 17defmt = { version = "0.3", optional = true }
18log = { version = "0.4.14", optional = true } 18log = { version = "0.4.14", optional = true }
19 19
20embassy-time = { version = "0.3.1", path = "../embassy-time" } 20embassy-time = { version = "0.3.2", path = "../embassy-time" }
21embassy-sync = { version = "0.6.0", path = "../embassy-sync"} 21embassy-sync = { version = "0.6.0", path = "../embassy-sync"}
22embassy-futures = { version = "0.1.0", path = "../embassy-futures"} 22embassy-futures = { version = "0.1.0", path = "../embassy-futures"}
23embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel"} 23embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel"}
24 24
25embedded-hal = { version = "1.0" } 25embedded-hal = { version = "1.0" }
26embedded-hal-async = { version = "1.0" } 26embedded-hal-async = { version = "1.0" }
diff --git a/embassy-net-esp-hosted/src/fmt.rs b/embassy-net-esp-hosted/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-net-esp-hosted/src/fmt.rs
+++ b/embassy-net-esp-hosted/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-net-ppp/Cargo.toml b/embassy-net-ppp/Cargo.toml
index cdfafaae1..f6371f955 100644
--- a/embassy-net-ppp/Cargo.toml
+++ b/embassy-net-ppp/Cargo.toml
@@ -18,7 +18,7 @@ defmt = { version = "0.3", optional = true }
18log = { version = "0.4.14", optional = true } 18log = { version = "0.4.14", optional = true }
19 19
20embedded-io-async = { version = "0.6.1" } 20embedded-io-async = { version = "0.6.1" }
21embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } 21embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel" }
22embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 22embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
23ppproto = { version = "0.1.2"} 23ppproto = { version = "0.1.2"}
24embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 24embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
diff --git a/embassy-net-ppp/src/fmt.rs b/embassy-net-ppp/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-net-ppp/src/fmt.rs
+++ b/embassy-net-ppp/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-net-wiznet/Cargo.toml b/embassy-net-wiznet/Cargo.toml
index b6ce20325..e7fb3f455 100644
--- a/embassy-net-wiznet/Cargo.toml
+++ b/embassy-net-wiznet/Cargo.toml
@@ -12,8 +12,8 @@ documentation = "https://docs.embassy.dev/embassy-net-wiznet"
12[dependencies] 12[dependencies]
13embedded-hal = { version = "1.0" } 13embedded-hal = { version = "1.0" }
14embedded-hal-async = { version = "1.0" } 14embedded-hal-async = { version = "1.0" }
15embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } 15embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel" }
16embassy-time = { version = "0.3.1", path = "../embassy-time" } 16embassy-time = { version = "0.3.2", path = "../embassy-time" }
17embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 17embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
18defmt = { version = "0.3", optional = true } 18defmt = { version = "0.3", optional = true }
19 19
diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml
index 15b97af47..d86a30755 100644
--- a/embassy-net/Cargo.toml
+++ b/embassy-net/Cargo.toml
@@ -72,7 +72,7 @@ smoltcp = { version = "0.11.0", default-features = false, features = [
72] } 72] }
73 73
74embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" } 74embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" }
75embassy-time = { version = "0.3.1", path = "../embassy-time" } 75embassy-time = { version = "0.3.2", path = "../embassy-time" }
76embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 76embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
77embedded-io-async = { version = "0.6.1" } 77embedded-io-async = { version = "0.6.1" }
78 78
diff --git a/embassy-net/src/fmt.rs b/embassy-net/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-net/src/fmt.rs
+++ b/embassy-net/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs
index 12f5f30b4..bd3de1f8c 100644
--- a/embassy-net/src/lib.rs
+++ b/embassy-net/src/lib.rs
@@ -34,6 +34,8 @@ use embassy_sync::waitqueue::WakerRegistration;
34use embassy_time::{Instant, Timer}; 34use embassy_time::{Instant, Timer};
35#[allow(unused_imports)] 35#[allow(unused_imports)]
36use heapless::Vec; 36use heapless::Vec;
37#[cfg(feature = "dns")]
38pub use smoltcp::config::DNS_MAX_SERVER_COUNT;
37#[cfg(feature = "igmp")] 39#[cfg(feature = "igmp")]
38pub use smoltcp::iface::MulticastError; 40pub use smoltcp::iface::MulticastError;
39#[allow(unused_imports)] 41#[allow(unused_imports)]
@@ -414,7 +416,7 @@ impl<D: Driver> Stack<D> {
414 /// ```ignore 416 /// ```ignore
415 /// let config = embassy_net::Config::dhcpv4(Default::default()); 417 /// let config = embassy_net::Config::dhcpv4(Default::default());
416 ///// Init network stack 418 ///// Init network stack
417 /// static RESOURCES: StaticCell<embassy_net::StackResources<2> = StaticCell::new(); 419 /// static RESOURCES: StaticCell<embassy_net::StackResources<2>> = StaticCell::new();
418 /// static STACK: StaticCell<embassy_net::Stack> = StaticCell::new(); 420 /// static STACK: StaticCell<embassy_net::Stack> = StaticCell::new();
419 /// let stack = &*STACK.init(embassy_net::Stack::new( 421 /// let stack = &*STACK.init(embassy_net::Stack::new(
420 /// device, 422 /// device,
@@ -823,9 +825,17 @@ impl<D: Driver> Inner<D> {
823 825
824 // Apply DNS servers 826 // Apply DNS servers
825 #[cfg(feature = "dns")] 827 #[cfg(feature = "dns")]
826 s.sockets 828 if !dns_servers.is_empty() {
827 .get_mut::<smoltcp::socket::dns::Socket>(self.dns_socket) 829 let count = if dns_servers.len() > DNS_MAX_SERVER_COUNT {
828 .update_servers(&dns_servers[..]); 830 warn!("Number of DNS servers exceeds DNS_MAX_SERVER_COUNT, truncating list.");
831 DNS_MAX_SERVER_COUNT
832 } else {
833 dns_servers.len()
834 };
835 s.sockets
836 .get_mut::<smoltcp::socket::dns::Socket>(self.dns_socket)
837 .update_servers(&dns_servers[..count]);
838 }
829 839
830 self.config_waker.wake(); 840 self.config_waker.wake();
831 } 841 }
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index 74eff9dae..be0e1a129 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -660,12 +660,25 @@ pub mod client {
660 pub struct TcpClient<'d, D: Driver, const N: usize, const TX_SZ: usize = 1024, const RX_SZ: usize = 1024> { 660 pub struct TcpClient<'d, D: Driver, const N: usize, const TX_SZ: usize = 1024, const RX_SZ: usize = 1024> {
661 stack: &'d Stack<D>, 661 stack: &'d Stack<D>,
662 state: &'d TcpClientState<N, TX_SZ, RX_SZ>, 662 state: &'d TcpClientState<N, TX_SZ, RX_SZ>,
663 socket_timeout: Option<Duration>,
663 } 664 }
664 665
665 impl<'d, D: Driver, const N: usize, const TX_SZ: usize, const RX_SZ: usize> TcpClient<'d, D, N, TX_SZ, RX_SZ> { 666 impl<'d, D: Driver, const N: usize, const TX_SZ: usize, const RX_SZ: usize> TcpClient<'d, D, N, TX_SZ, RX_SZ> {
666 /// Create a new `TcpClient`. 667 /// Create a new `TcpClient`.
667 pub fn new(stack: &'d Stack<D>, state: &'d TcpClientState<N, TX_SZ, RX_SZ>) -> Self { 668 pub fn new(stack: &'d Stack<D>, state: &'d TcpClientState<N, TX_SZ, RX_SZ>) -> Self {
668 Self { stack, state } 669 Self {
670 stack,
671 state,
672 socket_timeout: None,
673 }
674 }
675
676 /// Set the timeout for each socket created by this `TcpClient`.
677 ///
678 /// If the timeout is set, the socket will be closed if no data is received for the
679 /// specified duration.
680 pub fn set_timeout(&mut self, timeout: Option<Duration>) {
681 self.socket_timeout = timeout;
669 } 682 }
670 } 683 }
671 684
@@ -691,6 +704,7 @@ pub mod client {
691 }; 704 };
692 let remote_endpoint = (addr, remote.port()); 705 let remote_endpoint = (addr, remote.port());
693 let mut socket = TcpConnection::new(&self.stack, self.state)?; 706 let mut socket = TcpConnection::new(&self.stack, self.state)?;
707 socket.socket.set_timeout(self.socket_timeout.clone());
694 socket 708 socket
695 .socket 709 .socket
696 .connect(remote_endpoint) 710 .connect(remote_endpoint)
diff --git a/embassy-nrf/CHANGELOG.md b/embassy-nrf/CHANGELOG.md
index 6f07a8c6d..f8d6ab753 100644
--- a/embassy-nrf/CHANGELOG.md
+++ b/embassy-nrf/CHANGELOG.md
@@ -7,24 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8## Unreleased 8## Unreleased
9 9
10- Drop `sealed` mod 10## 0.2.0 - 2024-08-05
11- nrf52840: Add dcdc voltage parameter to configure REG0 regulator 11
12- radio: Add support for IEEE 802.15.4 and BLE via radio peripheral 12- Support for NRF chips:
13- spim: Reduce trace-level messages ("Copying SPIM tx buffer..") 13 - nrf51
14- uart: Add support for rx- or tx-only BufferedUart 14 - nrf9151
15- uart: Implement splitting Rx/Tx 15- Support for new peripherals:
16- spi: Allow specifying OutputDrive for SPI spins 16 - EGU
17- pdm: Fix gain register value derivation 17 - radio - low-level support for IEEE 802.15.4 and BLE via radio peripheral
18- spim: Implement chunked DMA transfers 18- Peripheral changes:
19- spi: Add bounds checks for EasyDMA buffer size 19 - gpio: Drop GPIO Pin generics (API break)
20- uarte: Add support for handling RX errors 20 - pdm: Fix gain register value derivation
21- nrf51: Implement support for nrf51 chip 21 - pwm:
22- pwm: Expose `duty` method 22 - Expose `duty` method
23- pwm: Fix infinite loop 23 - Expose `pwm::PWM_CLK_HZ` and add `is_enabled` method
24- spi: Add support for configuring bit order for bus 24 - Allow specifying OutputDrive for PWM channels
25- pwm: Expose `pwm::PWM_CLK_HZ` and add `is_enabled` method 25 - Fix infinite loop
26- gpio: Drop GPIO Pin generics (API break) 26 - spim:
27- pwm: Allow specifying OutputDrive for PWM channels 27 - Reduce trace-level messages ("Copying SPIM tx buffer..")
28 - Support configuring bit order for bus
29 - Allow specifying OutputDrive for SPI pins
30 - Add bounds checks for EasyDMA buffer size
31 - Implement chunked DMA transfers
32 - uart:
33 - Add support for rx- or tx-only BufferedUart
34 - Implement splitting Rx/Tx
35 - Add support for handling RX errors
36- Miscellaneous changes:
37 - Add `collapse_debuginfo` to fmt.rs macros.
38 - Drop `sealed` mod
39 - nrf52840: Add dcdc voltage parameter to configure REG0 regulator
28 40
29## 0.1.0 - 2024-01-12 41## 0.1.0 - 2024-01-12
30 42
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml
index 02c3bfbbe..bc0a9d199 100644
--- a/embassy-nrf/Cargo.toml
+++ b/embassy-nrf/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-nrf" 2name = "embassy-nrf"
3version = "0.1.0" 3version = "0.2.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for nRF series microcontrollers" 6description = "Embassy Hardware Abstraction Layer (HAL) for nRF series microcontrollers"
@@ -40,6 +40,7 @@ rt = [
40 "nrf5340-app-pac?/rt", 40 "nrf5340-app-pac?/rt",
41 "nrf5340-net-pac?/rt", 41 "nrf5340-net-pac?/rt",
42 "nrf9160-pac?/rt", 42 "nrf9160-pac?/rt",
43 "nrf9120-pac?/rt",
43] 44]
44 45
45## Enable features requiring `embassy-time` 46## Enable features requiring `embassy-time`
@@ -96,9 +97,18 @@ nrf5340-app-ns = ["_nrf5340-app", "_ns"]
96## nRF5340 network core 97## nRF5340 network core
97nrf5340-net = ["_nrf5340-net"] 98nrf5340-net = ["_nrf5340-net"]
98## nRF9160 in Secure mode 99## nRF9160 in Secure mode
99nrf9160-s = ["_nrf9160", "_s"] 100nrf9160-s = ["_nrf9160", "_s", "_nrf91"]
100## nRF9160 in Non-Secure mode 101## nRF9160 in Non-Secure mode
101nrf9160-ns = ["_nrf9160", "_ns"] 102nrf9160-ns = ["_nrf9160", "_ns", "_nrf91"]
103## The nRF9120 is the internal part number for the nRF9161 and nRF9151.
104## nRF9120 in Secure mode
105nrf9120-s = ["_nrf9120", "_s", "_nrf91"]
106nrf9151-s = ["_nrf9120", "_s", "_nrf91"]
107nrf9161-s = ["_nrf9120", "_s", "_nrf91"]
108## nRF9120 in Non-Secure mode
109nrf9120-ns = ["_nrf9120", "_ns", "_nrf91"]
110nrf9151-ns = ["_nrf9120", "_ns", "_nrf91"]
111nrf9161-ns = ["_nrf9120", "_ns", "_nrf91"]
102 112
103# Features starting with `_` are for internal use only. They're not intended 113# Features starting with `_` are for internal use only. They're not intended
104# to be enabled by other crates, and are not covered by semver guarantees. 114# to be enabled by other crates, and are not covered by semver guarantees.
@@ -107,8 +117,10 @@ _nrf5340-app = ["_nrf5340", "nrf5340-app-pac"]
107_nrf5340-net = ["_nrf5340", "nrf5340-net-pac"] 117_nrf5340-net = ["_nrf5340", "nrf5340-net-pac"]
108_nrf5340 = ["_gpio-p1", "_dppi"] 118_nrf5340 = ["_gpio-p1", "_dppi"]
109_nrf9160 = ["nrf9160-pac", "_dppi"] 119_nrf9160 = ["nrf9160-pac", "_dppi"]
120_nrf9120 = ["nrf9120-pac", "_dppi"]
110_nrf52 = ["_ppi"] 121_nrf52 = ["_ppi"]
111_nrf51 = ["_ppi"] 122_nrf51 = ["_ppi"]
123_nrf91 = []
112 124
113_time-driver = ["dep:embassy-time-driver", "embassy-time-driver?/tick-hz-32_768"] 125_time-driver = ["dep:embassy-time-driver", "embassy-time-driver?/tick-hz-32_768"]
114 126
@@ -125,10 +137,10 @@ _nrf52832_anomaly_109 = []
125 137
126[dependencies] 138[dependencies]
127embassy-time-driver = { version = "0.1", path = "../embassy-time-driver", optional = true } 139embassy-time-driver = { version = "0.1", path = "../embassy-time-driver", optional = true }
128embassy-time = { version = "0.3.1", path = "../embassy-time", optional = true } 140embassy-time = { version = "0.3.2", path = "../embassy-time", optional = true }
129embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 141embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
130embassy-hal-internal = {version = "0.1.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-3"] } 142embassy-hal-internal = {version = "0.2.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-3"] }
131embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } 143embassy-embedded-hal = {version = "0.2.0", path = "../embassy-embedded-hal" }
132embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" } 144embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" }
133 145
134embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 146embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
@@ -161,3 +173,4 @@ nrf52840-pac = { version = "0.12.0", optional = true }
161nrf5340-app-pac = { version = "0.12.0", optional = true } 173nrf5340-app-pac = { version = "0.12.0", optional = true }
162nrf5340-net-pac = { version = "0.12.0", optional = true } 174nrf5340-net-pac = { version = "0.12.0", optional = true }
163nrf9160-pac = { version = "0.12.0", optional = true } 175nrf9160-pac = { version = "0.12.0", optional = true }
176nrf9120-pac = { version = "0.12.0", optional = true }
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs
index 8e4064aaa..b368a3d33 100644
--- a/embassy-nrf/src/buffered_uarte.rs
+++ b/embassy-nrf/src/buffered_uarte.rs
@@ -766,6 +766,12 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarteRx<'d, U, T> {
766 rx.pop_done(amt); 766 rx.pop_done(amt);
767 U::regs().intenset.write(|w| w.rxstarted().set()); 767 U::regs().intenset.write(|w| w.rxstarted().set());
768 } 768 }
769
770 /// we are ready to read if there is data in the buffer
771 fn read_ready() -> Result<bool, Error> {
772 let state = U::buffered_state();
773 Ok(!state.rx_buf.is_empty())
774 }
769} 775}
770 776
771impl<'a, U: UarteInstance, T: TimerInstance> Drop for BufferedUarteRx<'a, U, T> { 777impl<'a, U: UarteInstance, T: TimerInstance> Drop for BufferedUarteRx<'a, U, T> {
@@ -827,6 +833,18 @@ mod _embedded_io {
827 } 833 }
828 } 834 }
829 835
836 impl<'d, U: UarteInstance, T: TimerInstance + 'd> embedded_io_async::ReadReady for BufferedUarte<'d, U, T> {
837 fn read_ready(&mut self) -> Result<bool, Self::Error> {
838 BufferedUarteRx::<'d, U, T>::read_ready()
839 }
840 }
841
842 impl<'d, U: UarteInstance, T: TimerInstance + 'd> embedded_io_async::ReadReady for BufferedUarteRx<'d, U, T> {
843 fn read_ready(&mut self) -> Result<bool, Self::Error> {
844 Self::read_ready()
845 }
846 }
847
830 impl<'d, U: UarteInstance, T: TimerInstance> embedded_io_async::BufRead for BufferedUarte<'d, U, T> { 848 impl<'d, U: UarteInstance, T: TimerInstance> embedded_io_async::BufRead for BufferedUarte<'d, U, T> {
831 async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> { 849 async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
832 self.fill_buf().await 850 self.fill_buf().await
diff --git a/embassy-nrf/src/chips/nrf9120.rs b/embassy-nrf/src/chips/nrf9120.rs
new file mode 100644
index 000000000..b53510118
--- /dev/null
+++ b/embassy-nrf/src/chips/nrf9120.rs
@@ -0,0 +1,430 @@
1/// Peripheral Access Crate
2#[allow(unused_imports)]
3#[rustfmt::skip]
4pub mod pac {
5 // The nRF9120 has a secure and non-secure (NS) mode.
6 // To avoid cfg spam, we remove _ns or _s suffixes here.
7
8 pub use nrf9120_pac::NVIC_PRIO_BITS;
9
10 #[cfg(feature="rt")]
11 #[doc(no_inline)]
12 pub use nrf9120_pac::interrupt;
13
14 #[doc(no_inline)]
15 pub use nrf9120_pac::{
16 Interrupt,
17
18 cc_host_rgf_s as cc_host_rgf,
19 clock_ns as clock,
20 cryptocell_s as cryptocell,
21 ctrl_ap_peri_s as ctrl_ap_peri,
22 dppic_ns as dppic,
23 egu0_ns as egu0,
24 ficr_s as ficr,
25 fpu_ns as fpu,
26 gpiote0_s as gpiote,
27 i2s_ns as i2s,
28 ipc_ns as ipc,
29 kmu_ns as kmu,
30 nvmc_ns as nvmc,
31 p0_ns as p0,
32 pdm_ns as pdm,
33 power_ns as power,
34 pwm0_ns as pwm0,
35 regulators_ns as regulators,
36 rtc0_ns as rtc0,
37 saadc_ns as saadc,
38 spim0_ns as spim0,
39 spis0_ns as spis0,
40 spu_s as spu,
41 tad_s as tad,
42 timer0_ns as timer0,
43 twim0_ns as twim0,
44 twis0_ns as twis0,
45 uarte0_ns as uarte0,
46 uicr_s as uicr,
47 vmc_ns as vmc,
48 wdt_ns as wdt,
49 };
50
51 /// Non-Secure mode (NS) peripherals
52 pub mod ns {
53 #[doc(no_inline)]
54 pub use nrf9120_pac::{
55 CLOCK_NS as CLOCK,
56 DPPIC_NS as DPPIC,
57 EGU0_NS as EGU0,
58 EGU1_NS as EGU1,
59 EGU2_NS as EGU2,
60 EGU3_NS as EGU3,
61 EGU4_NS as EGU4,
62 EGU5_NS as EGU5,
63 FPU_NS as FPU,
64 GPIOTE1_NS as GPIOTE1,
65 I2S_NS as I2S,
66 IPC_NS as IPC,
67 KMU_NS as KMU,
68 NVMC_NS as NVMC,
69 P0_NS as P0,
70 PDM_NS as PDM,
71 POWER_NS as POWER,
72 PWM0_NS as PWM0,
73 PWM1_NS as PWM1,
74 PWM2_NS as PWM2,
75 PWM3_NS as PWM3,
76 REGULATORS_NS as REGULATORS,
77 RTC0_NS as RTC0,
78 RTC1_NS as RTC1,
79 SAADC_NS as SAADC,
80 SPIM0_NS as SPIM0,
81 SPIM1_NS as SPIM1,
82 SPIM2_NS as SPIM2,
83 SPIM3_NS as SPIM3,
84 SPIS0_NS as SPIS0,
85 SPIS1_NS as SPIS1,
86 SPIS2_NS as SPIS2,
87 SPIS3_NS as SPIS3,
88 TIMER0_NS as TIMER0,
89 TIMER1_NS as TIMER1,
90 TIMER2_NS as TIMER2,
91 TWIM0_NS as TWIM0,
92 TWIM1_NS as TWIM1,
93 TWIM2_NS as TWIM2,
94 TWIM3_NS as TWIM3,
95 TWIS0_NS as TWIS0,
96 TWIS1_NS as TWIS1,
97 TWIS2_NS as TWIS2,
98 TWIS3_NS as TWIS3,
99 UARTE0_NS as UARTE0,
100 UARTE1_NS as UARTE1,
101 UARTE2_NS as UARTE2,
102 UARTE3_NS as UARTE3,
103 VMC_NS as VMC,
104 WDT_NS as WDT,
105 };
106 }
107
108 /// Secure mode (S) peripherals
109 pub mod s {
110 #[doc(no_inline)]
111 pub use nrf9120_pac::{
112 CC_HOST_RGF_S as CC_HOST_RGF,
113 CLOCK_S as CLOCK,
114 CRYPTOCELL_S as CRYPTOCELL,
115 CTRL_AP_PERI_S as CTRL_AP_PERI,
116 DPPIC_S as DPPIC,
117 EGU0_S as EGU0,
118 EGU1_S as EGU1,
119 EGU2_S as EGU2,
120 EGU3_S as EGU3,
121 EGU4_S as EGU4,
122 EGU5_S as EGU5,
123 FICR_S as FICR,
124 FPU as FPU,
125 GPIOTE0_S as GPIOTE0,
126 I2S_S as I2S,
127 IPC_S as IPC,
128 KMU_S as KMU,
129 NVMC_S as NVMC,
130 P0_S as P0,
131 PDM_S as PDM,
132 POWER_S as POWER,
133 PWM0_S as PWM0,
134 PWM1_S as PWM1,
135 PWM2_S as PWM2,
136 PWM3_S as PWM3,
137 REGULATORS_S as REGULATORS,
138 RTC0_S as RTC0,
139 RTC1_S as RTC1,
140 SAADC_S as SAADC,
141 SPIM0_S as SPIM0,
142 SPIM1_S as SPIM1,
143 SPIM2_S as SPIM2,
144 SPIM3_S as SPIM3,
145 SPIS0_S as SPIS0,
146 SPIS1_S as SPIS1,
147 SPIS2_S as SPIS2,
148 SPIS3_S as SPIS3,
149 SPU_S as SPU,
150 TAD_S as TAD,
151 TIMER0_S as TIMER0,
152 TIMER1_S as TIMER1,
153 TIMER2_S as TIMER2,
154 TWIM0_S as TWIM0,
155 TWIM1_S as TWIM1,
156 TWIM2_S as TWIM2,
157 TWIM3_S as TWIM3,
158 TWIS0_S as TWIS0,
159 TWIS1_S as TWIS1,
160 TWIS2_S as TWIS2,
161 TWIS3_S as TWIS3,
162 UARTE0_S as UARTE0,
163 UARTE1_S as UARTE1,
164 UARTE2_S as UARTE2,
165 UARTE3_S as UARTE3,
166 UICR_S as UICR,
167 VMC_S as VMC,
168 WDT_S as WDT,
169 };
170 }
171
172 #[cfg(feature = "_ns")]
173 pub use ns::*;
174 #[cfg(feature = "_s")]
175 pub use s::*;
176}
177
178/// The maximum buffer size that the EasyDMA can send/recv in one operation.
179pub const EASY_DMA_SIZE: usize = (1 << 13) - 1;
180pub const FORCE_COPY_BUFFER_SIZE: usize = 1024;
181
182pub const FLASH_SIZE: usize = 1024 * 1024;
183
184embassy_hal_internal::peripherals! {
185 // RTC
186 RTC0,
187 RTC1,
188
189 // WDT
190 WDT,
191
192 // NVMC
193 NVMC,
194
195 // UARTE, TWI & SPI
196 SERIAL0,
197 SERIAL1,
198 SERIAL2,
199 SERIAL3,
200
201 // SAADC
202 SAADC,
203
204 // PWM
205 PWM0,
206 PWM1,
207 PWM2,
208 PWM3,
209
210 // TIMER
211 TIMER0,
212 TIMER1,
213 TIMER2,
214
215 // GPIOTE
216 GPIOTE_CH0,
217 GPIOTE_CH1,
218 GPIOTE_CH2,
219 GPIOTE_CH3,
220 GPIOTE_CH4,
221 GPIOTE_CH5,
222 GPIOTE_CH6,
223 GPIOTE_CH7,
224
225 // PPI
226 PPI_CH0,
227 PPI_CH1,
228 PPI_CH2,
229 PPI_CH3,
230 PPI_CH4,
231 PPI_CH5,
232 PPI_CH6,
233 PPI_CH7,
234 PPI_CH8,
235 PPI_CH9,
236 PPI_CH10,
237 PPI_CH11,
238 PPI_CH12,
239 PPI_CH13,
240 PPI_CH14,
241 PPI_CH15,
242
243 PPI_GROUP0,
244 PPI_GROUP1,
245 PPI_GROUP2,
246 PPI_GROUP3,
247 PPI_GROUP4,
248 PPI_GROUP5,
249
250 // GPIO port 0
251 P0_00,
252 P0_01,
253 P0_02,
254 P0_03,
255 P0_04,
256 P0_05,
257 P0_06,
258 P0_07,
259 P0_08,
260 P0_09,
261 P0_10,
262 P0_11,
263 P0_12,
264 P0_13,
265 P0_14,
266 P0_15,
267 P0_16,
268 P0_17,
269 P0_18,
270 P0_19,
271 P0_20,
272 P0_21,
273 P0_22,
274 P0_23,
275 P0_24,
276 P0_25,
277 P0_26,
278 P0_27,
279 P0_28,
280 P0_29,
281 P0_30,
282 P0_31,
283
284 // PDM
285 PDM,
286
287 // EGU
288 EGU0,
289 EGU1,
290 EGU2,
291 EGU3,
292 EGU4,
293 EGU5,
294}
295
296impl_uarte!(SERIAL0, UARTE0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0);
297impl_uarte!(SERIAL1, UARTE1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1);
298impl_uarte!(SERIAL2, UARTE2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2);
299impl_uarte!(SERIAL3, UARTE3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3);
300
301impl_spim!(SERIAL0, SPIM0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0);
302impl_spim!(SERIAL1, SPIM1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1);
303impl_spim!(SERIAL2, SPIM2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2);
304impl_spim!(SERIAL3, SPIM3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3);
305
306impl_spis!(SERIAL0, SPIS0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0);
307impl_spis!(SERIAL1, SPIS1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1);
308impl_spis!(SERIAL2, SPIS2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2);
309impl_spis!(SERIAL3, SPIS3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3);
310
311impl_twim!(SERIAL0, TWIM0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0);
312impl_twim!(SERIAL1, TWIM1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1);
313impl_twim!(SERIAL2, TWIM2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2);
314impl_twim!(SERIAL3, TWIM3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3);
315
316impl_twis!(SERIAL0, TWIS0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0);
317impl_twis!(SERIAL1, TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1);
318impl_twis!(SERIAL2, TWIS2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2);
319impl_twis!(SERIAL3, TWIS3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3);
320
321impl_pwm!(PWM0, PWM0, PWM0);
322impl_pwm!(PWM1, PWM1, PWM1);
323impl_pwm!(PWM2, PWM2, PWM2);
324impl_pwm!(PWM3, PWM3, PWM3);
325
326impl_pdm!(PDM, PDM, PDM);
327
328impl_timer!(TIMER0, TIMER0, TIMER0);
329impl_timer!(TIMER1, TIMER1, TIMER1);
330impl_timer!(TIMER2, TIMER2, TIMER2);
331
332impl_pin!(P0_00, 0, 0);
333impl_pin!(P0_01, 0, 1);
334impl_pin!(P0_02, 0, 2);
335impl_pin!(P0_03, 0, 3);
336impl_pin!(P0_04, 0, 4);
337impl_pin!(P0_05, 0, 5);
338impl_pin!(P0_06, 0, 6);
339impl_pin!(P0_07, 0, 7);
340impl_pin!(P0_08, 0, 8);
341impl_pin!(P0_09, 0, 9);
342impl_pin!(P0_10, 0, 10);
343impl_pin!(P0_11, 0, 11);
344impl_pin!(P0_12, 0, 12);
345impl_pin!(P0_13, 0, 13);
346impl_pin!(P0_14, 0, 14);
347impl_pin!(P0_15, 0, 15);
348impl_pin!(P0_16, 0, 16);
349impl_pin!(P0_17, 0, 17);
350impl_pin!(P0_18, 0, 18);
351impl_pin!(P0_19, 0, 19);
352impl_pin!(P0_20, 0, 20);
353impl_pin!(P0_21, 0, 21);
354impl_pin!(P0_22, 0, 22);
355impl_pin!(P0_23, 0, 23);
356impl_pin!(P0_24, 0, 24);
357impl_pin!(P0_25, 0, 25);
358impl_pin!(P0_26, 0, 26);
359impl_pin!(P0_27, 0, 27);
360impl_pin!(P0_28, 0, 28);
361impl_pin!(P0_29, 0, 29);
362impl_pin!(P0_30, 0, 30);
363impl_pin!(P0_31, 0, 31);
364
365impl_ppi_channel!(PPI_CH0, 0 => configurable);
366impl_ppi_channel!(PPI_CH1, 1 => configurable);
367impl_ppi_channel!(PPI_CH2, 2 => configurable);
368impl_ppi_channel!(PPI_CH3, 3 => configurable);
369impl_ppi_channel!(PPI_CH4, 4 => configurable);
370impl_ppi_channel!(PPI_CH5, 5 => configurable);
371impl_ppi_channel!(PPI_CH6, 6 => configurable);
372impl_ppi_channel!(PPI_CH7, 7 => configurable);
373impl_ppi_channel!(PPI_CH8, 8 => configurable);
374impl_ppi_channel!(PPI_CH9, 9 => configurable);
375impl_ppi_channel!(PPI_CH10, 10 => configurable);
376impl_ppi_channel!(PPI_CH11, 11 => configurable);
377impl_ppi_channel!(PPI_CH12, 12 => configurable);
378impl_ppi_channel!(PPI_CH13, 13 => configurable);
379impl_ppi_channel!(PPI_CH14, 14 => configurable);
380impl_ppi_channel!(PPI_CH15, 15 => configurable);
381
382impl_saadc_input!(P0_13, ANALOG_INPUT0);
383impl_saadc_input!(P0_14, ANALOG_INPUT1);
384impl_saadc_input!(P0_15, ANALOG_INPUT2);
385impl_saadc_input!(P0_16, ANALOG_INPUT3);
386impl_saadc_input!(P0_17, ANALOG_INPUT4);
387impl_saadc_input!(P0_18, ANALOG_INPUT5);
388impl_saadc_input!(P0_19, ANALOG_INPUT6);
389impl_saadc_input!(P0_20, ANALOG_INPUT7);
390
391impl_egu!(EGU0, EGU0, EGU0);
392impl_egu!(EGU1, EGU1, EGU1);
393impl_egu!(EGU2, EGU2, EGU2);
394impl_egu!(EGU3, EGU3, EGU3);
395impl_egu!(EGU4, EGU4, EGU4);
396impl_egu!(EGU5, EGU5, EGU5);
397
398embassy_hal_internal::interrupt_mod!(
399 SPU,
400 CLOCK_POWER,
401 SPIM0_SPIS0_TWIM0_TWIS0_UARTE0,
402 SPIM1_SPIS1_TWIM1_TWIS1_UARTE1,
403 SPIM2_SPIS2_TWIM2_TWIS2_UARTE2,
404 SPIM3_SPIS3_TWIM3_TWIS3_UARTE3,
405 GPIOTE0,
406 SAADC,
407 TIMER0,
408 TIMER1,
409 TIMER2,
410 RTC0,
411 RTC1,
412 WDT,
413 EGU0,
414 EGU1,
415 EGU2,
416 EGU3,
417 EGU4,
418 EGU5,
419 PWM0,
420 PWM1,
421 PWM2,
422 PDM,
423 PWM3,
424 I2S,
425 IPC,
426 FPU,
427 GPIOTE1,
428 KMU,
429 CRYPTOCELL,
430);
diff --git a/embassy-nrf/src/fmt.rs b/embassy-nrf/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-nrf/src/fmt.rs
+++ b/embassy-nrf/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs
index a74b3157b..9d97c7be9 100644
--- a/embassy-nrf/src/gpiote.rs
+++ b/embassy-nrf/src/gpiote.rs
@@ -53,9 +53,9 @@ pub enum OutputChannelPolarity {
53 53
54fn regs() -> &'static pac::gpiote::RegisterBlock { 54fn regs() -> &'static pac::gpiote::RegisterBlock {
55 cfg_if::cfg_if! { 55 cfg_if::cfg_if! {
56 if #[cfg(any(feature="nrf5340-app-s", feature="nrf9160-s"))] { 56 if #[cfg(any(feature="nrf5340-app-s", feature="nrf9160-s", feature="nrf9120-s"))] {
57 unsafe { &*pac::GPIOTE0::ptr() } 57 unsafe { &*pac::GPIOTE0::ptr() }
58 } else if #[cfg(any(feature="nrf5340-app-ns", feature="nrf9160-ns"))] { 58 } else if #[cfg(any(feature="nrf5340-app-ns", feature="nrf9160-ns", feature="nrf9120-ns"))] {
59 unsafe { &*pac::GPIOTE1::ptr() } 59 unsafe { &*pac::GPIOTE1::ptr() }
60 } else { 60 } else {
61 unsafe { &*pac::GPIOTE::ptr() } 61 unsafe { &*pac::GPIOTE::ptr() }
@@ -81,9 +81,9 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) {
81 } 81 }
82 82
83 // Enable interrupts 83 // Enable interrupts
84 #[cfg(any(feature = "nrf5340-app-s", feature = "nrf9160-s"))] 84 #[cfg(any(feature = "nrf5340-app-s", feature = "nrf9160-s", feature = "nrf9120-s"))]
85 let irq = interrupt::GPIOTE0; 85 let irq = interrupt::GPIOTE0;
86 #[cfg(any(feature = "nrf5340-app-ns", feature = "nrf9160-ns"))] 86 #[cfg(any(feature = "nrf5340-app-ns", feature = "nrf9160-ns", feature = "nrf9120-ns"))]
87 let irq = interrupt::GPIOTE1; 87 let irq = interrupt::GPIOTE1;
88 #[cfg(any(feature = "_nrf51", feature = "_nrf52", feature = "nrf5340-net"))] 88 #[cfg(any(feature = "_nrf51", feature = "_nrf52", feature = "nrf5340-net"))]
89 let irq = interrupt::GPIOTE; 89 let irq = interrupt::GPIOTE;
@@ -96,14 +96,14 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) {
96 g.intenset.write(|w| w.port().set()); 96 g.intenset.write(|w| w.port().set());
97} 97}
98 98
99#[cfg(any(feature = "nrf5340-app-s", feature = "nrf9160-s"))] 99#[cfg(any(feature = "nrf5340-app-s", feature = "nrf9160-s", feature = "nrf9120-s"))]
100#[cfg(feature = "rt")] 100#[cfg(feature = "rt")]
101#[interrupt] 101#[interrupt]
102fn GPIOTE0() { 102fn GPIOTE0() {
103 unsafe { handle_gpiote_interrupt() }; 103 unsafe { handle_gpiote_interrupt() };
104} 104}
105 105
106#[cfg(any(feature = "nrf5340-app-ns", feature = "nrf9160-ns"))] 106#[cfg(any(feature = "nrf5340-app-ns", feature = "nrf9160-ns", feature = "nrf9120-ns"))]
107#[cfg(feature = "rt")] 107#[cfg(feature = "rt")]
108#[interrupt] 108#[interrupt]
109fn GPIOTE1() { 109fn GPIOTE1() {
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index 05b52f687..13623dd1c 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -24,8 +24,36 @@
24 feature = "nrf5340-net", 24 feature = "nrf5340-net",
25 feature = "nrf9160-s", 25 feature = "nrf9160-s",
26 feature = "nrf9160-ns", 26 feature = "nrf9160-ns",
27 feature = "nrf9120-s",
28 feature = "nrf9120-ns",
29 feature = "nrf9151-s",
30 feature = "nrf9151-ns",
31 feature = "nrf9161-s",
32 feature = "nrf9161-ns",
27)))] 33)))]
28compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840"); 34compile_error!(
35 "No chip feature activated. You must activate exactly one of the following features:
36 nrf51,
37 nrf52805,
38 nrf52810,
39 nrf52811,
40 nrf52820,
41 nrf52832,
42 nrf52833,
43 nrf52840,
44 nrf5340-app-s,
45 nrf5340-app-ns,
46 nrf5340-net,
47 nrf9160-s,
48 nrf9160-ns,
49 nrf9120-s,
50 nrf9120-ns,
51 nrf9151-s,
52 nrf9151-ns,
53 nrf9161-s,
54 nrf9161-ns,
55 "
56);
29 57
30#[cfg(all(feature = "reset-pin-as-gpio", not(feature = "_nrf52")))] 58#[cfg(all(feature = "reset-pin-as-gpio", not(feature = "_nrf52")))]
31compile_error!("feature `reset-pin-as-gpio` is only valid for nRF52 series chips."); 59compile_error!("feature `reset-pin-as-gpio` is only valid for nRF52 series chips.");
@@ -47,7 +75,7 @@ pub mod gpio;
47pub mod gpiote; 75pub mod gpiote;
48 76
49// TODO: tested on other chips 77// TODO: tested on other chips
50#[cfg(not(any(feature = "_nrf9160", feature = "_nrf5340-app")))] 78#[cfg(not(any(feature = "_nrf91", feature = "_nrf5340-app")))]
51pub mod radio; 79pub mod radio;
52 80
53#[cfg(not(feature = "nrf51"))] 81#[cfg(not(feature = "nrf51"))]
@@ -62,7 +90,7 @@ pub mod nvmc;
62 feature = "nrf52833", 90 feature = "nrf52833",
63 feature = "nrf52840", 91 feature = "nrf52840",
64 feature = "_nrf5340-app", 92 feature = "_nrf5340-app",
65 feature = "_nrf9160" 93 feature = "_nrf91",
66))] 94))]
67pub mod pdm; 95pub mod pdm;
68pub mod ppi; 96pub mod ppi;
@@ -73,11 +101,11 @@ pub mod ppi;
73 feature = "_nrf5340-net" 101 feature = "_nrf5340-net"
74)))] 102)))]
75pub mod pwm; 103pub mod pwm;
76#[cfg(not(any(feature = "nrf51", feature = "_nrf9160", feature = "_nrf5340-net")))] 104#[cfg(not(any(feature = "nrf51", feature = "_nrf91", feature = "_nrf5340-net")))]
77pub mod qdec; 105pub mod qdec;
78#[cfg(any(feature = "nrf52840", feature = "_nrf5340-app"))] 106#[cfg(any(feature = "nrf52840", feature = "_nrf5340-app"))]
79pub mod qspi; 107pub mod qspi;
80#[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf9160")))] 108#[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf91")))]
81pub mod rng; 109pub mod rng;
82#[cfg(not(any(feature = "nrf51", feature = "nrf52820", feature = "_nrf5340-net")))] 110#[cfg(not(any(feature = "nrf51", feature = "nrf52820", feature = "_nrf5340-net")))]
83pub mod saadc; 111pub mod saadc;
@@ -85,7 +113,7 @@ pub mod saadc;
85pub mod spim; 113pub mod spim;
86#[cfg(not(feature = "nrf51"))] 114#[cfg(not(feature = "nrf51"))]
87pub mod spis; 115pub mod spis;
88#[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] 116#[cfg(not(any(feature = "_nrf5340", feature = "_nrf91")))]
89pub mod temp; 117pub mod temp;
90pub mod timer; 118pub mod timer;
91#[cfg(not(feature = "nrf51"))] 119#[cfg(not(feature = "nrf51"))]
@@ -116,6 +144,7 @@ pub mod wdt;
116#[cfg_attr(feature = "_nrf5340-app", path = "chips/nrf5340_app.rs")] 144#[cfg_attr(feature = "_nrf5340-app", path = "chips/nrf5340_app.rs")]
117#[cfg_attr(feature = "_nrf5340-net", path = "chips/nrf5340_net.rs")] 145#[cfg_attr(feature = "_nrf5340-net", path = "chips/nrf5340_net.rs")]
118#[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] 146#[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")]
147#[cfg_attr(feature = "_nrf9120", path = "chips/nrf9120.rs")]
119mod chip; 148mod chip;
120 149
121/// Macro to bind interrupts to handlers. 150/// Macro to bind interrupts to handlers.
@@ -196,15 +225,15 @@ pub mod config {
196 /// Internal RC oscillator 225 /// Internal RC oscillator
197 InternalRC, 226 InternalRC,
198 /// Synthesized from the high frequency clock source. 227 /// Synthesized from the high frequency clock source.
199 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] 228 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf91")))]
200 Synthesized, 229 Synthesized,
201 /// External source from xtal. 230 /// External source from xtal.
202 ExternalXtal, 231 ExternalXtal,
203 /// External source from xtal with low swing applied. 232 /// External source from xtal with low swing applied.
204 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] 233 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf91")))]
205 ExternalLowSwing, 234 ExternalLowSwing,
206 /// External source from xtal with full swing applied. 235 /// External source from xtal with full swing applied.
207 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] 236 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf91")))]
208 ExternalFullSwing, 237 ExternalFullSwing,
209 } 238 }
210 239
@@ -222,7 +251,7 @@ pub mod config {
222 } 251 }
223 252
224 /// Settings for enabling the built in DCDC converters. 253 /// Settings for enabling the built in DCDC converters.
225 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] 254 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf91")))]
226 pub struct DcdcConfig { 255 pub struct DcdcConfig {
227 /// Config for the first stage DCDC (VDDH -> VDD), if disabled LDO will be used. 256 /// Config for the first stage DCDC (VDDH -> VDD), if disabled LDO will be used.
228 #[cfg(feature = "nrf52840")] 257 #[cfg(feature = "nrf52840")]
@@ -264,7 +293,7 @@ pub mod config {
264 } 293 }
265 294
266 /// Settings for enabling the built in DCDC converter. 295 /// Settings for enabling the built in DCDC converter.
267 #[cfg(feature = "_nrf9160")] 296 #[cfg(feature = "_nrf91")]
268 pub struct DcdcConfig { 297 pub struct DcdcConfig {
269 /// Config for the main rail, if disabled LDO will be used. 298 /// Config for the main rail, if disabled LDO will be used.
270 pub regmain: bool, 299 pub regmain: bool,
@@ -298,7 +327,7 @@ pub mod config {
298 // xtals if they know they have them. 327 // xtals if they know they have them.
299 hfclk_source: HfclkSource::Internal, 328 hfclk_source: HfclkSource::Internal,
300 lfclk_source: LfclkSource::InternalRC, 329 lfclk_source: LfclkSource::InternalRC,
301 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] 330 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf91")))]
302 dcdc: DcdcConfig { 331 dcdc: DcdcConfig {
303 #[cfg(feature = "nrf52840")] 332 #[cfg(feature = "nrf52840")]
304 reg0: false, 333 reg0: false,
@@ -312,7 +341,7 @@ pub mod config {
312 regmain: false, 341 regmain: false,
313 regradio: false, 342 regradio: false,
314 }, 343 },
315 #[cfg(feature = "_nrf9160")] 344 #[cfg(feature = "_nrf91")]
316 dcdc: DcdcConfig { regmain: false }, 345 dcdc: DcdcConfig { regmain: false },
317 #[cfg(feature = "gpiote")] 346 #[cfg(feature = "gpiote")]
318 gpiote_interrupt_priority: crate::interrupt::Priority::P0, 347 gpiote_interrupt_priority: crate::interrupt::Priority::P0,
@@ -329,7 +358,7 @@ pub mod config {
329 } 358 }
330} 359}
331 360
332#[cfg(feature = "_nrf9160")] 361#[cfg(feature = "_nrf91")]
333#[allow(unused)] 362#[allow(unused)]
334mod consts { 363mod consts {
335 pub const UICR_APPROTECT: *mut u32 = 0x00FF8000 as *mut u32; 364 pub const UICR_APPROTECT: *mut u32 = 0x00FF8000 as *mut u32;
@@ -468,7 +497,7 @@ pub fn init(config: config::Config) -> Peripherals {
468 // UICR.APPROTECT = Enabled 497 // UICR.APPROTECT = Enabled
469 let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_ENABLED); 498 let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_ENABLED);
470 needs_reset |= res == WriteResult::Written; 499 needs_reset |= res == WriteResult::Written;
471 #[cfg(any(feature = "_nrf5340-app", feature = "_nrf9160"))] 500 #[cfg(any(feature = "_nrf5340-app", feature = "_nrf91"))]
472 { 501 {
473 let res = uicr_write(consts::UICR_SECUREAPPROTECT, consts::APPROTECT_ENABLED); 502 let res = uicr_write(consts::UICR_SECUREAPPROTECT, consts::APPROTECT_ENABLED);
474 needs_reset |= res == WriteResult::Written; 503 needs_reset |= res == WriteResult::Written;
@@ -552,7 +581,7 @@ pub fn init(config: config::Config) -> Peripherals {
552 } 581 }
553 582
554 // Configure LFCLK. 583 // Configure LFCLK.
555 #[cfg(not(any(feature = "nrf51", feature = "_nrf5340", feature = "_nrf9160")))] 584 #[cfg(not(any(feature = "nrf51", feature = "_nrf5340", feature = "_nrf91")))]
556 match config.lfclk_source { 585 match config.lfclk_source {
557 config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()), 586 config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()),
558 config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()), 587 config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()),
@@ -572,7 +601,7 @@ pub fn init(config: config::Config) -> Peripherals {
572 w 601 w
573 }), 602 }),
574 } 603 }
575 #[cfg(feature = "_nrf9160")] 604 #[cfg(feature = "_nrf91")]
576 match config.lfclk_source { 605 match config.lfclk_source {
577 config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().lfrc()), 606 config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().lfrc()),
578 config::LfclkSource::ExternalXtal => r.lfclksrc.write(|w| w.src().lfxo()), 607 config::LfclkSource::ExternalXtal => r.lfclksrc.write(|w| w.src().lfxo()),
@@ -585,7 +614,7 @@ pub fn init(config: config::Config) -> Peripherals {
585 r.tasks_lfclkstart.write(|w| unsafe { w.bits(1) }); 614 r.tasks_lfclkstart.write(|w| unsafe { w.bits(1) });
586 while r.events_lfclkstarted.read().bits() == 0 {} 615 while r.events_lfclkstarted.read().bits() == 0 {}
587 616
588 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] 617 #[cfg(not(any(feature = "_nrf5340", feature = "_nrf91")))]
589 { 618 {
590 // Setup DCDCs. 619 // Setup DCDCs.
591 let pwr = unsafe { &*pac::POWER::ptr() }; 620 let pwr = unsafe { &*pac::POWER::ptr() };
@@ -597,7 +626,7 @@ pub fn init(config: config::Config) -> Peripherals {
597 pwr.dcdcen.write(|w| w.dcdcen().set_bit()); 626 pwr.dcdcen.write(|w| w.dcdcen().set_bit());
598 } 627 }
599 } 628 }
600 #[cfg(feature = "_nrf9160")] 629 #[cfg(feature = "_nrf91")]
601 { 630 {
602 // Setup DCDC. 631 // Setup DCDC.
603 let reg = unsafe { &*pac::REGULATORS::ptr() }; 632 let reg = unsafe { &*pac::REGULATORS::ptr() };
@@ -629,7 +658,7 @@ pub fn init(config: config::Config) -> Peripherals {
629 time_driver::init(config.time_interrupt_priority); 658 time_driver::init(config.time_interrupt_priority);
630 659
631 // Disable UARTE (enabled by default for some reason) 660 // Disable UARTE (enabled by default for some reason)
632 #[cfg(feature = "_nrf9160")] 661 #[cfg(feature = "_nrf91")]
633 unsafe { 662 unsafe {
634 (*pac::UARTE0::ptr()).enable.write(|w| w.enable().disabled()); 663 (*pac::UARTE0::ptr()).enable.write(|w| w.enable().disabled());
635 (*pac::UARTE1::ptr()).enable.write(|w| w.enable().disabled()); 664 (*pac::UARTE1::ptr()).enable.write(|w| w.enable().disabled());
diff --git a/embassy-nrf/src/nvmc.rs b/embassy-nrf/src/nvmc.rs
index 4f9eda167..9b17e7da0 100644
--- a/embassy-nrf/src/nvmc.rs
+++ b/embassy-nrf/src/nvmc.rs
@@ -60,23 +60,23 @@ impl<'d> Nvmc<'d> {
60 while p.ready.read().ready().is_busy() {} 60 while p.ready.read().ready().is_busy() {}
61 } 61 }
62 62
63 #[cfg(not(any(feature = "_nrf9160", feature = "_nrf5340")))] 63 #[cfg(not(any(feature = "_nrf91", feature = "_nrf5340")))]
64 fn wait_ready_write(&mut self) { 64 fn wait_ready_write(&mut self) {
65 self.wait_ready(); 65 self.wait_ready();
66 } 66 }
67 67
68 #[cfg(any(feature = "_nrf9160", feature = "_nrf5340"))] 68 #[cfg(any(feature = "_nrf91", feature = "_nrf5340"))]
69 fn wait_ready_write(&mut self) { 69 fn wait_ready_write(&mut self) {
70 let p = Self::regs(); 70 let p = Self::regs();
71 while p.readynext.read().readynext().is_busy() {} 71 while p.readynext.read().readynext().is_busy() {}
72 } 72 }
73 73
74 #[cfg(not(any(feature = "_nrf9160", feature = "_nrf5340")))] 74 #[cfg(not(any(feature = "_nrf91", feature = "_nrf5340")))]
75 fn erase_page(&mut self, page_addr: u32) { 75 fn erase_page(&mut self, page_addr: u32) {
76 Self::regs().erasepage().write(|w| unsafe { w.bits(page_addr) }); 76 Self::regs().erasepage().write(|w| unsafe { w.bits(page_addr) });
77 } 77 }
78 78
79 #[cfg(any(feature = "_nrf9160", feature = "_nrf5340"))] 79 #[cfg(any(feature = "_nrf91", feature = "_nrf5340"))]
80 fn erase_page(&mut self, page_addr: u32) { 80 fn erase_page(&mut self, page_addr: u32) {
81 let first_page_word = page_addr as *mut u32; 81 let first_page_word = page_addr as *mut u32;
82 unsafe { 82 unsafe {
diff --git a/embassy-nrf/src/pdm.rs b/embassy-nrf/src/pdm.rs
index c1501e02e..5160fe3c4 100644
--- a/embassy-nrf/src/pdm.rs
+++ b/embassy-nrf/src/pdm.rs
@@ -21,7 +21,7 @@ pub use crate::pac::pdm::pdmclkctrl::FREQ_A as Frequency;
21 feature = "nrf52840", 21 feature = "nrf52840",
22 feature = "nrf52833", 22 feature = "nrf52833",
23 feature = "_nrf5340-app", 23 feature = "_nrf5340-app",
24 feature = "_nrf9160", 24 feature = "_nrf91",
25))] 25))]
26pub use crate::pac::pdm::ratio::RATIO_A as Ratio; 26pub use crate::pac::pdm::ratio::RATIO_A as Ratio;
27use crate::{interrupt, Peripheral}; 27use crate::{interrupt, Peripheral};
@@ -121,7 +121,7 @@ impl<'d, T: Instance> Pdm<'d, T> {
121 feature = "nrf52840", 121 feature = "nrf52840",
122 feature = "nrf52833", 122 feature = "nrf52833",
123 feature = "_nrf5340-app", 123 feature = "_nrf5340-app",
124 feature = "_nrf9160", 124 feature = "_nrf91",
125 ))] 125 ))]
126 r.ratio.write(|w| w.ratio().variant(config.ratio)); 126 r.ratio.write(|w| w.ratio().variant(config.ratio));
127 r.mode.write(|w| { 127 r.mode.write(|w| {
@@ -374,7 +374,7 @@ pub struct Config {
374 feature = "nrf52840", 374 feature = "nrf52840",
375 feature = "nrf52833", 375 feature = "nrf52833",
376 feature = "_nrf5340-app", 376 feature = "_nrf5340-app",
377 feature = "_nrf9160", 377 feature = "_nrf91",
378 ))] 378 ))]
379 pub ratio: Ratio, 379 pub ratio: Ratio,
380 /// Gain left in dB 380 /// Gain left in dB
@@ -393,7 +393,7 @@ impl Default for Config {
393 feature = "nrf52840", 393 feature = "nrf52840",
394 feature = "nrf52833", 394 feature = "nrf52833",
395 feature = "_nrf5340-app", 395 feature = "_nrf5340-app",
396 feature = "_nrf9160", 396 feature = "_nrf91",
397 ))] 397 ))]
398 ratio: Ratio::RATIO80, 398 ratio: Ratio::RATIO80,
399 gain_left: I7F1::ZERO, 399 gain_left: I7F1::ZERO,
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs
index 17c65fa3e..a3a5b9cfe 100644
--- a/embassy-nrf/src/saadc.rs
+++ b/embassy-nrf/src/saadc.rs
@@ -722,9 +722,9 @@ macro_rules! impl_saadc_input {
722pub struct VddInput; 722pub struct VddInput;
723 723
724impl_peripheral!(VddInput); 724impl_peripheral!(VddInput);
725#[cfg(not(feature = "_nrf9160"))] 725#[cfg(not(feature = "_nrf91"))]
726impl_saadc_input!(@local, VddInput, VDD); 726impl_saadc_input!(@local, VddInput, VDD);
727#[cfg(feature = "_nrf9160")] 727#[cfg(feature = "_nrf91")]
728impl_saadc_input!(@local, VddInput, VDDGPIO); 728impl_saadc_input!(@local, VddInput, VDDGPIO);
729 729
730/// A dummy `Input` pin implementation for SAADC peripheral sampling from the 730/// A dummy `Input` pin implementation for SAADC peripheral sampling from the
diff --git a/embassy-nrf/src/wdt.rs b/embassy-nrf/src/wdt.rs
index 40a674424..5a261ce8f 100644
--- a/embassy-nrf/src/wdt.rs
+++ b/embassy-nrf/src/wdt.rs
@@ -30,9 +30,9 @@ impl Config {
30 pub fn try_new(_wdt: &peripherals::WDT) -> Option<Self> { 30 pub fn try_new(_wdt: &peripherals::WDT) -> Option<Self> {
31 let r = unsafe { &*WDT::ptr() }; 31 let r = unsafe { &*WDT::ptr() };
32 32
33 #[cfg(not(feature = "_nrf9160"))] 33 #[cfg(not(feature = "_nrf91"))]
34 let runstatus = r.runstatus.read().runstatus().bit(); 34 let runstatus = r.runstatus.read().runstatus().bit();
35 #[cfg(feature = "_nrf9160")] 35 #[cfg(feature = "_nrf91")]
36 let runstatus = r.runstatus.read().runstatuswdt().bit(); 36 let runstatus = r.runstatus.read().runstatuswdt().bit();
37 37
38 if runstatus { 38 if runstatus {
@@ -83,9 +83,9 @@ impl Watchdog {
83 let crv = config.timeout_ticks.max(MIN_TICKS); 83 let crv = config.timeout_ticks.max(MIN_TICKS);
84 let rren = (1u32 << N) - 1; 84 let rren = (1u32 << N) - 1;
85 85
86 #[cfg(not(feature = "_nrf9160"))] 86 #[cfg(not(feature = "_nrf91"))]
87 let runstatus = r.runstatus.read().runstatus().bit(); 87 let runstatus = r.runstatus.read().runstatus().bit();
88 #[cfg(feature = "_nrf9160")] 88 #[cfg(feature = "_nrf91")]
89 let runstatus = r.runstatus.read().runstatuswdt().bit(); 89 let runstatus = r.runstatus.read().runstatuswdt().bit();
90 90
91 if runstatus { 91 if runstatus {
diff --git a/embassy-rp/CHANGELOG.md b/embassy-rp/CHANGELOG.md
new file mode 100644
index 000000000..7eef64292
--- /dev/null
+++ b/embassy-rp/CHANGELOG.md
@@ -0,0 +1,32 @@
1# Changelog for embassy-rp
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8## Unreleased
9
10## 0.2.0 - 2024-08-05
11
12- Add read_to_break_with_count
13- add option to provide your own boot2
14- Add multichannel ADC
15- Add collapse_debuginfo to fmt.rs macros.
16- Use raw slices .len() method instead of unsafe hacks.
17- Add missing word "pin" in rp pwm documentation
18- Add Clone and Copy to Error types
19- fix spinlocks staying locked after reset.
20- wait until read matches for PSM accesses.
21- Remove generics
22- fix drop implementation of BufferedUartRx and BufferedUartTx
23- implement `embedded_storage_async::nor_flash::MultiwriteNorFlash`
24- rp usb: wake ep-wakers after stalling
25- rp usb: add stall implementation
26- Add parameter for enabling pull-up and pull-down in RP PWM input mode
27- rp: remove mod sealed.
28- rename pins data type and the macro
29- rename pwm channels to pwm slices, including in documentation
30- rename the Channel trait to Slice and the PwmPin to PwmChannel
31- i2c: Fix race condition that appears on fast repeated transfers.
32- Add a basic "read to break" function
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml
index 447c96b4d..f6c0fba2d 100644
--- a/embassy-rp/Cargo.toml
+++ b/embassy-rp/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-rp" 2name = "embassy-rp"
3version = "0.1.0" 3version = "0.2.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for the Raspberry Pi RP2040 microcontroller" 6description = "Embassy Hardware Abstraction Layer (HAL) for the Raspberry Pi RP2040 microcontroller"
@@ -91,10 +91,10 @@ boot2-none = []
91[dependencies] 91[dependencies]
92embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 92embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
93embassy-time-driver = { version = "0.1", path = "../embassy-time-driver", optional = true } 93embassy-time-driver = { version = "0.1", path = "../embassy-time-driver", optional = true }
94embassy-time = { version = "0.3.1", path = "../embassy-time" } 94embassy-time = { version = "0.3.2", path = "../embassy-time" }
95embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 95embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
96embassy-hal-internal = {version = "0.1.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-2"] } 96embassy-hal-internal = {version = "0.2.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-2"] }
97embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } 97embassy-embedded-hal = {version = "0.2.0", path = "../embassy-embedded-hal" }
98embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" } 98embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" }
99atomic-polyfill = "1.0.1" 99atomic-polyfill = "1.0.1"
100defmt = { version = "0.3", optional = true } 100defmt = { version = "0.3", optional = true }
@@ -125,5 +125,5 @@ rp2040-boot2 = "0.3"
125document-features = "0.2.7" 125document-features = "0.2.7"
126 126
127[dev-dependencies] 127[dev-dependencies]
128embassy-executor = { version = "0.5.0", path = "../embassy-executor", features = ["arch-std", "executor-thread"] } 128embassy-executor = { version = "0.6.0", path = "../embassy-executor", features = ["arch-std", "executor-thread"] }
129static_cell = { version = "2" } 129static_cell = { version = "2" }
diff --git a/embassy-rp/README.md b/embassy-rp/README.md
index 8cf7da994..16b189344 100644
--- a/embassy-rp/README.md
+++ b/embassy-rp/README.md
@@ -23,5 +23,5 @@ The `embassy-rp` HAL implements the traits from [embedded-hal](https://crates.io
23 23
24This crate can run on any executor. 24This crate can run on any executor.
25 25
26Optionally, some features requiring [`embassy-time`](https://crates.io/crates/embassy-time) can be activated with the `time` feature. If you enable it, 26Optionally, some features requiring [`embassy-time`](https://crates.io/crates/embassy-time) can be activated with the `time-driver` feature. If you enable it,
27you must link an `embassy-time` driver in your project. 27you must link an `embassy-time` driver in your project.
diff --git a/embassy-rp/src/bootsel.rs b/embassy-rp/src/bootsel.rs
index 540255ae3..d24ce7bd8 100644
--- a/embassy-rp/src/bootsel.rs
+++ b/embassy-rp/src/bootsel.rs
@@ -57,9 +57,9 @@ mod ram_helpers {
57 "str {val}, [{cs_gpio}, $GPIO_CTRL]", 57 "str {val}, [{cs_gpio}, $GPIO_CTRL]",
58 58
59 // ...then wait for the state to settle... 59 // ...then wait for the state to settle...
60 "1:", // ~4000 cycle delay loop 60 "2:", // ~4000 cycle delay loop
61 "subs {val}, #8", 61 "subs {val}, #8",
62 "bne 1b", 62 "bne 2b",
63 63
64 // ...we can read the current state of bootsel 64 // ...we can read the current state of bootsel
65 "ldr {val}, [{cs_gpio}, $GPIO_STATUS]", 65 "ldr {val}, [{cs_gpio}, $GPIO_STATUS]",
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs
index 6e2a823d8..9e4542b2f 100644
--- a/embassy-rp/src/flash.rs
+++ b/embassy-rp/src/flash.rs
@@ -625,18 +625,18 @@ mod ram_helpers {
625 "movs r3, #0", // r3 = 0 625 "movs r3, #0", // r3 = 0
626 "ldr r4, [{ptrs}, #8]", 626 "ldr r4, [{ptrs}, #8]",
627 "cmp r4, #0", 627 "cmp r4, #0",
628 "beq 1f", 628 "beq 2f",
629 "blx r4", // flash_range_erase(addr, len, 1 << 31, 0) 629 "blx r4", // flash_range_erase(addr, len, 1 << 31, 0)
630 "1:", 630 "2:",
631 631
632 "mov r0, r8", // r0 = addr 632 "mov r0, r8", // r0 = addr
633 "mov r1, r9", // r0 = data 633 "mov r1, r9", // r0 = data
634 "mov r2, r10", // r2 = len 634 "mov r2, r10", // r2 = len
635 "ldr r4, [{ptrs}, #12]", 635 "ldr r4, [{ptrs}, #12]",
636 "cmp r4, #0", 636 "cmp r4, #0",
637 "beq 1f", 637 "beq 2f",
638 "blx r4", // flash_range_program(addr, data, len); 638 "blx r4", // flash_range_program(addr, data, len);
639 "1:", 639 "2:",
640 640
641 "ldr r4, [{ptrs}, #16]", 641 "ldr r4, [{ptrs}, #16]",
642 "blx r4", // flash_flush_cache(); 642 "blx r4", // flash_flush_cache();
@@ -802,12 +802,12 @@ mod ram_helpers {
802 "adds r2, 0x60", // &DR 802 "adds r2, 0x60", // &DR
803 "ldr r0, [r3, #0]", // cmd_addr 803 "ldr r0, [r3, #0]", // cmd_addr
804 "ldr r1, [r3, #4]", // cmd_addr_len 804 "ldr r1, [r3, #4]", // cmd_addr_len
805 "10:", 805 "3:",
806 "ldrb r3, [r0]", 806 "ldrb r3, [r0]",
807 "strb r3, [r2]", // DR 807 "strb r3, [r2]", // DR
808 "adds r0, #1", 808 "adds r0, #1",
809 "subs r1, #1", 809 "subs r1, #1",
810 "bne 10b", 810 "bne 3b",
811 811
812 // Skip any dummy cycles 812 // Skip any dummy cycles
813 "mov r3, r10", // cmd 813 "mov r3, r10", // cmd
diff --git a/embassy-rp/src/fmt.rs b/embassy-rp/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-rp/src/fmt.rs
+++ b/embassy-rp/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs
index 10d3c86b3..ac2b1bc5a 100644
--- a/embassy-rp/src/i2c.rs
+++ b/embassy-rp/src/i2c.rs
@@ -312,13 +312,13 @@ impl<'d, T: Instance> I2c<'d, T, Async> {
312 } 312 }
313 } 313 }
314 314
315 /// Read from address into buffer using DMA. 315 /// Read from address into buffer asynchronously.
316 pub async fn read_async(&mut self, addr: impl Into<u16>, buffer: &mut [u8]) -> Result<(), Error> { 316 pub async fn read_async(&mut self, addr: impl Into<u16>, buffer: &mut [u8]) -> Result<(), Error> {
317 Self::setup(addr.into())?; 317 Self::setup(addr.into())?;
318 self.read_async_internal(buffer, true, true).await 318 self.read_async_internal(buffer, true, true).await
319 } 319 }
320 320
321 /// Write to address from buffer using DMA. 321 /// Write to address from buffer asynchronously.
322 pub async fn write_async( 322 pub async fn write_async(
323 &mut self, 323 &mut self,
324 addr: impl Into<u16>, 324 addr: impl Into<u16>,
@@ -328,7 +328,7 @@ impl<'d, T: Instance> I2c<'d, T, Async> {
328 self.write_async_internal(bytes, true).await 328 self.write_async_internal(bytes, true).await
329 } 329 }
330 330
331 /// Write to address from bytes and read from address into buffer using DMA. 331 /// Write to address from bytes and read from address into buffer asynchronously.
332 pub async fn write_read_async( 332 pub async fn write_read_async(
333 &mut self, 333 &mut self,
334 addr: impl Into<u16>, 334 addr: impl Into<u16>,
@@ -779,9 +779,6 @@ pub fn i2c_reserved_addr(addr: u16) -> bool {
779} 779}
780 780
781pub(crate) trait SealedInstance { 781pub(crate) trait SealedInstance {
782 const TX_DREQ: u8;
783 const RX_DREQ: u8;
784
785 fn regs() -> crate::pac::i2c::I2c; 782 fn regs() -> crate::pac::i2c::I2c;
786 fn reset() -> crate::pac::resets::regs::Peripherals; 783 fn reset() -> crate::pac::resets::regs::Peripherals;
787 fn waker() -> &'static AtomicWaker; 784 fn waker() -> &'static AtomicWaker;
@@ -816,11 +813,8 @@ pub trait Instance: SealedInstance {
816} 813}
817 814
818macro_rules! impl_instance { 815macro_rules! impl_instance {
819 ($type:ident, $irq:ident, $reset:ident, $tx_dreq:expr, $rx_dreq:expr) => { 816 ($type:ident, $irq:ident, $reset:ident) => {
820 impl SealedInstance for peripherals::$type { 817 impl SealedInstance for peripherals::$type {
821 const TX_DREQ: u8 = $tx_dreq;
822 const RX_DREQ: u8 = $rx_dreq;
823
824 #[inline] 818 #[inline]
825 fn regs() -> pac::i2c::I2c { 819 fn regs() -> pac::i2c::I2c {
826 pac::$type 820 pac::$type
@@ -846,8 +840,8 @@ macro_rules! impl_instance {
846 }; 840 };
847} 841}
848 842
849impl_instance!(I2C0, I2C0_IRQ, set_i2c0, 32, 33); 843impl_instance!(I2C0, I2C0_IRQ, set_i2c0);
850impl_instance!(I2C1, I2C1_IRQ, set_i2c1, 34, 35); 844impl_instance!(I2C1, I2C1_IRQ, set_i2c1);
851 845
852/// SDA pin. 846/// SDA pin.
853pub trait SdaPin<T: Instance>: crate::gpio::Pin {} 847pub trait SdaPin<T: Instance>: crate::gpio::Pin {}
diff --git a/embassy-rp/src/uart/buffered.rs b/embassy-rp/src/uart/buffered.rs
index c94164040..152a432c9 100644
--- a/embassy-rp/src/uart/buffered.rs
+++ b/embassy-rp/src/uart/buffered.rs
@@ -163,9 +163,21 @@ impl<'d, T: Instance> BufferedUart<'d, T> {
163 self.tx.send_break(bits).await 163 self.tx.send_break(bits).await
164 } 164 }
165 165
166 /// sets baudrate on runtime
167 pub fn set_baudrate(&mut self, baudrate: u32) {
168 super::Uart::<'d, T, Async>::set_baudrate_inner(baudrate);
169 }
170
166 /// Split into separate RX and TX handles. 171 /// Split into separate RX and TX handles.
167 pub fn split(self) -> (BufferedUartRx<'d, T>, BufferedUartTx<'d, T>) { 172 pub fn split(self) -> (BufferedUartTx<'d, T>, BufferedUartRx<'d, T>) {
168 (self.rx, self.tx) 173 (self.tx, self.rx)
174 }
175
176 /// Split the Uart into a transmitter and receiver by mutable reference,
177 /// which is particularly useful when having two tasks correlating to
178 /// transmitting and receiving.
179 pub fn split_ref(&mut self) -> (&mut BufferedUartTx<'d, T>, &mut BufferedUartRx<'d, T>) {
180 (&mut self.tx, &mut self.rx)
169 } 181 }
170} 182}
171 183
@@ -315,6 +327,12 @@ impl<'d, T: Instance> BufferedUartRx<'d, T> {
315 w.set_rtim(true); 327 w.set_rtim(true);
316 }); 328 });
317 } 329 }
330
331 /// we are ready to read if there is data in the buffer
332 fn read_ready() -> Result<bool, Error> {
333 let state = T::buffered_state();
334 Ok(!state.rx_buf.is_empty())
335 }
318} 336}
319 337
320impl<'d, T: Instance> BufferedUartTx<'d, T> { 338impl<'d, T: Instance> BufferedUartTx<'d, T> {
@@ -621,6 +639,18 @@ impl<'d, T: Instance + 'd> embedded_io_async::Read for BufferedUartRx<'d, T> {
621 } 639 }
622} 640}
623 641
642impl<'d, T: Instance + 'd> embedded_io_async::ReadReady for BufferedUart<'d, T> {
643 fn read_ready(&mut self) -> Result<bool, Self::Error> {
644 BufferedUartRx::<'d, T>::read_ready()
645 }
646}
647
648impl<'d, T: Instance + 'd> embedded_io_async::ReadReady for BufferedUartRx<'d, T> {
649 fn read_ready(&mut self) -> Result<bool, Self::Error> {
650 Self::read_ready()
651 }
652}
653
624impl<'d, T: Instance + 'd> embedded_io_async::BufRead for BufferedUart<'d, T> { 654impl<'d, T: Instance + 'd> embedded_io_async::BufRead for BufferedUart<'d, T> {
625 async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> { 655 async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
626 BufferedUartRx::<'d, T>::fill_buf().await 656 BufferedUartRx::<'d, T>::fill_buf().await
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs
index 30ece15bd..d50f5b4d5 100644
--- a/embassy-rp/src/uart/mod.rs
+++ b/embassy-rp/src/uart/mod.rs
@@ -7,7 +7,7 @@ use atomic_polyfill::{AtomicU16, Ordering};
7use embassy_futures::select::{select, Either}; 7use embassy_futures::select::{select, Either};
8use embassy_hal_internal::{into_ref, PeripheralRef}; 8use embassy_hal_internal::{into_ref, PeripheralRef};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10use embassy_time::Timer; 10use embassy_time::{Delay, Timer};
11use pac::uart::regs::Uartris; 11use pac::uart::regs::Uartris;
12 12
13use crate::clocks::clk_peri_freq; 13use crate::clocks::clk_peri_freq;
@@ -490,6 +490,36 @@ impl<'d, T: Instance> UartRx<'d, T, Async> {
490 /// * The first call to `read_to_break()` will return `Ok(20)`. 490 /// * The first call to `read_to_break()` will return `Ok(20)`.
491 /// * The next call to `read_to_break()` will work as expected 491 /// * The next call to `read_to_break()` will work as expected
492 pub async fn read_to_break(&mut self, buffer: &mut [u8]) -> Result<usize, ReadToBreakError> { 492 pub async fn read_to_break(&mut self, buffer: &mut [u8]) -> Result<usize, ReadToBreakError> {
493 self.read_to_break_with_count(buffer, 0).await
494 }
495
496 /// Read from the UART, waiting for a line break as soon as at least `min_count` bytes have been read.
497 ///
498 /// We read until one of the following occurs:
499 ///
500 /// * We read `buffer.len()` bytes without a line break
501 /// * returns `Err(ReadToBreakError::MissingBreak(buffer.len()))`
502 /// * We read `n > min_count` bytes then a line break occurs
503 /// * returns `Ok(n)`
504 /// * We encounter some error OTHER than a line break
505 /// * returns `Err(ReadToBreakError::Other(error))`
506 ///
507 /// If a line break occurs before `min_count` bytes have been read, the break will be ignored and the read will continue
508 ///
509 /// **NOTE**: you MUST provide a buffer one byte larger than your largest expected
510 /// message to reliably detect the framing on one single call to `read_to_break()`.
511 ///
512 /// * If you expect a message of 20 bytes + line break, and provide a 20-byte buffer:
513 /// * The first call to `read_to_break()` will return `Err(ReadToBreakError::MissingBreak(20))`
514 /// * The next call to `read_to_break()` will immediately return `Ok(0)`, from the "stale" line break
515 /// * If you expect a message of 20 bytes + line break, and provide a 21-byte buffer:
516 /// * The first call to `read_to_break()` will return `Ok(20)`.
517 /// * The next call to `read_to_break()` will work as expected
518 pub async fn read_to_break_with_count(
519 &mut self,
520 buffer: &mut [u8],
521 min_count: usize,
522 ) -> Result<usize, ReadToBreakError> {
493 // clear error flags before we drain the fifo. errors that have accumulated 523 // clear error flags before we drain the fifo. errors that have accumulated
494 // in the flags will also be present in the fifo. 524 // in the flags will also be present in the fifo.
495 T::dma_state().rx_errs.store(0, Ordering::Relaxed); 525 T::dma_state().rx_errs.store(0, Ordering::Relaxed);
@@ -502,7 +532,7 @@ impl<'d, T: Instance> UartRx<'d, T, Async> {
502 532
503 // then drain the fifo. we need to read at most 32 bytes. errors that apply 533 // then drain the fifo. we need to read at most 32 bytes. errors that apply
504 // to fifo bytes will be reported directly. 534 // to fifo bytes will be reported directly.
505 let sbuffer = match { 535 let mut sbuffer = match {
506 let limit = buffer.len().min(32); 536 let limit = buffer.len().min(32);
507 self.drain_fifo(&mut buffer[0..limit]) 537 self.drain_fifo(&mut buffer[0..limit])
508 } { 538 } {
@@ -511,7 +541,13 @@ impl<'d, T: Instance> UartRx<'d, T, Async> {
511 // Drained (some/all of the fifo), no room left 541 // Drained (some/all of the fifo), no room left
512 Ok(len) => return Err(ReadToBreakError::MissingBreak(len)), 542 Ok(len) => return Err(ReadToBreakError::MissingBreak(len)),
513 // We got a break WHILE draining the FIFO, return what we did get before the break 543 // We got a break WHILE draining the FIFO, return what we did get before the break
514 Err((i, Error::Break)) => return Ok(i), 544 Err((len, Error::Break)) => {
545 if len < min_count && len < buffer.len() {
546 &mut buffer[len..]
547 } else {
548 return Ok(len);
549 }
550 }
515 // Some other error, just return the error 551 // Some other error, just return the error
516 Err((_i, e)) => return Err(ReadToBreakError::Other(e)), 552 Err((_i, e)) => return Err(ReadToBreakError::Other(e)),
517 }; 553 };
@@ -530,110 +566,118 @@ impl<'d, T: Instance> UartRx<'d, T, Async> {
530 reg.set_rxdmae(true); 566 reg.set_rxdmae(true);
531 reg.set_dmaonerr(true); 567 reg.set_dmaonerr(true);
532 }); 568 });
533 let transfer = unsafe {
534 // If we don't assign future to a variable, the data register pointer
535 // is held across an await and makes the future non-Send.
536 crate::dma::read(&mut ch, T::regs().uartdr().as_ptr() as *const _, sbuffer, T::RX_DREQ)
537 };
538 569
539 // wait for either the transfer to complete or an error to happen. 570 loop {
540 let transfer_result = select( 571 let transfer = unsafe {
541 transfer, 572 // If we don't assign future to a variable, the data register pointer
542 poll_fn(|cx| { 573 // is held across an await and makes the future non-Send.
543 T::dma_state().rx_err_waker.register(cx.waker()); 574 crate::dma::read(&mut ch, T::regs().uartdr().as_ptr() as *const _, sbuffer, T::RX_DREQ)
544 match T::dma_state().rx_errs.swap(0, Ordering::Relaxed) { 575 };
545 0 => Poll::Pending,
546 e => Poll::Ready(Uartris(e as u32)),
547 }
548 }),
549 )
550 .await;
551
552 // Figure out our error state
553 let errors = match transfer_result {
554 Either::First(()) => {
555 // We're here because the DMA finished, BUT if an error occurred on the LAST
556 // byte, then we may still need to grab the error state!
557 Uartris(T::dma_state().rx_errs.swap(0, Ordering::Relaxed) as u32)
558 }
559 Either::Second(e) => {
560 // We're here because we errored, which means this is the error that
561 // was problematic.
562 e
563 }
564 };
565
566 if errors.0 == 0 {
567 // No errors? That means we filled the buffer without a line break.
568 // For THIS function, that's a problem.
569 return Err(ReadToBreakError::MissingBreak(buffer.len()));
570 } else if errors.beris() {
571 // We got a Line Break! By this point, we've finished/aborted the DMA
572 // transaction, which means that we need to figure out where it left off
573 // by looking at the write_addr.
574 //
575 // First, we do a sanity check to make sure the write value is within the
576 // range of DMA we just did.
577 let sval = buffer.as_ptr() as usize;
578 let eval = sval + buffer.len();
579
580 // This is the address where the DMA would write to next
581 let next_addr = ch.regs().write_addr().read() as usize;
582
583 // If we DON'T end up inside the range, something has gone really wrong.
584 // Note that it's okay that `eval` is one past the end of the slice, as
585 // this is where the write pointer will end up at the end of a full
586 // transfer.
587 if (next_addr < sval) || (next_addr > eval) {
588 unreachable!("UART DMA reported invalid `write_addr`");
589 }
590 576
591 let regs = T::regs(); 577 // wait for either the transfer to complete or an error to happen.
592 let all_full = next_addr == eval; 578 let transfer_result = select(
593 579 transfer,
594 // NOTE: This is off label usage of RSR! See the issue below for 580 poll_fn(|cx| {
595 // why I am not checking if there is an "extra" FIFO byte, and why 581 T::dma_state().rx_err_waker.register(cx.waker());
596 // I am checking RSR directly (it seems to report the status of the LAST 582 match T::dma_state().rx_errs.swap(0, Ordering::Relaxed) {
597 // POPPED value, rather than the NEXT TO POP value like the datasheet 583 0 => Poll::Pending,
598 // suggests!) 584 e => Poll::Ready(Uartris(e as u32)),
599 // 585 }
600 // issue: https://github.com/raspberrypi/pico-feedback/issues/367 586 }),
601 let last_was_break = regs.uartrsr().read().be(); 587 )
602 588 .await;
603 return match (all_full, last_was_break) { 589
604 (true, true) | (false, _) => { 590 // Figure out our error state
605 // We got less than the full amount + a break, or the full amount 591 let errors = match transfer_result {
606 // and the last byte was a break. Subtract the break off by adding one to sval. 592 Either::First(()) => {
607 Ok(next_addr.saturating_sub(1 + sval)) 593 // We're here because the DMA finished, BUT if an error occurred on the LAST
594 // byte, then we may still need to grab the error state!
595 Uartris(T::dma_state().rx_errs.swap(0, Ordering::Relaxed) as u32)
608 } 596 }
609 (true, false) => { 597 Either::Second(e) => {
610 // We finished the whole DMA, and the last DMA'd byte was NOT a break 598 // We're here because we errored, which means this is the error that
611 // character. This is an error. 599 // was problematic.
612 // 600 e
613 // NOTE: we COULD potentially return Ok(buffer.len()) here, since we
614 // know a line break occured at SOME POINT after the DMA completed.
615 //
616 // However, we have no way of knowing if there was extra data BEFORE
617 // that line break, so instead return an Err to signal to the caller
618 // that there are "leftovers", and they'll catch the actual line break
619 // on the next call.
620 //
621 // Doing it like this also avoids racyness: now whether you finished
622 // the full read BEFORE the line break occurred or AFTER the line break
623 // occurs, you still get `MissingBreak(buffer.len())` instead of sometimes
624 // getting `Ok(buffer.len())` if you were "late enough" to observe the
625 // line break.
626 Err(ReadToBreakError::MissingBreak(buffer.len()))
627 } 601 }
628 }; 602 };
629 } else if errors.oeris() { 603
630 return Err(ReadToBreakError::Other(Error::Overrun)); 604 if errors.0 == 0 {
631 } else if errors.peris() { 605 // No errors? That means we filled the buffer without a line break.
632 return Err(ReadToBreakError::Other(Error::Parity)); 606 // For THIS function, that's a problem.
633 } else if errors.feris() { 607 return Err(ReadToBreakError::MissingBreak(buffer.len()));
634 return Err(ReadToBreakError::Other(Error::Framing)); 608 } else if errors.beris() {
609 // We got a Line Break! By this point, we've finished/aborted the DMA
610 // transaction, which means that we need to figure out where it left off
611 // by looking at the write_addr.
612 //
613 // First, we do a sanity check to make sure the write value is within the
614 // range of DMA we just did.
615 let sval = buffer.as_ptr() as usize;
616 let eval = sval + buffer.len();
617
618 // This is the address where the DMA would write to next
619 let next_addr = ch.regs().write_addr().read() as usize;
620
621 // If we DON'T end up inside the range, something has gone really wrong.
622 // Note that it's okay that `eval` is one past the end of the slice, as
623 // this is where the write pointer will end up at the end of a full
624 // transfer.
625 if (next_addr < sval) || (next_addr > eval) {
626 unreachable!("UART DMA reported invalid `write_addr`");
627 }
628
629 if (next_addr - sval) < min_count {
630 sbuffer = &mut buffer[(next_addr - sval)..];
631 continue;
632 }
633
634 let regs = T::regs();
635 let all_full = next_addr == eval;
636
637 // NOTE: This is off label usage of RSR! See the issue below for
638 // why I am not checking if there is an "extra" FIFO byte, and why
639 // I am checking RSR directly (it seems to report the status of the LAST
640 // POPPED value, rather than the NEXT TO POP value like the datasheet
641 // suggests!)
642 //
643 // issue: https://github.com/raspberrypi/pico-feedback/issues/367
644 let last_was_break = regs.uartrsr().read().be();
645
646 return match (all_full, last_was_break) {
647 (true, true) | (false, _) => {
648 // We got less than the full amount + a break, or the full amount
649 // and the last byte was a break. Subtract the break off by adding one to sval.
650 Ok(next_addr.saturating_sub(1 + sval))
651 }
652 (true, false) => {
653 // We finished the whole DMA, and the last DMA'd byte was NOT a break
654 // character. This is an error.
655 //
656 // NOTE: we COULD potentially return Ok(buffer.len()) here, since we
657 // know a line break occured at SOME POINT after the DMA completed.
658 //
659 // However, we have no way of knowing if there was extra data BEFORE
660 // that line break, so instead return an Err to signal to the caller
661 // that there are "leftovers", and they'll catch the actual line break
662 // on the next call.
663 //
664 // Doing it like this also avoids racyness: now whether you finished
665 // the full read BEFORE the line break occurred or AFTER the line break
666 // occurs, you still get `MissingBreak(buffer.len())` instead of sometimes
667 // getting `Ok(buffer.len())` if you were "late enough" to observe the
668 // line break.
669 Err(ReadToBreakError::MissingBreak(buffer.len()))
670 }
671 };
672 } else if errors.oeris() {
673 return Err(ReadToBreakError::Other(Error::Overrun));
674 } else if errors.peris() {
675 return Err(ReadToBreakError::Other(Error::Parity));
676 } else if errors.feris() {
677 return Err(ReadToBreakError::Other(Error::Framing));
678 }
679 unreachable!("unrecognized rx error");
635 } 680 }
636 unreachable!("unrecognized rx error");
637 } 681 }
638} 682}
639 683
@@ -860,6 +904,56 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
860 }); 904 });
861 } 905 }
862 906
907 fn lcr_modify<R>(f: impl FnOnce(&mut rp_pac::uart::regs::UartlcrH) -> R) -> R {
908 let r = T::regs();
909
910 // Notes from PL011 reference manual:
911 //
912 // - Before writing the LCR, if the UART is enabled it needs to be
913 // disabled and any current TX + RX activity has to be completed
914 //
915 // - There is a BUSY flag which waits for the current TX char, but this is
916 // OR'd with TX FIFO !FULL, so not usable when FIFOs are enabled and
917 // potentially nonempty
918 //
919 // - FIFOs can't be set to disabled whilst a character is in progress
920 // (else "FIFO integrity is not guaranteed")
921 //
922 // Combination of these means there is no general way to halt and poll for
923 // end of TX character, if FIFOs may be enabled. Either way, there is no
924 // way to poll for end of RX character.
925 //
926 // So, insert a 15 Baud period delay before changing the settings.
927 // 15 Baud is comfortably higher than start + max data + parity + stop.
928 // Anything else would require API changes to permit a non-enabled UART
929 // state after init() where settings can be changed safely.
930 let clk_base = crate::clocks::clk_peri_freq();
931
932 let cr = r.uartcr().read();
933 if cr.uarten() {
934 r.uartcr().modify(|w| {
935 w.set_uarten(false);
936 w.set_txe(false);
937 w.set_rxe(false);
938 });
939
940 // Note: Maximise precision here. Show working, the compiler will mop this up.
941 // Create a 16.6 fixed-point fractional division ratio; then scale to 32-bits.
942 let mut brdiv_ratio = 64 * r.uartibrd().read().0 + r.uartfbrd().read().0;
943 brdiv_ratio <<= 10;
944 // 3662 is ~(15 * 244.14) where 244.14 is 16e6 / 2^16
945 let scaled_freq = clk_base / 3662;
946 let wait_time_us = brdiv_ratio / scaled_freq;
947 embedded_hal_1::delay::DelayNs::delay_us(&mut Delay, wait_time_us);
948 }
949
950 let res = r.uartlcr_h().modify(f);
951
952 r.uartcr().write_value(cr);
953
954 res
955 }
956
863 /// sets baudrate on runtime 957 /// sets baudrate on runtime
864 pub fn set_baudrate(&mut self, baudrate: u32) { 958 pub fn set_baudrate(&mut self, baudrate: u32) {
865 Self::set_baudrate_inner(baudrate); 959 Self::set_baudrate_inner(baudrate);
@@ -886,9 +980,7 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
886 r.uartibrd().write_value(pac::uart::regs::Uartibrd(baud_ibrd)); 980 r.uartibrd().write_value(pac::uart::regs::Uartibrd(baud_ibrd));
887 r.uartfbrd().write_value(pac::uart::regs::Uartfbrd(baud_fbrd)); 981 r.uartfbrd().write_value(pac::uart::regs::Uartfbrd(baud_fbrd));
888 982
889 // PL011 needs a (dummy) line control register write to latch in the 983 Self::lcr_modify(|_| {});
890 // divisors. We don't want to actually change LCR contents here.
891 r.uartlcr_h().modify(|_| {});
892 } 984 }
893} 985}
894 986
@@ -923,6 +1015,13 @@ impl<'d, T: Instance, M: Mode> Uart<'d, T, M> {
923 pub fn split(self) -> (UartTx<'d, T, M>, UartRx<'d, T, M>) { 1015 pub fn split(self) -> (UartTx<'d, T, M>, UartRx<'d, T, M>) {
924 (self.tx, self.rx) 1016 (self.tx, self.rx)
925 } 1017 }
1018
1019 /// Split the Uart into a transmitter and receiver by mutable reference,
1020 /// which is particularly useful when having two tasks correlating to
1021 /// transmitting and receiving.
1022 pub fn split_ref(&mut self) -> (&mut UartTx<'d, T, M>, &mut UartRx<'d, T, M>) {
1023 (&mut self.tx, &mut self.rx)
1024 }
926} 1025}
927 1026
928impl<'d, T: Instance> Uart<'d, T, Async> { 1027impl<'d, T: Instance> Uart<'d, T, Async> {
@@ -942,6 +1041,17 @@ impl<'d, T: Instance> Uart<'d, T, Async> {
942 pub async fn read_to_break<'a>(&mut self, buf: &'a mut [u8]) -> Result<usize, ReadToBreakError> { 1041 pub async fn read_to_break<'a>(&mut self, buf: &'a mut [u8]) -> Result<usize, ReadToBreakError> {
943 self.rx.read_to_break(buf).await 1042 self.rx.read_to_break(buf).await
944 } 1043 }
1044
1045 /// Read until the buffer is full or a line break occurs after at least `min_count` bytes have been read.
1046 ///
1047 /// See [`UartRx::read_to_break_with_count()`] for more details
1048 pub async fn read_to_break_with_count<'a>(
1049 &mut self,
1050 buf: &'a mut [u8],
1051 min_count: usize,
1052 ) -> Result<usize, ReadToBreakError> {
1053 self.rx.read_to_break_with_count(buf, min_count).await
1054 }
945} 1055}
946 1056
947impl<'d, T: Instance, M: Mode> embedded_hal_02::serial::Read<u8> for UartRx<'d, T, M> { 1057impl<'d, T: Instance, M: Mode> embedded_hal_02::serial::Read<u8> for UartRx<'d, T, M> {
diff --git a/embassy-stm32-wpan/Cargo.toml b/embassy-stm32-wpan/Cargo.toml
index 307b948c1..54dfd39a6 100644
--- a/embassy-stm32-wpan/Cargo.toml
+++ b/embassy-stm32-wpan/Cargo.toml
@@ -21,10 +21,10 @@ features = ["stm32wb55rg"]
21[dependencies] 21[dependencies]
22embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32" } 22embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32" }
23embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 23embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
24embassy-time = { version = "0.3.1", path = "../embassy-time", optional = true } 24embassy-time = { version = "0.3.2", path = "../embassy-time", optional = true }
25embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 25embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
26embassy-hal-internal = { version = "0.1.0", path = "../embassy-hal-internal" } 26embassy-hal-internal = { version = "0.2.0", path = "../embassy-hal-internal" }
27embassy-embedded-hal = { version = "0.1.0", path = "../embassy-embedded-hal" } 27embassy-embedded-hal = { version = "0.2.0", path = "../embassy-embedded-hal" }
28embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver", optional=true } 28embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver", optional=true }
29 29
30defmt = { version = "0.3", optional = true } 30defmt = { version = "0.3", optional = true }
diff --git a/embassy-stm32-wpan/src/fmt.rs b/embassy-stm32-wpan/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-stm32-wpan/src/fmt.rs
+++ b/embassy-stm32-wpan/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 30f486ccc..ac9e9644c 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -43,15 +43,15 @@ rustdoc-args = ["--cfg", "docsrs"]
43 43
44[dependencies] 44[dependencies]
45embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 45embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
46embassy-time = { version = "0.3.1", path = "../embassy-time", optional = true } 46embassy-time = { version = "0.3.2", path = "../embassy-time", optional = true }
47embassy-time-driver = { version = "0.1", path = "../embassy-time-driver", optional = true } 47embassy-time-driver = { version = "0.1", path = "../embassy-time-driver", optional = true }
48embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 48embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
49embassy-hal-internal = {version = "0.1.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-4"] } 49embassy-hal-internal = {version = "0.2.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-4"] }
50embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } 50embassy-embedded-hal = {version = "0.2.0", path = "../embassy-embedded-hal" }
51embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" } 51embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" }
52embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" } 52embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" }
53embassy-usb-synopsys-otg = {version = "0.1.0", path = "../embassy-usb-synopsys-otg" } 53embassy-usb-synopsys-otg = {version = "0.1.0", path = "../embassy-usb-synopsys-otg" }
54embassy-executor = { version = "0.5.0", path = "../embassy-executor", optional = true } 54embassy-executor = { version = "0.6.0", path = "../embassy-executor", optional = true }
55 55
56embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 56embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
57embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 57embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
diff --git a/embassy-stm32/build_common.rs b/embassy-stm32/build_common.rs
index 0487eb3c5..4f24e6d37 100644
--- a/embassy-stm32/build_common.rs
+++ b/embassy-stm32/build_common.rs
@@ -8,8 +8,6 @@
8 8
9use std::collections::HashSet; 9use std::collections::HashSet;
10use std::env; 10use std::env;
11use std::ffi::OsString;
12use std::process::Command;
13 11
14/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring 12/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring
15/// them (`cargo:rust-check-cfg=cfg(X)`). 13/// them (`cargo:rust-check-cfg=cfg(X)`).
@@ -17,7 +15,6 @@ use std::process::Command;
17pub struct CfgSet { 15pub struct CfgSet {
18 enabled: HashSet<String>, 16 enabled: HashSet<String>,
19 declared: HashSet<String>, 17 declared: HashSet<String>,
20 emit_declared: bool,
21} 18}
22 19
23impl CfgSet { 20impl CfgSet {
@@ -25,7 +22,6 @@ impl CfgSet {
25 Self { 22 Self {
26 enabled: HashSet::new(), 23 enabled: HashSet::new(),
27 declared: HashSet::new(), 24 declared: HashSet::new(),
28 emit_declared: is_rustc_nightly(),
29 } 25 }
30 } 26 }
31 27
@@ -49,7 +45,7 @@ impl CfgSet {
49 /// 45 ///
50 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. 46 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid.
51 pub fn declare(&mut self, cfg: impl AsRef<str>) { 47 pub fn declare(&mut self, cfg: impl AsRef<str>) {
52 if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { 48 if self.declared.insert(cfg.as_ref().to_owned()) {
53 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); 49 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref());
54 } 50 }
55 } 51 }
@@ -69,21 +65,6 @@ impl CfgSet {
69 } 65 }
70} 66}
71 67
72fn is_rustc_nightly() -> bool {
73 if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() {
74 return true;
75 }
76
77 let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
78
79 let output = Command::new(rustc)
80 .arg("--version")
81 .output()
82 .expect("failed to run `rustc --version`");
83
84 String::from_utf8_lossy(&output.stdout).contains("nightly")
85}
86
87/// Sets configs that describe the target platform. 68/// Sets configs that describe the target platform.
88pub fn set_target_cfgs(cfgs: &mut CfgSet) { 69pub fn set_target_cfgs(cfgs: &mut CfgSet) {
89 let target = env::var("TARGET").unwrap(); 70 let target = env::var("TARGET").unwrap();
diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs
index f20585ec3..2f36df240 100644
--- a/embassy-stm32/src/adc/mod.rs
+++ b/embassy-stm32/src/adc/mod.rs
@@ -2,6 +2,7 @@
2 2
3#![macro_use] 3#![macro_use]
4#![allow(missing_docs)] // TODO 4#![allow(missing_docs)] // TODO
5#![cfg_attr(adc_f3_v2, allow(unused))]
5 6
6#[cfg(not(adc_f3_v2))] 7#[cfg(not(adc_f3_v2))]
7#[cfg_attr(adc_f1, path = "f1.rs")] 8#[cfg_attr(adc_f1, path = "f1.rs")]
diff --git a/embassy-stm32/src/flash/f1f3.rs b/embassy-stm32/src/flash/f1f3.rs
index e66842e31..ff7f810ea 100644
--- a/embassy-stm32/src/flash/f1f3.rs
+++ b/embassy-stm32/src/flash/f1f3.rs
@@ -42,9 +42,11 @@ pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE])
42 42
43 // prevents parallelism errors 43 // prevents parallelism errors
44 fence(Ordering::SeqCst); 44 fence(Ordering::SeqCst);
45
46 wait_ready_blocking()?;
45 } 47 }
46 48
47 wait_ready_blocking() 49 Ok(())
48} 50}
49 51
50pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), Error> { 52pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), Error> {
diff --git a/embassy-stm32/src/fmc.rs b/embassy-stm32/src/fmc.rs
index 7aea466e8..83b49a3dd 100644
--- a/embassy-stm32/src/fmc.rs
+++ b/embassy-stm32/src/fmc.rs
@@ -160,6 +160,26 @@ impl<'d, T: Instance> Fmc<'d, T> {
160 ] 160 ]
161 )); 161 ));
162 162
163 fmc_sdram_constructor!(sdram_a13bits_d32bits_4banks_bank1: (
164 bank: stm32_fmc::SdramTargetBank::Bank1,
165 addr: [
166 (a0: A0Pin), (a1: A1Pin), (a2: A2Pin), (a3: A3Pin), (a4: A4Pin), (a5: A5Pin), (a6: A6Pin), (a7: A7Pin), (a8: A8Pin), (a9: A9Pin), (a10: A10Pin), (a11: A11Pin), (a12: A12Pin)
167 ],
168 ba: [(ba0: BA0Pin), (ba1: BA1Pin)],
169 d: [
170 (d0: D0Pin), (d1: D1Pin), (d2: D2Pin), (d3: D3Pin), (d4: D4Pin), (d5: D5Pin), (d6: D6Pin), (d7: D7Pin),
171 (d8: D8Pin), (d9: D9Pin), (d10: D10Pin), (d11: D11Pin), (d12: D12Pin), (d13: D13Pin), (d14: D14Pin), (d15: D15Pin),
172 (d16: D16Pin), (d17: D17Pin), (d18: D18Pin), (d19: D19Pin), (d20: D20Pin), (d21: D21Pin), (d22: D22Pin), (d23: D23Pin),
173 (d24: D24Pin), (d25: D25Pin), (d26: D26Pin), (d27: D27Pin), (d28: D28Pin), (d29: D29Pin), (d30: D30Pin), (d31: D31Pin)
174 ],
175 nbl: [
176 (nbl0: NBL0Pin), (nbl1: NBL1Pin), (nbl2: NBL2Pin), (nbl3: NBL3Pin)
177 ],
178 ctrl: [
179 (sdcke: SDCKE0Pin), (sdclk: SDCLKPin), (sdncas: SDNCASPin), (sdne: SDNE0Pin), (sdnras: SDNRASPin), (sdnwe: SDNWEPin)
180 ]
181 ));
182
163 fmc_sdram_constructor!(sdram_a12bits_d16bits_4banks_bank2: ( 183 fmc_sdram_constructor!(sdram_a12bits_d16bits_4banks_bank2: (
164 bank: stm32_fmc::SdramTargetBank::Bank2, 184 bank: stm32_fmc::SdramTargetBank::Bank2,
165 addr: [ 185 addr: [
@@ -197,6 +217,26 @@ impl<'d, T: Instance> Fmc<'d, T> {
197 (sdcke: SDCKE1Pin), (sdclk: SDCLKPin), (sdncas: SDNCASPin), (sdne: SDNE1Pin), (sdnras: SDNRASPin), (sdnwe: SDNWEPin) 217 (sdcke: SDCKE1Pin), (sdclk: SDCLKPin), (sdncas: SDNCASPin), (sdne: SDNE1Pin), (sdnras: SDNRASPin), (sdnwe: SDNWEPin)
198 ] 218 ]
199 )); 219 ));
220
221 fmc_sdram_constructor!(sdram_a13bits_d32bits_4banks_bank2: (
222 bank: stm32_fmc::SdramTargetBank::Bank2,
223 addr: [
224 (a0: A0Pin), (a1: A1Pin), (a2: A2Pin), (a3: A3Pin), (a4: A4Pin), (a5: A5Pin), (a6: A6Pin), (a7: A7Pin), (a8: A8Pin), (a9: A9Pin), (a10: A10Pin), (a11: A11Pin), (a12: A12Pin)
225 ],
226 ba: [(ba0: BA0Pin), (ba1: BA1Pin)],
227 d: [
228 (d0: D0Pin), (d1: D1Pin), (d2: D2Pin), (d3: D3Pin), (d4: D4Pin), (d5: D5Pin), (d6: D6Pin), (d7: D7Pin),
229 (d8: D8Pin), (d9: D9Pin), (d10: D10Pin), (d11: D11Pin), (d12: D12Pin), (d13: D13Pin), (d14: D14Pin), (d15: D15Pin),
230 (d16: D16Pin), (d17: D17Pin), (d18: D18Pin), (d19: D19Pin), (d20: D20Pin), (d21: D21Pin), (d22: D22Pin), (d23: D23Pin),
231 (d24: D24Pin), (d25: D25Pin), (d26: D26Pin), (d27: D27Pin), (d28: D28Pin), (d29: D29Pin), (d30: D30Pin), (d31: D31Pin)
232 ],
233 nbl: [
234 (nbl0: NBL0Pin), (nbl1: NBL1Pin), (nbl2: NBL2Pin), (nbl3: NBL3Pin)
235 ],
236 ctrl: [
237 (sdcke: SDCKE1Pin), (sdclk: SDCLKPin), (sdncas: SDNCASPin), (sdne: SDNE1Pin), (sdnras: SDNRASPin), (sdnwe: SDNWEPin)
238 ]
239 ));
200} 240}
201 241
202trait SealedInstance: crate::rcc::RccPeripheral { 242trait SealedInstance: crate::rcc::RccPeripheral {
diff --git a/embassy-stm32/src/fmt.rs b/embassy-stm32/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-stm32/src/fmt.rs
+++ b/embassy-stm32/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-stm32/src/hsem/mod.rs b/embassy-stm32/src/hsem/mod.rs
index b77a3415b..06ab7a9bc 100644
--- a/embassy-stm32/src/hsem/mod.rs
+++ b/embassy-stm32/src/hsem/mod.rs
@@ -158,6 +158,11 @@ impl<'d, T: Instance> HardwareSemaphore<'d, T> {
158 .modify(|w| w.set_ise(sem_x, enable)); 158 .modify(|w| w.set_ise(sem_x, enable));
159 } 159 }
160 160
161 /// Gets the interrupt flag for the semaphore.
162 pub fn is_interrupt_active(&mut self, core_id: CoreId, sem_x: usize) -> bool {
163 T::regs().isr(core_id_to_index(core_id)).read().isf(sem_x)
164 }
165
161 /// Clears the interrupt flag for the semaphore. 166 /// Clears the interrupt flag for the semaphore.
162 pub fn clear_interrupt(&mut self, core_id: CoreId, sem_x: usize) { 167 pub fn clear_interrupt(&mut self, core_id: CoreId, sem_x: usize) {
163 T::regs() 168 T::regs()
diff --git a/embassy-stm32/src/opamp.rs b/embassy-stm32/src/opamp.rs
index ca94a573d..c86c18e22 100644
--- a/embassy-stm32/src/opamp.rs
+++ b/embassy-stm32/src/opamp.rs
@@ -45,6 +45,7 @@ pub struct OpAmpOutput<'d, T: Instance> {
45/// OpAmp internal outputs, wired directly to ADC inputs. 45/// OpAmp internal outputs, wired directly to ADC inputs.
46/// 46///
47/// This struct can be used as an ADC input. 47/// This struct can be used as an ADC input.
48#[cfg(opamp_g4)]
48pub struct OpAmpInternalOutput<'d, T: Instance> { 49pub struct OpAmpInternalOutput<'d, T: Instance> {
49 _inner: &'d OpAmp<'d, T>, 50 _inner: &'d OpAmp<'d, T>,
50} 51}
@@ -80,11 +81,11 @@ impl<'d, T: Instance> OpAmp<'d, T> {
80 /// directly used as an ADC input. The opamp will be disabled when the 81 /// directly used as an ADC input. The opamp will be disabled when the
81 /// [`OpAmpOutput`] is dropped. 82 /// [`OpAmpOutput`] is dropped.
82 pub fn buffer_ext( 83 pub fn buffer_ext(
83 &'d mut self, 84 &mut self,
84 in_pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>, 85 in_pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>,
85 out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin> + 'd, 86 out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin>,
86 gain: OpAmpGain, 87 gain: OpAmpGain,
87 ) -> OpAmpOutput<'d, T> { 88 ) -> OpAmpOutput<'_, T> {
88 into_ref!(in_pin); 89 into_ref!(in_pin);
89 into_ref!(out_pin); 90 into_ref!(out_pin);
90 in_pin.set_as_analog(); 91 in_pin.set_as_analog();
@@ -119,9 +120,9 @@ impl<'d, T: Instance> OpAmp<'d, T> {
119 /// [`OpAmpOutput`] is dropped. 120 /// [`OpAmpOutput`] is dropped.
120 #[cfg(opamp_g4)] 121 #[cfg(opamp_g4)]
121 pub fn buffer_dac( 122 pub fn buffer_dac(
122 &'d mut self, 123 &mut self,
123 out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin> + 'd, 124 out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin>,
124 ) -> OpAmpOutput<'d, T> { 125 ) -> OpAmpOutput<'_, T> {
125 into_ref!(out_pin); 126 into_ref!(out_pin);
126 out_pin.set_as_analog(); 127 out_pin.set_as_analog();
127 128
@@ -147,10 +148,10 @@ impl<'d, T: Instance> OpAmp<'d, T> {
147 /// The opamp output will be disabled when it is dropped. 148 /// The opamp output will be disabled when it is dropped.
148 #[cfg(opamp_g4)] 149 #[cfg(opamp_g4)]
149 pub fn buffer_int( 150 pub fn buffer_int(
150 &'d mut self, 151 &mut self,
151 pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>, 152 pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>,
152 gain: OpAmpGain, 153 gain: OpAmpGain,
153 ) -> OpAmpInternalOutput<'d, T> { 154 ) -> OpAmpInternalOutput<'_, T> {
154 into_ref!(pin); 155 into_ref!(pin);
155 pin.set_as_analog(); 156 pin.set_as_analog();
156 157
@@ -184,6 +185,7 @@ impl<'d, T: Instance> Drop for OpAmpOutput<'d, T> {
184 } 185 }
185} 186}
186 187
188#[cfg(opamp_g4)]
187impl<'d, T: Instance> Drop for OpAmpInternalOutput<'d, T> { 189impl<'d, T: Instance> Drop for OpAmpInternalOutput<'d, T> {
188 fn drop(&mut self) { 190 fn drop(&mut self) {
189 T::regs().csr().modify(|w| { 191 T::regs().csr().modify(|w| {
diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs
index f6eb0d17c..289bfa672 100644
--- a/embassy-stm32/src/ospi/mod.rs
+++ b/embassy-stm32/src/ospi/mod.rs
@@ -1060,10 +1060,6 @@ pub(crate) trait SealedInstance {
1060 const REGS: Regs; 1060 const REGS: Regs;
1061} 1061}
1062 1062
1063trait SealedWord {
1064 const CONFIG: u8;
1065}
1066
1067/// OSPI instance trait. 1063/// OSPI instance trait.
1068#[allow(private_bounds)] 1064#[allow(private_bounds)]
1069pub trait Instance: Peripheral<P = Self> + SealedInstance + RccPeripheral {} 1065pub trait Instance: Peripheral<P = Self> + SealedInstance + RccPeripheral {}
@@ -1110,17 +1106,14 @@ impl<'d, T: Instance, M: PeriMode> GetConfig for Ospi<'d, T, M> {
1110 1106
1111/// Word sizes usable for OSPI. 1107/// Word sizes usable for OSPI.
1112#[allow(private_bounds)] 1108#[allow(private_bounds)]
1113pub trait Word: word::Word + SealedWord {} 1109pub trait Word: word::Word {}
1114 1110
1115macro_rules! impl_word { 1111macro_rules! impl_word {
1116 ($T:ty, $config:expr) => { 1112 ($T:ty) => {
1117 impl SealedWord for $T {
1118 const CONFIG: u8 = $config;
1119 }
1120 impl Word for $T {} 1113 impl Word for $T {}
1121 }; 1114 };
1122} 1115}
1123 1116
1124impl_word!(u8, 8); 1117impl_word!(u8);
1125impl_word!(u16, 16); 1118impl_word!(u16);
1126impl_word!(u32, 32); 1119impl_word!(u32);
diff --git a/embassy-stm32/src/sdmmc/mod.rs b/embassy-stm32/src/sdmmc/mod.rs
index ee5539518..44ff9fcd5 100644
--- a/embassy-stm32/src/sdmmc/mod.rs
+++ b/embassy-stm32/src/sdmmc/mod.rs
@@ -94,6 +94,34 @@ impl DerefMut for DataBlock {
94 } 94 }
95} 95}
96 96
97/// Command Block buffer for SDMMC command transfers.
98///
99/// This is a 16-word array, exposed so that DMA commpatible memory can be used if required.
100#[derive(Debug, Clone, PartialEq, Eq)]
101#[cfg_attr(feature = "defmt", derive(defmt::Format))]
102pub struct CmdBlock(pub [u32; 16]);
103
104impl CmdBlock {
105 /// Creates a new instance of CmdBlock
106 pub const fn new() -> Self {
107 Self([0u32; 16])
108 }
109}
110
111impl Deref for CmdBlock {
112 type Target = [u32; 16];
113
114 fn deref(&self) -> &Self::Target {
115 &self.0
116 }
117}
118
119impl DerefMut for CmdBlock {
120 fn deref_mut(&mut self) -> &mut Self::Target {
121 &mut self.0
122 }
123}
124
97/// Errors 125/// Errors
98#[non_exhaustive] 126#[non_exhaustive]
99#[derive(Debug, Copy, Clone, PartialEq, Eq)] 127#[derive(Debug, Copy, Clone, PartialEq, Eq)]
@@ -292,6 +320,10 @@ pub struct Sdmmc<'d, T: Instance, Dma: SdmmcDma<T> = NoDma> {
292 signalling: Signalling, 320 signalling: Signalling,
293 /// Card 321 /// Card
294 card: Option<Card>, 322 card: Option<Card>,
323
324 /// An optional buffer to be used for commands
325 /// This should be used if there are special memory location requirements for dma
326 cmd_block: Option<&'d mut CmdBlock>,
295} 327}
296 328
297const CLK_AF: AfType = AfType::output(OutputType::PushPull, Speed::VeryHigh); 329const CLK_AF: AfType = AfType::output(OutputType::PushPull, Speed::VeryHigh);
@@ -495,6 +527,7 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
495 clock: SD_INIT_FREQ, 527 clock: SD_INIT_FREQ,
496 signalling: Default::default(), 528 signalling: Default::default(),
497 card: None, 529 card: None,
530 cmd_block: None,
498 } 531 }
499 } 532 }
500 533
@@ -531,8 +564,10 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
531 /// # Safety 564 /// # Safety
532 /// 565 ///
533 /// `buffer` must be valid for the whole transfer and word aligned 566 /// `buffer` must be valid for the whole transfer and word aligned
567 #[allow(unused_variables)]
534 fn prepare_datapath_read<'a>( 568 fn prepare_datapath_read<'a>(
535 &'a mut self, 569 config: &Config,
570 dma: &'a mut PeripheralRef<'d, Dma>,
536 buffer: &'a mut [u32], 571 buffer: &'a mut [u32],
537 length_bytes: u32, 572 length_bytes: u32,
538 block_size: u8, 573 block_size: u8,
@@ -544,15 +579,14 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
544 Self::wait_idle(); 579 Self::wait_idle();
545 Self::clear_interrupt_flags(); 580 Self::clear_interrupt_flags();
546 581
547 regs.dtimer() 582 regs.dtimer().write(|w| w.set_datatime(config.data_transfer_timeout));
548 .write(|w| w.set_datatime(self.config.data_transfer_timeout));
549 regs.dlenr().write(|w| w.set_datalength(length_bytes)); 583 regs.dlenr().write(|w| w.set_datalength(length_bytes));
550 584
551 #[cfg(sdmmc_v1)] 585 #[cfg(sdmmc_v1)]
552 let transfer = unsafe { 586 let transfer = unsafe {
553 let request = self.dma.request(); 587 let request = dma.request();
554 Transfer::new_read( 588 Transfer::new_read(
555 &mut self.dma, 589 dma,
556 request, 590 request,
557 regs.fifor().as_ptr() as *mut u32, 591 regs.fifor().as_ptr() as *mut u32,
558 buffer, 592 buffer,
@@ -692,13 +726,16 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
692 Signalling::SDR12 => 0xFF_FF00, 726 Signalling::SDR12 => 0xFF_FF00,
693 }; 727 };
694 728
695 let mut status = [0u32; 16]; 729 let status = match self.cmd_block.as_deref_mut() {
730 Some(x) => x,
731 None => &mut CmdBlock::new(),
732 };
696 733
697 // Arm `OnDrop` after the buffer, so it will be dropped first 734 // Arm `OnDrop` after the buffer, so it will be dropped first
698 let regs = T::regs(); 735 let regs = T::regs();
699 let on_drop = OnDrop::new(|| Self::on_drop()); 736 let on_drop = OnDrop::new(|| Self::on_drop());
700 737
701 let transfer = self.prepare_datapath_read(&mut status, 64, 6); 738 let transfer = Self::prepare_datapath_read(&self.config, &mut self.dma, status.as_mut(), 64, 6);
702 InterruptHandler::<T>::data_interrupts(true); 739 InterruptHandler::<T>::data_interrupts(true);
703 Self::cmd(Cmd::cmd6(set_function), true)?; // CMD6 740 Self::cmd(Cmd::cmd6(set_function), true)?; // CMD6
704 741
@@ -770,16 +807,21 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
770 let card = self.card.as_mut().ok_or(Error::NoCard)?; 807 let card = self.card.as_mut().ok_or(Error::NoCard)?;
771 let rca = card.rca; 808 let rca = card.rca;
772 809
810 let cmd_block = match self.cmd_block.as_deref_mut() {
811 Some(x) => x,
812 None => &mut CmdBlock::new(),
813 };
814
773 Self::cmd(Cmd::set_block_length(64), false)?; // CMD16 815 Self::cmd(Cmd::set_block_length(64), false)?; // CMD16
774 Self::cmd(Cmd::app_cmd(rca << 16), false)?; // APP 816 Self::cmd(Cmd::app_cmd(rca << 16), false)?; // APP
775 817
776 let mut status = [0u32; 16]; 818 let status = cmd_block;
777 819
778 // Arm `OnDrop` after the buffer, so it will be dropped first 820 // Arm `OnDrop` after the buffer, so it will be dropped first
779 let regs = T::regs(); 821 let regs = T::regs();
780 let on_drop = OnDrop::new(|| Self::on_drop()); 822 let on_drop = OnDrop::new(|| Self::on_drop());
781 823
782 let transfer = self.prepare_datapath_read(&mut status, 64, 6); 824 let transfer = Self::prepare_datapath_read(&self.config, &mut self.dma, status.as_mut(), 64, 6);
783 InterruptHandler::<T>::data_interrupts(true); 825 InterruptHandler::<T>::data_interrupts(true);
784 Self::cmd(Cmd::card_status(0), true)?; 826 Self::cmd(Cmd::card_status(0), true)?;
785 827
@@ -813,7 +855,7 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
813 for byte in status.iter_mut() { 855 for byte in status.iter_mut() {
814 *byte = u32::from_be(*byte); 856 *byte = u32::from_be(*byte);
815 } 857 }
816 self.card.as_mut().unwrap().status = status.into(); 858 self.card.as_mut().unwrap().status = status.0.into();
817 } 859 }
818 res 860 res
819 } 861 }
@@ -872,13 +914,17 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
872 Self::cmd(Cmd::set_block_length(8), false)?; // CMD16 914 Self::cmd(Cmd::set_block_length(8), false)?; // CMD16
873 Self::cmd(Cmd::app_cmd(card.rca << 16), false)?; 915 Self::cmd(Cmd::app_cmd(card.rca << 16), false)?;
874 916
875 let mut scr = [0u32; 2]; 917 let cmd_block = match self.cmd_block.as_deref_mut() {
918 Some(x) => x,
919 None => &mut CmdBlock::new(),
920 };
921 let scr = &mut cmd_block.0[..2];
876 922
877 // Arm `OnDrop` after the buffer, so it will be dropped first 923 // Arm `OnDrop` after the buffer, so it will be dropped first
878 let regs = T::regs(); 924 let regs = T::regs();
879 let on_drop = OnDrop::new(|| Self::on_drop()); 925 let on_drop = OnDrop::new(|| Self::on_drop());
880 926
881 let transfer = self.prepare_datapath_read(&mut scr[..], 8, 3); 927 let transfer = Self::prepare_datapath_read(&self.config, &mut self.dma, scr, 8, 3);
882 InterruptHandler::<T>::data_interrupts(true); 928 InterruptHandler::<T>::data_interrupts(true);
883 Self::cmd(Cmd::cmd51(), true)?; 929 Self::cmd(Cmd::cmd51(), true)?;
884 930
@@ -910,7 +956,7 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
910 drop(transfer); 956 drop(transfer);
911 957
912 unsafe { 958 unsafe {
913 let scr_bytes = &*(&scr as *const [u32; 2] as *const [u8; 8]); 959 let scr_bytes = &*(&scr as *const _ as *const [u8; 8]);
914 card.scr = SCR(u64::from_be_bytes(*scr_bytes)); 960 card.scr = SCR(u64::from_be_bytes(*scr_bytes));
915 } 961 }
916 } 962 }
@@ -1002,8 +1048,7 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
1002 Self::stop_datapath(); 1048 Self::stop_datapath();
1003 } 1049 }
1004 1050
1005 /// Initializes card (if present) and sets the bus at the 1051 /// Initializes card (if present) and sets the bus at the specified frequency.
1006 /// specified frequency.
1007 pub async fn init_card(&mut self, freq: Hertz) -> Result<(), Error> { 1052 pub async fn init_card(&mut self, freq: Hertz) -> Result<(), Error> {
1008 let regs = T::regs(); 1053 let regs = T::regs();
1009 let ker_ck = T::frequency(); 1054 let ker_ck = T::frequency();
@@ -1143,6 +1188,7 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
1143 } 1188 }
1144 } 1189 }
1145 } 1190 }
1191
1146 // Read status after signalling change 1192 // Read status after signalling change
1147 self.read_sd_status().await?; 1193 self.read_sd_status().await?;
1148 1194
@@ -1168,7 +1214,7 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
1168 let regs = T::regs(); 1214 let regs = T::regs();
1169 let on_drop = OnDrop::new(|| Self::on_drop()); 1215 let on_drop = OnDrop::new(|| Self::on_drop());
1170 1216
1171 let transfer = self.prepare_datapath_read(buffer, 512, 9); 1217 let transfer = Self::prepare_datapath_read(&self.config, &mut self.dma, buffer, 512, 9);
1172 InterruptHandler::<T>::data_interrupts(true); 1218 InterruptHandler::<T>::data_interrupts(true);
1173 Self::cmd(Cmd::read_single_block(address), true)?; 1219 Self::cmd(Cmd::read_single_block(address), true)?;
1174 1220
@@ -1291,6 +1337,14 @@ impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma> {
1291 pub fn clock(&self) -> Hertz { 1337 pub fn clock(&self) -> Hertz {
1292 self.clock 1338 self.clock
1293 } 1339 }
1340
1341 /// Set a specific cmd buffer rather than using the default stack allocated one.
1342 /// This is required if stack RAM cannot be used with DMA and usually manifests
1343 /// itself as an indefinite wait on a dma transfer because the dma peripheral
1344 /// cannot access the memory.
1345 pub fn set_cmd_block(&mut self, cmd_block: &'d mut CmdBlock) {
1346 self.cmd_block = Some(cmd_block)
1347 }
1294} 1348}
1295 1349
1296impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Drop for Sdmmc<'d, T, Dma> { 1350impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Drop for Sdmmc<'d, T, Dma> {
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs
index 656676d9f..20718147a 100644
--- a/embassy-stm32/src/spi/mod.rs
+++ b/embassy-stm32/src/spi/mod.rs
@@ -1282,6 +1282,7 @@ pub(crate) struct Info {
1282struct State {} 1282struct State {}
1283 1283
1284impl State { 1284impl State {
1285 #[allow(unused)]
1285 const fn new() -> Self { 1286 const fn new() -> Self {
1286 Self {} 1287 Self {}
1287 } 1288 }
diff --git a/embassy-stm32/src/tsc/mod.rs b/embassy-stm32/src/tsc/mod.rs
index 5cb58e918..17240e6bc 100644
--- a/embassy-stm32/src/tsc/mod.rs
+++ b/embassy-stm32/src/tsc/mod.rs
@@ -40,7 +40,7 @@
40//! g7.set_io2(context.PE3, PinType::Sample); 40//! g7.set_io2(context.PE3, PinType::Sample);
41//! g7.set_io3(context.PE4, PinType::Channel); 41//! g7.set_io3(context.PE4, PinType::Channel);
42//! 42//!
43//! let mut touch_controller = tsc::Tsc::new( 43//! let mut touch_controller = tsc::Tsc::new_blocking(
44//! context.TSC, 44//! context.TSC,
45//! Some(g1), 45//! Some(g1),
46//! Some(g2), 46//! Some(g2),
@@ -188,7 +188,7 @@ pub struct Config {
188 pub spread_spectrum_prescaler: bool, 188 pub spread_spectrum_prescaler: bool,
189 /// Selects AHB clock divider used to generate pulse generator clk 189 /// Selects AHB clock divider used to generate pulse generator clk
190 pub pulse_generator_prescaler: PGPrescalerDivider, 190 pub pulse_generator_prescaler: PGPrescalerDivider,
191 /// Maximum number of charge tranfer pulses that can be generated before error 191 /// Maximum number of charge transfer pulses that can be generated before error
192 pub max_count_value: MaxCount, 192 pub max_count_value: MaxCount,
193 /// Defines config of all IOs when no ongoing acquisition 193 /// Defines config of all IOs when no ongoing acquisition
194 pub io_default_mode: bool, 194 pub io_default_mode: bool,
diff --git a/embassy-stm32/src/usart/buffered.rs b/embassy-stm32/src/usart/buffered.rs
index 33bc009a8..06cc0e41d 100644
--- a/embassy-stm32/src/usart/buffered.rs
+++ b/embassy-stm32/src/usart/buffered.rs
@@ -436,6 +436,12 @@ impl<'d> BufferedUartRx<'d> {
436 } 436 }
437 } 437 }
438 438
439 /// we are ready to read if there is data in the buffer
440 fn read_ready(&mut self) -> Result<bool, Error> {
441 let state = self.state;
442 Ok(!state.rx_buf.is_empty())
443 }
444
439 /// Reconfigure the driver 445 /// Reconfigure the driver
440 pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> { 446 pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
441 reconfigure(self.info, self.kernel_clock, config)?; 447 reconfigure(self.info, self.kernel_clock, config)?;
@@ -610,6 +616,18 @@ impl<'d> embedded_io_async::Read for BufferedUartRx<'d> {
610 } 616 }
611} 617}
612 618
619impl<'d> embedded_io_async::ReadReady for BufferedUart<'d> {
620 fn read_ready(&mut self) -> Result<bool, Self::Error> {
621 BufferedUartRx::<'d>::read_ready(&mut self.rx)
622 }
623}
624
625impl<'d> embedded_io_async::ReadReady for BufferedUartRx<'d> {
626 fn read_ready(&mut self) -> Result<bool, Self::Error> {
627 Self::read_ready(self)
628 }
629}
630
613impl<'d> embedded_io_async::BufRead for BufferedUart<'d> { 631impl<'d> embedded_io_async::BufRead for BufferedUart<'d> {
614 async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> { 632 async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
615 self.rx.fill_buf().await 633 self.rx.fill_buf().await
diff --git a/embassy-sync/CHANGELOG.md b/embassy-sync/CHANGELOG.md
index a283adc0c..8f2d26fe0 100644
--- a/embassy-sync/CHANGELOG.md
+++ b/embassy-sync/CHANGELOG.md
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8## Unreleased 8## Unreleased
9 9
10- Add LazyLock sync primitive.
11
10## 0.6.0 - 2024-05-29 12## 0.6.0 - 2024-05-29
11 13
12- Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `Channel`. 14- Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `Channel`.
diff --git a/embassy-sync/README.md b/embassy-sync/README.md
index 2c1c0cf68..dec1fbc32 100644
--- a/embassy-sync/README.md
+++ b/embassy-sync/README.md
@@ -13,6 +13,7 @@ Synchronization primitives and data structures with async support:
13- [`WakerRegistration`](waitqueue::WakerRegistration) - Utility to register and wake a `Waker`. 13- [`WakerRegistration`](waitqueue::WakerRegistration) - Utility to register and wake a `Waker`.
14- [`AtomicWaker`](waitqueue::AtomicWaker) - A variant of `WakerRegistration` accessible using a non-mut API. 14- [`AtomicWaker`](waitqueue::AtomicWaker) - A variant of `WakerRegistration` accessible using a non-mut API.
15- [`MultiWakerRegistration`](waitqueue::MultiWakerRegistration) - Utility registering and waking multiple `Waker`'s. 15- [`MultiWakerRegistration`](waitqueue::MultiWakerRegistration) - Utility registering and waking multiple `Waker`'s.
16- [`LazyLock`](lazy_lock::LazyLock) - A value which is initialized on the first access
16 17
17## Interoperability 18## Interoperability
18 19
diff --git a/embassy-sync/build_common.rs b/embassy-sync/build_common.rs
index 0487eb3c5..4f24e6d37 100644
--- a/embassy-sync/build_common.rs
+++ b/embassy-sync/build_common.rs
@@ -8,8 +8,6 @@
8 8
9use std::collections::HashSet; 9use std::collections::HashSet;
10use std::env; 10use std::env;
11use std::ffi::OsString;
12use std::process::Command;
13 11
14/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring 12/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring
15/// them (`cargo:rust-check-cfg=cfg(X)`). 13/// them (`cargo:rust-check-cfg=cfg(X)`).
@@ -17,7 +15,6 @@ use std::process::Command;
17pub struct CfgSet { 15pub struct CfgSet {
18 enabled: HashSet<String>, 16 enabled: HashSet<String>,
19 declared: HashSet<String>, 17 declared: HashSet<String>,
20 emit_declared: bool,
21} 18}
22 19
23impl CfgSet { 20impl CfgSet {
@@ -25,7 +22,6 @@ impl CfgSet {
25 Self { 22 Self {
26 enabled: HashSet::new(), 23 enabled: HashSet::new(),
27 declared: HashSet::new(), 24 declared: HashSet::new(),
28 emit_declared: is_rustc_nightly(),
29 } 25 }
30 } 26 }
31 27
@@ -49,7 +45,7 @@ impl CfgSet {
49 /// 45 ///
50 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid. 46 /// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid.
51 pub fn declare(&mut self, cfg: impl AsRef<str>) { 47 pub fn declare(&mut self, cfg: impl AsRef<str>) {
52 if self.declared.insert(cfg.as_ref().to_owned()) && self.emit_declared { 48 if self.declared.insert(cfg.as_ref().to_owned()) {
53 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref()); 49 println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref());
54 } 50 }
55 } 51 }
@@ -69,21 +65,6 @@ impl CfgSet {
69 } 65 }
70} 66}
71 67
72fn is_rustc_nightly() -> bool {
73 if env::var_os("EMBASSY_FORCE_CHECK_CFG").is_some() {
74 return true;
75 }
76
77 let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
78
79 let output = Command::new(rustc)
80 .arg("--version")
81 .output()
82 .expect("failed to run `rustc --version`");
83
84 String::from_utf8_lossy(&output.stdout).contains("nightly")
85}
86
87/// Sets configs that describe the target platform. 68/// Sets configs that describe the target platform.
88pub fn set_target_cfgs(cfgs: &mut CfgSet) { 69pub fn set_target_cfgs(cfgs: &mut CfgSet) {
89 let target = env::var("TARGET").unwrap(); 70 let target = env::var("TARGET").unwrap();
diff --git a/embassy-sync/src/fmt.rs b/embassy-sync/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-sync/src/fmt.rs
+++ b/embassy-sync/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-sync/src/lazy_lock.rs b/embassy-sync/src/lazy_lock.rs
new file mode 100644
index 000000000..18e3c2019
--- /dev/null
+++ b/embassy-sync/src/lazy_lock.rs
@@ -0,0 +1,152 @@
1//! Synchronization primitive for initializing a value once, allowing others to get a reference to the value.
2
3use core::cell::UnsafeCell;
4use core::mem::ManuallyDrop;
5use core::sync::atomic::{AtomicBool, Ordering};
6
7/// The `LazyLock` is a synchronization primitive that allows for
8/// initializing a value once, and allowing others to obtain a
9/// reference to the value. This is useful for lazy initialization of
10/// a static value.
11///
12/// # Example
13/// ```
14/// use futures_executor::block_on;
15/// use embassy_sync::lazy_lock::LazyLock;
16///
17/// // Define a static value that will be lazily initialized
18/// // at runtime at the first access.
19/// static VALUE: LazyLock<u32> = LazyLock::new(|| 20);
20///
21/// let reference = VALUE.get();
22/// assert_eq!(reference, &20);
23/// ```
24pub struct LazyLock<T, F = fn() -> T> {
25 init: AtomicBool,
26 data: UnsafeCell<Data<T, F>>,
27}
28
29union Data<T, F> {
30 value: ManuallyDrop<T>,
31 f: ManuallyDrop<F>,
32}
33
34unsafe impl<T, F> Sync for LazyLock<T, F> {}
35
36impl<T, F: FnOnce() -> T> LazyLock<T, F> {
37 /// Create a new uninitialized `StaticLock`.
38 pub const fn new(init_fn: F) -> Self {
39 Self {
40 init: AtomicBool::new(false),
41 data: UnsafeCell::new(Data {
42 f: ManuallyDrop::new(init_fn),
43 }),
44 }
45 }
46
47 /// Get a reference to the underlying value, initializing it if it
48 /// has not been done already.
49 #[inline]
50 pub fn get(&self) -> &T {
51 self.ensure_init_fast();
52 unsafe { &(*self.data.get()).value }
53 }
54
55 /// Consume the `LazyLock`, returning the underlying value. The
56 /// initialization function will be called if it has not been
57 /// already.
58 #[inline]
59 pub fn into_inner(self) -> T {
60 self.ensure_init_fast();
61 let this = ManuallyDrop::new(self);
62 let data = unsafe { core::ptr::read(&this.data) }.into_inner();
63
64 ManuallyDrop::into_inner(unsafe { data.value })
65 }
66
67 /// Initialize the `LazyLock` if it has not been initialized yet.
68 /// This function is a fast track to [`Self::ensure_init`]
69 /// which does not require a critical section in most cases when
70 /// the value has been initialized already.
71 /// When this function returns, `self.data` is guaranteed to be
72 /// initialized and visible on the current core.
73 #[inline]
74 fn ensure_init_fast(&self) {
75 if !self.init.load(Ordering::Acquire) {
76 self.ensure_init();
77 }
78 }
79
80 /// Initialize the `LazyLock` if it has not been initialized yet.
81 /// When this function returns, `self.data` is guaranteed to be
82 /// initialized and visible on the current core.
83 fn ensure_init(&self) {
84 critical_section::with(|_| {
85 if !self.init.load(Ordering::Acquire) {
86 let data = unsafe { &mut *self.data.get() };
87 let f = unsafe { ManuallyDrop::take(&mut data.f) };
88 let value = f();
89 data.value = ManuallyDrop::new(value);
90
91 self.init.store(true, Ordering::Release);
92 }
93 });
94 }
95}
96
97impl<T, F> Drop for LazyLock<T, F> {
98 fn drop(&mut self) {
99 if self.init.load(Ordering::Acquire) {
100 unsafe { ManuallyDrop::drop(&mut self.data.get_mut().value) };
101 } else {
102 unsafe { ManuallyDrop::drop(&mut self.data.get_mut().f) };
103 }
104 }
105}
106
107#[cfg(test)]
108mod tests {
109 use core::sync::atomic::{AtomicU32, Ordering};
110
111 use super::*;
112
113 #[test]
114 fn test_lazy_lock() {
115 static VALUE: LazyLock<u32> = LazyLock::new(|| 20);
116 let reference = VALUE.get();
117 assert_eq!(reference, &20);
118 }
119 #[test]
120 fn test_lazy_lock_into_inner() {
121 let lazy: LazyLock<u32> = LazyLock::new(|| 20);
122 let value = lazy.into_inner();
123 assert_eq!(value, 20);
124 }
125
126 static DROP_CHECKER: AtomicU32 = AtomicU32::new(0);
127 struct DropCheck;
128
129 impl Drop for DropCheck {
130 fn drop(&mut self) {
131 DROP_CHECKER.fetch_add(1, Ordering::Acquire);
132 }
133 }
134
135 #[test]
136 fn test_lazy_drop() {
137 let lazy: LazyLock<DropCheck> = LazyLock::new(|| DropCheck);
138 assert_eq!(DROP_CHECKER.load(Ordering::Acquire), 0);
139 lazy.get();
140 drop(lazy);
141 assert_eq!(DROP_CHECKER.load(Ordering::Acquire), 1);
142
143 let dropper = DropCheck;
144 let lazy_fn: LazyLock<u32, _> = LazyLock::new(move || {
145 let _a = dropper;
146 20
147 });
148 assert_eq!(DROP_CHECKER.load(Ordering::Acquire), 1);
149 drop(lazy_fn);
150 assert_eq!(DROP_CHECKER.load(Ordering::Acquire), 2);
151 }
152}
diff --git a/embassy-sync/src/lib.rs b/embassy-sync/src/lib.rs
index a5eee8d02..014bf1d06 100644
--- a/embassy-sync/src/lib.rs
+++ b/embassy-sync/src/lib.rs
@@ -12,6 +12,7 @@ mod ring_buffer;
12 12
13pub mod blocking_mutex; 13pub mod blocking_mutex;
14pub mod channel; 14pub mod channel;
15pub mod lazy_lock;
15pub mod mutex; 16pub mod mutex;
16pub mod once_lock; 17pub mod once_lock;
17pub mod pipe; 18pub mod pipe;
diff --git a/embassy-time/CHANGELOG.md b/embassy-time/CHANGELOG.md
index 75e17fd63..3b4d93387 100644
--- a/embassy-time/CHANGELOG.md
+++ b/embassy-time/CHANGELOG.md
@@ -7,7 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8## Unreleased 8## Unreleased
9 9
10## 0.4.0 - 2024-01-11 10## 0.3.2 - 2024-08-05
11
12- Implement with_timeout()/with_deadline() method style call on Future
13- Add collapse_debuginfo to fmt.rs macros.
14
15## 0.3.1 - 2024-01-11
11 16
12- Add with\_deadline convenience function and example 17- Add with\_deadline convenience function and example
13- Implement Clone for Delay 18- Implement Clone for Delay
diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml
index 5d5bd8b23..c3b4e4e3a 100644
--- a/embassy-time/Cargo.toml
+++ b/embassy-time/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-time" 2name = "embassy-time"
3version = "0.3.1" 3version = "0.3.2"
4edition = "2021" 4edition = "2021"
5description = "Instant and Duration for embedded no-std systems, with async timer support" 5description = "Instant and Duration for embedded no-std systems, with async timer support"
6repository = "https://github.com/embassy-rs/embassy" 6repository = "https://github.com/embassy-rs/embassy"
@@ -431,4 +431,4 @@ wasm-timer = { version = "0.2.5", optional = true }
431[dev-dependencies] 431[dev-dependencies]
432serial_test = "0.9" 432serial_test = "0.9"
433critical-section = { version = "1.1", features = ["std"] } 433critical-section = { version = "1.1", features = ["std"] }
434embassy-executor = { version = "0.5.0", path = "../embassy-executor" } 434embassy-executor = { version = "0.6.0", path = "../embassy-executor" }
diff --git a/embassy-time/src/fmt.rs b/embassy-time/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-time/src/fmt.rs
+++ b/embassy-time/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-usb-dfu/Cargo.toml b/embassy-usb-dfu/Cargo.toml
index 968fbec74..481b2699a 100644
--- a/embassy-usb-dfu/Cargo.toml
+++ b/embassy-usb-dfu/Cargo.toml
@@ -31,11 +31,11 @@ log = { version = "0.4.17", optional = true }
31 31
32bitflags = "2.4.1" 32bitflags = "2.4.1"
33cortex-m = { version = "0.7.7", features = ["inline-asm"], optional = true } 33cortex-m = { version = "0.7.7", features = ["inline-asm"], optional = true }
34embassy-boot = { version = "0.2.0", path = "../embassy-boot" } 34embassy-boot = { version = "0.3.0", path = "../embassy-boot" }
35embassy-futures = { version = "0.1.1", path = "../embassy-futures" } 35embassy-futures = { version = "0.1.1", path = "../embassy-futures" }
36embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 36embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
37embassy-time = { version = "0.3.1", path = "../embassy-time" } 37embassy-time = { version = "0.3.2", path = "../embassy-time" }
38embassy-usb = { version = "0.2.0", path = "../embassy-usb", default-features = false } 38embassy-usb = { version = "0.3.0", path = "../embassy-usb", default-features = false }
39embedded-storage = { version = "0.3.1" } 39embedded-storage = { version = "0.3.1" }
40esp32c3-hal = { version = "0.13.0", optional = true, default-features = false } 40esp32c3-hal = { version = "0.13.0", optional = true, default-features = false }
41 41
diff --git a/embassy-usb-dfu/src/fmt.rs b/embassy-usb-dfu/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-usb-dfu/src/fmt.rs
+++ b/embassy-usb-dfu/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-usb-logger/Cargo.toml b/embassy-usb-logger/Cargo.toml
index 62b4ee723..d796e5d8e 100644
--- a/embassy-usb-logger/Cargo.toml
+++ b/embassy-usb-logger/Cargo.toml
@@ -15,7 +15,7 @@ src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb-l
15target = "thumbv7em-none-eabi" 15target = "thumbv7em-none-eabi"
16 16
17[dependencies] 17[dependencies]
18embassy-usb = { version = "0.2.0", path = "../embassy-usb" } 18embassy-usb = { version = "0.3.0", path = "../embassy-usb" }
19embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 19embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
20embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 20embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
21log = "0.4" 21log = "0.4"
diff --git a/embassy-usb-synopsys-otg/src/fmt.rs b/embassy-usb-synopsys-otg/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-usb-synopsys-otg/src/fmt.rs
+++ b/embassy-usb-synopsys-otg/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-usb-synopsys-otg/src/lib.rs b/embassy-usb-synopsys-otg/src/lib.rs
index b90e059f6..f155f1522 100644
--- a/embassy-usb-synopsys-otg/src/lib.rs
+++ b/embassy-usb-synopsys-otg/src/lib.rs
@@ -382,8 +382,8 @@ impl<'d, const MAX_EP_COUNT: usize> Driver<'d, MAX_EP_COUNT> {
382 } 382 }
383 383
384 let eps = match D::dir() { 384 let eps = match D::dir() {
385 Direction::Out => &mut self.ep_out, 385 Direction::Out => &mut self.ep_out[..self.instance.endpoint_count],
386 Direction::In => &mut self.ep_in, 386 Direction::In => &mut self.ep_in[..self.instance.endpoint_count],
387 }; 387 };
388 388
389 // Find free endpoint slot 389 // Find free endpoint slot
diff --git a/embassy-usb/CHANGELOG.md b/embassy-usb/CHANGELOG.md
index 5f665ed25..efdda96fb 100644
--- a/embassy-usb/CHANGELOG.md
+++ b/embassy-usb/CHANGELOG.md
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8## Unreleased 8## Unreleased
9 9
10## 0.3.0 - 2024-08-05
11
12- bump usbd-hid from 0.7.0 to 0.8.1
13- Add collapse_debuginfo to fmt.rs macros.
14- update embassy-sync dependency
15
10## 0.2.0 - 2024-05-20 16## 0.2.0 - 2024-05-20
11 17
12- [#2862](https://github.com/embassy-rs/embassy/pull/2862) WebUSB implementation by @chmanie 18- [#2862](https://github.com/embassy-rs/embassy/pull/2862) WebUSB implementation by @chmanie
diff --git a/embassy-usb/Cargo.toml b/embassy-usb/Cargo.toml
index 191ed0a6a..e310d8bae 100644
--- a/embassy-usb/Cargo.toml
+++ b/embassy-usb/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-usb" 2name = "embassy-usb"
3version = "0.2.0" 3version = "0.3.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Async USB device stack for embedded devices in Rust." 6description = "Async USB device stack for embedded devices in Rust."
@@ -49,12 +49,12 @@ max-handler-count-8 = []
49embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 49embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
50embassy-usb-driver = { version = "0.1.0", path = "../embassy-usb-driver" } 50embassy-usb-driver = { version = "0.1.0", path = "../embassy-usb-driver" }
51embassy-sync = { version = "0.6.0", path = "../embassy-sync" } 51embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
52embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } 52embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel" }
53 53
54defmt = { version = "0.3", optional = true } 54defmt = { version = "0.3", optional = true }
55log = { version = "0.4.14", optional = true } 55log = { version = "0.4.14", optional = true }
56heapless = "0.8" 56heapless = "0.8"
57 57
58# for HID 58# for HID
59usbd-hid = { version = "0.7.0", optional = true } 59usbd-hid = { version = "0.8.1", optional = true }
60ssmarshal = { version = "1.0", default-features = false, optional = true } 60ssmarshal = { version = "1.0", default-features = false, optional = true }
diff --git a/embassy-usb/src/fmt.rs b/embassy-usb/src/fmt.rs
index 35b929fde..8ca61bc39 100644
--- a/embassy-usb/src/fmt.rs
+++ b/embassy-usb/src/fmt.rs
@@ -90,19 +90,15 @@ macro_rules! todo {
90 }; 90 };
91} 91}
92 92
93#[cfg(not(feature = "defmt"))]
94#[collapse_debuginfo(yes)]
95macro_rules! unreachable {
96 ($($x:tt)*) => {
97 ::core::unreachable!($($x)*)
98 };
99}
100
101#[cfg(feature = "defmt")]
102#[collapse_debuginfo(yes)] 93#[collapse_debuginfo(yes)]
103macro_rules! unreachable { 94macro_rules! unreachable {
104 ($($x:tt)*) => { 95 ($($x:tt)*) => {
105 ::defmt::unreachable!($($x)*) 96 {
97 #[cfg(not(feature = "defmt"))]
98 ::core::unreachable!($($x)*);
99 #[cfg(feature = "defmt")]
100 ::defmt::unreachable!($($x)*);
101 }
106 }; 102 };
107} 103}
108 104
diff --git a/embassy-usb/src/msos.rs b/embassy-usb/src/msos.rs
index 25936d084..9f4e1a57b 100644
--- a/embassy-usb/src/msos.rs
+++ b/embassy-usb/src/msos.rs
@@ -278,6 +278,7 @@ pub enum DescriptorType {
278 278
279/// Table 5. Descriptor set information structure. 279/// Table 5. Descriptor set information structure.
280#[allow(non_snake_case)] 280#[allow(non_snake_case)]
281#[allow(unused)]
281#[repr(C, packed(1))] 282#[repr(C, packed(1))]
282pub struct DescriptorSetInformation { 283pub struct DescriptorSetInformation {
283 dwWindowsVersion: u32, 284 dwWindowsVersion: u32,
@@ -288,6 +289,7 @@ pub struct DescriptorSetInformation {
288 289
289/// Table 4. Microsoft OS 2.0 platform capability descriptor header. 290/// Table 4. Microsoft OS 2.0 platform capability descriptor header.
290#[allow(non_snake_case)] 291#[allow(non_snake_case)]
292#[allow(unused)]
291#[repr(C, packed(1))] 293#[repr(C, packed(1))]
292pub struct PlatformDescriptor { 294pub struct PlatformDescriptor {
293 bLength: u8, 295 bLength: u8,
diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml
index dbbe0fddc..93e49faef 100644
--- a/examples/boot/application/nrf/Cargo.toml
+++ b/examples/boot/application/nrf/Cargo.toml
@@ -6,12 +6,12 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-16384", "arch-cortex-m", "executor-thread", "integrated-timers", "arch-cortex-m", "executor-thread"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-16384", "arch-cortex-m", "executor-thread", "integrated-timers", "arch-cortex-m", "executor-thread"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [] }
11embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", ] } 11embassy-nrf = { version = "0.2.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", ] }
12embassy-boot = { version = "0.2.0", path = "../../../../embassy-boot", features = [] } 12embassy-boot = { version = "0.3.0", path = "../../../../embassy-boot", features = [] }
13embassy-boot-nrf = { version = "0.2.0", path = "../../../../embassy-boot-nrf", features = [] } 13embassy-boot-nrf = { version = "0.3.0", path = "../../../../embassy-boot-nrf", features = [] }
14embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 14embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
15 15
16defmt = { version = "0.3", optional = true } 16defmt = { version = "0.3", optional = true }
17defmt-rtt = { version = "0.4", optional = true } 17defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/application/rp/Cargo.toml b/examples/boot/application/rp/Cargo.toml
index d4341e8f6..c109c0732 100644
--- a/examples/boot/application/rp/Cargo.toml
+++ b/examples/boot/application/rp/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-16384", "arch-cortex-m", "executor-thread", "integrated-timers", "arch-cortex-m", "executor-thread"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-16384", "arch-cortex-m", "executor-thread", "integrated-timers", "arch-cortex-m", "executor-thread"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [] }
11embassy-rp = { version = "0.1.0", path = "../../../../embassy-rp", features = ["time-driver", ] } 11embassy-rp = { version = "0.2.0", path = "../../../../embassy-rp", features = ["time-driver", ] }
12embassy-boot-rp = { version = "0.2.0", path = "../../../../embassy-boot-rp", features = [] } 12embassy-boot-rp = { version = "0.3.0", path = "../../../../embassy-boot-rp", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = "0.3" 15defmt = "0.3"
16defmt-rtt = "0.4" 16defmt-rtt = "0.4"
diff --git a/examples/boot/application/stm32f3/Cargo.toml b/examples/boot/application/stm32f3/Cargo.toml
index c203ffc9f..1c2934298 100644
--- a/examples/boot/application/stm32f3/Cargo.toml
+++ b/examples/boot/application/stm32f3/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32f303re", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32f303re", "time-driver-any", "exti"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32" } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32" }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = { version = "0.3", optional = true } 15defmt = { version = "0.3", optional = true }
16defmt-rtt = { version = "0.4", optional = true } 16defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml
index ed13eab65..09e34c7df 100644
--- a/examples/boot/application/stm32f7/Cargo.toml
+++ b/examples/boot/application/stm32f7/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = { version = "0.3", optional = true } 15defmt = { version = "0.3", optional = true }
16defmt-rtt = { version = "0.4", optional = true } 16defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/application/stm32h7/Cargo.toml b/examples/boot/application/stm32h7/Cargo.toml
index f25e9815d..5e7f4d5e7 100644
--- a/examples/boot/application/stm32h7/Cargo.toml
+++ b/examples/boot/application/stm32h7/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32h743zi", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32h743zi", "time-driver-any", "exti"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = { version = "0.3", optional = true } 15defmt = { version = "0.3", optional = true }
16defmt-rtt = { version = "0.4", optional = true } 16defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/application/stm32l0/Cargo.toml b/examples/boot/application/stm32l0/Cargo.toml
index c1a47dfe4..60fdcfafb 100644
--- a/examples/boot/application/stm32l0/Cargo.toml
+++ b/examples/boot/application/stm32l0/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32l072cz", "time-driver-any", "exti", "memory-x"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32l072cz", "time-driver-any", "exti", "memory-x"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = { version = "0.3", optional = true } 15defmt = { version = "0.3", optional = true }
16defmt-rtt = { version = "0.4", optional = true } 16defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/application/stm32l1/Cargo.toml b/examples/boot/application/stm32l1/Cargo.toml
index 1e83d3113..fe3ab2c04 100644
--- a/examples/boot/application/stm32l1/Cargo.toml
+++ b/examples/boot/application/stm32l1/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32l151cb-a", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32l151cb-a", "time-driver-any", "exti"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = { version = "0.3", optional = true } 15defmt = { version = "0.3", optional = true }
16defmt-rtt = { version = "0.4", optional = true } 16defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/application/stm32l4/Cargo.toml b/examples/boot/application/stm32l4/Cargo.toml
index bca292681..169856358 100644
--- a/examples/boot/application/stm32l4/Cargo.toml
+++ b/examples/boot/application/stm32l4/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "time-driver-any", "exti"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = { version = "0.3", optional = true } 15defmt = { version = "0.3", optional = true }
16defmt-rtt = { version = "0.4", optional = true } 16defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/application/stm32wb-dfu/Cargo.toml b/examples/boot/application/stm32wb-dfu/Cargo.toml
index 0484e6ceb..7cef8fe0d 100644
--- a/examples/boot/application/stm32wb-dfu/Cargo.toml
+++ b/examples/boot/application/stm32wb-dfu/Cargo.toml
@@ -6,12 +6,12 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32wb55rg", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32wb55rg", "time-driver-any", "exti"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14embassy-usb = { version = "0.2.0", path = "../../../../embassy-usb" } 14embassy-usb = { version = "0.3.0", path = "../../../../embassy-usb" }
15embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["application", "cortex-m"] } 15embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["application", "cortex-m"] }
16 16
17defmt = { version = "0.3", optional = true } 17defmt = { version = "0.3", optional = true }
diff --git a/examples/boot/application/stm32wl/Cargo.toml b/examples/boot/application/stm32wl/Cargo.toml
index b785a1968..860a835a9 100644
--- a/examples/boot/application/stm32wl/Cargo.toml
+++ b/examples/boot/application/stm32wl/Cargo.toml
@@ -6,11 +6,11 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.0", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.5.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32wl55jc-cm4", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["stm32wl55jc-cm4", "time-driver-any", "exti"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../../../embassy-embedded-hal" }
14 14
15defmt = { version = "0.3", optional = true } 15defmt = { version = "0.3", optional = true }
16defmt-rtt = { version = "0.4", optional = true } 16defmt-rtt = { version = "0.4", optional = true }
diff --git a/examples/boot/bootloader/rp/memory.x b/examples/boot/bootloader/rp/memory.x
index c3b54976e..88b5bbb15 100644
--- a/examples/boot/bootloader/rp/memory.x
+++ b/examples/boot/bootloader/rp/memory.x
@@ -2,7 +2,7 @@ MEMORY
2{ 2{
3 /* NOTE 1 K = 1 KiBi = 1024 bytes */ 3 /* NOTE 1 K = 1 KiBi = 1024 bytes */
4 BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100 4 BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100
5 FLASH : ORIGIN = 0x10000100, LENGTH = 24K 5 FLASH : ORIGIN = 0x10000100, LENGTH = 24K - 0x100
6 BOOTLOADER_STATE : ORIGIN = 0x10006000, LENGTH = 4K 6 BOOTLOADER_STATE : ORIGIN = 0x10006000, LENGTH = 4K
7 ACTIVE : ORIGIN = 0x10007000, LENGTH = 512K 7 ACTIVE : ORIGIN = 0x10007000, LENGTH = 512K
8 DFU : ORIGIN = 0x10087000, LENGTH = 516K 8 DFU : ORIGIN = 0x10087000, LENGTH = 516K
diff --git a/examples/boot/bootloader/stm32wb-dfu/Cargo.toml b/examples/boot/bootloader/stm32wb-dfu/Cargo.toml
index 9950ed7b6..050b672ce 100644
--- a/examples/boot/bootloader/stm32wb-dfu/Cargo.toml
+++ b/examples/boot/bootloader/stm32wb-dfu/Cargo.toml
@@ -18,7 +18,7 @@ embedded-storage = "0.3.1"
18embedded-storage-async = "0.4.0" 18embedded-storage-async = "0.4.0"
19cfg-if = "1.0.0" 19cfg-if = "1.0.0"
20embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["dfu", "cortex-m"] } 20embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["dfu", "cortex-m"] }
21embassy-usb = { version = "0.2.0", path = "../../../../embassy-usb", default-features = false } 21embassy-usb = { version = "0.3.0", path = "../../../../embassy-usb", default-features = false }
22embassy-futures = { version = "0.1.1", path = "../../../../embassy-futures" } 22embassy-futures = { version = "0.1.1", path = "../../../../embassy-futures" }
23 23
24[features] 24[features]
diff --git a/examples/nrf-rtos-trace/Cargo.toml b/examples/nrf-rtos-trace/Cargo.toml
index 70a89bb30..98a678815 100644
--- a/examples/nrf-rtos-trace/Cargo.toml
+++ b/examples/nrf-rtos-trace/Cargo.toml
@@ -16,9 +16,9 @@ log = [
16 16
17[dependencies] 17[dependencies]
18embassy-sync = { version = "0.6.0", path = "../../embassy-sync" } 18embassy-sync = { version = "0.6.0", path = "../../embassy-sync" }
19embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "rtos-trace", "integrated-timers"] } 19embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "rtos-trace", "integrated-timers"] }
20embassy-time = { version = "0.3.1", path = "../../embassy-time" } 20embassy-time = { version = "0.3.2", path = "../../embassy-time" }
21embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] } 21embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = ["nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
22 22
23cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 23cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
24cortex-m-rt = "0.7.0" 24cortex-m-rt = "0.7.0"
diff --git a/examples/nrf51/Cargo.toml b/examples/nrf51/Cargo.toml
index c52256d8e..93a19bea7 100644
--- a/examples/nrf51/Cargo.toml
+++ b/examples/nrf51/Cargo.toml
@@ -5,9 +5,9 @@ version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-4096", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 8embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-4096", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
9embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 9embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
10embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf51", "gpiote", "time-driver-rtc1", "unstable-pac", "time", "rt"] } 10embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = ["defmt", "nrf51", "gpiote", "time-driver-rtc1", "unstable-pac", "time", "rt"] }
11 11
12defmt = "0.3" 12defmt = "0.3"
13defmt-rtt = "0.4" 13defmt-rtt = "0.4"
diff --git a/examples/nrf52810/Cargo.toml b/examples/nrf52810/Cargo.toml
index 2031b253f..0e3e81c3f 100644
--- a/examples/nrf52810/Cargo.toml
+++ b/examples/nrf52810/Cargo.toml
@@ -7,9 +7,9 @@ license = "MIT OR Apache-2.0"
7[dependencies] 7[dependencies]
8embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 8embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
10embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 10embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
11embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 11embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
12embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52810", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 12embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = ["defmt", "nrf52810", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] }
13 13
14defmt = "0.3" 14defmt = "0.3"
15defmt-rtt = "0.4" 15defmt-rtt = "0.4"
diff --git a/examples/nrf52840-rtic/Cargo.toml b/examples/nrf52840-rtic/Cargo.toml
index 731cee843..7fae7aefc 100644
--- a/examples/nrf52840-rtic/Cargo.toml
+++ b/examples/nrf52840-rtic/Cargo.toml
@@ -9,8 +9,8 @@ rtic = { version = "2", features = ["thumbv7-backend"] }
9 9
10embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 10embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = [ "defmt", "defmt-timestamp-uptime", "generic-queue"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = [ "defmt", "defmt-timestamp-uptime", "generic-queue"] }
13embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = [ "defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 13embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = [ "defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] }
14 14
15defmt = "0.3" 15defmt = "0.3"
16defmt-rtt = "0.4" 16defmt-rtt = "0.4"
diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml
index 000857821..17fa6234d 100644
--- a/examples/nrf52840/Cargo.toml
+++ b/examples/nrf52840/Cargo.toml
@@ -7,11 +7,11 @@ license = "MIT OR Apache-2.0"
7[dependencies] 7[dependencies]
8embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 8embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
10embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 10embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
11embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 11embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
12embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 12embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] }
13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } 13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] }
14embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
15embedded-io = { version = "0.6.0", features = ["defmt-03"] } 15embedded-io = { version = "0.6.0", features = ["defmt-03"] }
16embedded-io-async = { version = "0.6.1", features = ["defmt-03"] } 16embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
17embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] } 17embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] }
@@ -27,7 +27,7 @@ cortex-m-rt = "0.7.0"
27panic-probe = { version = "0.3", features = ["print-defmt"] } 27panic-probe = { version = "0.3", features = ["print-defmt"] }
28rand = { version = "0.8.4", default-features = false } 28rand = { version = "0.8.4", default-features = false }
29embedded-storage = "0.3.1" 29embedded-storage = "0.3.1"
30usbd-hid = "0.7.0" 30usbd-hid = "0.8.1"
31serde = { version = "1.0.136", default-features = false } 31serde = { version = "1.0.136", default-features = false }
32embedded-hal = { version = "1.0" } 32embedded-hal = { version = "1.0" }
33embedded-hal-async = { version = "1.0" } 33embedded-hal-async = { version = "1.0" }
diff --git a/examples/nrf5340/Cargo.toml b/examples/nrf5340/Cargo.toml
index 02f6190f0..0da85be07 100644
--- a/examples/nrf5340/Cargo.toml
+++ b/examples/nrf5340/Cargo.toml
@@ -7,11 +7,11 @@ license = "MIT OR Apache-2.0"
7[dependencies] 7[dependencies]
8embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 8embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
10embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 10embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
11embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 11embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
12embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf5340-app-s", "time-driver-rtc1", "gpiote", "unstable-pac"] } 12embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = ["defmt", "nrf5340-app-s", "time-driver-rtc1", "gpiote", "unstable-pac"] }
13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } 13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] }
14embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
15embedded-io-async = { version = "0.6.1" } 15embedded-io-async = { version = "0.6.1" }
16 16
17defmt = "0.3" 17defmt = "0.3"
@@ -23,7 +23,7 @@ cortex-m-rt = "0.7.0"
23panic-probe = { version = "0.3", features = ["print-defmt"] } 23panic-probe = { version = "0.3", features = ["print-defmt"] }
24rand = { version = "0.8.4", default-features = false } 24rand = { version = "0.8.4", default-features = false }
25embedded-storage = "0.3.1" 25embedded-storage = "0.3.1"
26usbd-hid = "0.7.0" 26usbd-hid = "0.8.1"
27serde = { version = "1.0.136", default-features = false } 27serde = { version = "1.0.136", default-features = false }
28 28
29[profile.release] 29[profile.release]
diff --git a/examples/nrf9151/ns/.cargo/config.toml b/examples/nrf9151/ns/.cargo/config.toml
new file mode 100644
index 000000000..1444b0cd1
--- /dev/null
+++ b/examples/nrf9151/ns/.cargo/config.toml
@@ -0,0 +1,9 @@
1[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2# replace nRF82840_xxAA with your chip as listed in `probe-rs chip list`
3runner = "probe-rs run --chip nRF9160_xxAA"
4
5[build]
6target = "thumbv8m.main-none-eabihf"
7
8[env]
9DEFMT_LOG = "trace"
diff --git a/examples/nrf9151/ns/Cargo.toml b/examples/nrf9151/ns/Cargo.toml
new file mode 100644
index 000000000..17fe27b67
--- /dev/null
+++ b/examples/nrf9151/ns/Cargo.toml
@@ -0,0 +1,20 @@
1[package]
2edition = "2021"
3name = "embassy-nrf9151-non-secure-examples"
4version = "0.1.0"
5license = "MIT OR Apache-2.0"
6
7[dependencies]
8embassy-executor = { version = "0.6.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
9embassy-time = { version = "0.3.2", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
10embassy-nrf = { version = "0.2.0", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-ns", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] }
11
12defmt = "0.3"
13defmt-rtt = "0.4"
14
15cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
16cortex-m-rt = "0.7.0"
17panic-probe = { version = "0.3", features = ["print-defmt"] }
18
19[profile.release]
20debug = 2
diff --git a/examples/nrf9151/ns/README.md b/examples/nrf9151/ns/README.md
new file mode 100644
index 000000000..a3f81d24e
--- /dev/null
+++ b/examples/nrf9151/ns/README.md
@@ -0,0 +1,4 @@
1You must flash the TFM before running any non-secure examples. The TFM
2configures the secure and non-secure execution environments and then loads the
3non-secure application. A reference TFM is included, and you can use the
4provided helper script to flash it.
diff --git a/examples/nrf9151/ns/build.rs b/examples/nrf9151/ns/build.rs
new file mode 100644
index 000000000..30691aa97
--- /dev/null
+++ b/examples/nrf9151/ns/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
11use std::env;
12use std::fs::File;
13use std::io::Write;
14use std::path::PathBuf;
15
16fn 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/nrf9151/ns/flash_tfm.sh b/examples/nrf9151/ns/flash_tfm.sh
new file mode 100644
index 000000000..29e4e0ed5
--- /dev/null
+++ b/examples/nrf9151/ns/flash_tfm.sh
@@ -0,0 +1,2 @@
1nrfjprog --family NRF91 --recover
2nrfjprog --family NRF91 --chiperase --verify --program tfm.hex
diff --git a/examples/nrf9151/ns/memory.x b/examples/nrf9151/ns/memory.x
new file mode 100644
index 000000000..8d7b66fcc
--- /dev/null
+++ b/examples/nrf9151/ns/memory.x
@@ -0,0 +1,7 @@
1MEMORY
2{
3 /* Trusted Firmware-M (TF-M) is flashed at the start */
4 FLASH : ORIGIN = 0x00008000, LENGTH = 0xf8000
5 RAM (rwx) : ORIGIN = 0x2000C568, LENGTH = 0x33a98
6}
7
diff --git a/examples/nrf9151/ns/src/bin/blinky.rs b/examples/nrf9151/ns/src/bin/blinky.rs
new file mode 100644
index 000000000..7457a95a3
--- /dev/null
+++ b/examples/nrf9151/ns/src/bin/blinky.rs
@@ -0,0 +1,22 @@
1#![no_std]
2#![no_main]
3
4use embassy_executor::Spawner;
5use embassy_nrf::gpio::{Level, Output, OutputDrive};
6use embassy_time::Timer;
7use {defmt_rtt as _, panic_probe as _};
8
9#[embassy_executor::main]
10async fn main(_spawner: Spawner) {
11 let p = embassy_nrf::init(Default::default());
12 let mut led = Output::new(p.P0_00, Level::Low, OutputDrive::Standard);
13
14 loop {
15 led.set_high();
16 defmt::info!("high");
17 Timer::after_millis(500).await;
18 led.set_low();
19 defmt::info!("low");
20 Timer::after_millis(1000).await;
21 }
22}
diff --git a/examples/nrf9151/ns/src/bin/uart.rs b/examples/nrf9151/ns/src/bin/uart.rs
new file mode 100644
index 000000000..2220dccfb
--- /dev/null
+++ b/examples/nrf9151/ns/src/bin/uart.rs
@@ -0,0 +1,37 @@
1#![no_std]
2#![no_main]
3
4use defmt::*;
5use embassy_executor::Spawner;
6use embassy_nrf::{bind_interrupts, peripherals, uarte};
7use {defmt_rtt as _, panic_probe as _};
8
9bind_interrupts!(struct Irqs {
10 SPIM0_SPIS0_TWIM0_TWIS0_UARTE0 => uarte::InterruptHandler<peripherals::SERIAL0>;
11});
12
13#[embassy_executor::main]
14async fn main(_spawner: Spawner) {
15 let p = embassy_nrf::init(Default::default());
16 let mut config = uarte::Config::default();
17 config.parity = uarte::Parity::EXCLUDED;
18 config.baudrate = uarte::Baudrate::BAUD115200;
19
20 let mut uart = uarte::Uarte::new(p.SERIAL0, Irqs, p.P0_26, p.P0_27, config);
21
22 info!("uarte initialized!");
23
24 // Message must be in SRAM
25 let mut buf = [0; 8];
26 buf.copy_from_slice(b"Hello!\r\n");
27
28 unwrap!(uart.write(&buf).await);
29 info!("wrote hello in uart!");
30
31 loop {
32 info!("reading...");
33 unwrap!(uart.read(&mut buf).await);
34 info!("writing...");
35 unwrap!(uart.write(&buf).await);
36 }
37}
diff --git a/examples/nrf9151/ns/tfm.hex b/examples/nrf9151/ns/tfm.hex
new file mode 100644
index 000000000..9864a1849
--- /dev/null
+++ b/examples/nrf9151/ns/tfm.hex
@@ -0,0 +1,1543 @@
1:10000000F80B0020690600000D070000255A0000CB
2:10001000455A0000655A0000A55A0000855A0000A4
3:100020000000000000000000000000001D2700008C
4:100030000D070000000000000D0700000D07000084
5:10004000000000000000000000000000F13200008D
6:10005000000000000D07000000000000000000008C
7:100060000D0700000D0700000D0700000D07000040
8:10007000000000000D0700000D0700000D07000044
9:100080000D0700000D070000000000000000000048
10:100090000D0700000D070000000000000000000038
11:1000A0000D07000000000000000000000D07000028
12:1000B0000D0700000D0700000D0700000D070000F0
13:1000C0000D0700000D0700000D0700000D070000E0
14:1000D0000D070000000000000D07000000000000F8
15:1000E0000D070000000000000D07000000000000E8
16:1000F0000D070000000000000000000000000000EC
17:10010000000000000D0700000000000000000000DB
18:1001100000000000000000000000000000000000DF
19:10012000000000000D0700000000000000000000BB
20:1001300000000000000000000000000000000000BF
21:100140000D07000000015F5F00000000FE0B0000D3
22:10015000F9270000800600000000000000000000F9
23:10016000000000000000000000000000401200201D
24:100170000000000001015F5F030100001F0100009B
25:1001800085040000000000000000000001000000E5
26:10019000010000000000000000000000000000005E
27:1001A0000000000070000000CC5E00008000000035
28:1001B000000F000001000000D102000001015F5F9C
29:1001C000040100001F010000F30500000000000012
30:1001D000000000000000000001000000000000001E
31:1001E000000000000000000000000000D75E0000DA
32:1001F000400000000507000001000000DF040000CF
33:1002000038B50025054C29462046D4F80024C4F80A
34:10021000045405F0B0FCC4F8005438BD200C002094
35:1002200013B511460022CDE9002242680346382A60
36:10023000046844D194F82820022A19D01AB900F091
37:1002400047F902B010BD21482468D0F80404013AEF
38:10025000CDE90040082A35D8DFE802F0050A0E1380
39:10026000181D22272C006A46184600F02EF9E8E7F0
40:10027000184600F018F9E4E76A46184600F016F947
41:10028000DFE76A46184600F00BF9DAE76A461846D7
42:1002900000F00FF9D5E76A46184600F00DF9D0E7EF
43:1002A0006A46184600F00BF9CBE76A46184600F09C
44:1002B00009F9C6E76A46184600F00EF9C1E76FF083
45:1002C0008000BEE76FF08500BBE700BF200C002078
46:1002D0002DE9F04F05680446A1B0002D40F0AA803A
47:1002E0002022294602A805F046FC12AF202229460A
48:1002F0000AA805F040FC38222946384605F03BFCA8
49:10030000E26904F11C039846B2B10426E26A04F1E2
50:100310002C03EAB10425EEB96FF08306304621B014
51:10032000BDE8F08F002EF1D053F8041D3246013E97
52:100330000029F7D01646E9E70326F5E7002DEAD0B5
53:1003400053F8041D2A46013D0029F7D01546E2E77F
54:100350000325F5E738233A460021606805F048FC9C
55:100360003828D9D14FF00109CDE90270334F0DF192
56:10037000080A04F1100B4E45D7F800141CD10DF1FA
57:1003800028094B46002008EB850EC64533D108B13D
58:10039000C7F80014A3683146C7F804340AAA2B46EC
59:1003A00002A8FFF73DFF00270646BD4209F10809F4
60:1003B00038D1FFF725FFB1E75BF8043FC1F5806254
61:1003C000D81C20F00300904204D9FFF719FF6FF00A
62:1003D0008C06A3E70844CA19C7F8000449466068B8
63:1003E000019205F005FC019ACAF80C0009F1010917
64:1003F0004AF8082FBFE758F804CFC1F5806A0CF11E
65:10040000030222F00302524503F1080305D87818CD
66:1004100043E9020C11440120B7E70028D5D0C7F802
67:100420000014D2E7394659E90223606805F0F5FB6C
68:100430000137BAE76FF0850670E700BF200C002097
69:1004400008B528220021024805F095FB002008BDD0
70:100450002810002010B5044C0F222046034905F057
71:1004600065FB204610BD00BF51100020F6050000BE
72:1004700008B50121024803F011FB002008BD00BFB0
73:100480005010002008B5FFF7DBFF40B9FFF7E2FF8F
74:10049000FFF7EEFF18B9BDE8084003F06DBB08BDDB
75:1004A0006FF0850070476FF0850070476FF0850032
76:1004B00070476FF0850070476FF0850070476FF0F0
77:1004C000850070476FF0850070476FF085007047BA
78:1004D000D1E9000103F030BB6FF085007047F0B543
79:1004E00003680546B3F57D7FA7B007D040F2F5322B
80:1004F000934207D06FF0850027B0F0BD01F08EFC6D
81:100500000020F9E700243C22214607A8CDE9024457
82:10051000CDE90444069405F02EFB3C22214617A8A1
83:10052000169405F028FBEA69019405F11C0302B357
84:100530000426EA6A05F12C033AB30424731E012B46
85:1005400052D8012C50D80423002168680DEB030217
86:1005500005F04EFB04281AD06FF08000CCE7002E87
87:10056000E7D053F8041D3246013E0029F7D0164665
88:10057000DFE70326F5E7002CE0D053F8041D224600
89:10058000013C0029F7D01446D8E70324F5E7022EF2
90:1005900016D16E69402E29D806AF33463A4601215E
91:1005A000686805F025FB8642D6D1CDE9027602A91E
92:1005B00044B92246019801F01AFE044620469BE702
93:1005C0000021F5E72B6A402BC6D816AACDE90423F3
94:1005D000019804AA01F00BFEDDE904230446002182
95:1005E000686805F01AFBE9E7012085E76FF08900EC
96:1005F00082E7002070474D62656420544C532033DD
97:100600002E352E3000000000000000000000000029
98:1006100000000000000000000000000000000000DA
99:100620005431000001000000407C000080100020D8
100:100630004A000000407C0000200C00200000000068
101:10064000407C0000000C002000000000A8110020E9
102:10065000C4050000200C002018010000000C002040
103:100660000800000002F07ABC08B572B61E4A1F4BA3
104:100670009A601F4B83F309881E4B83F30A8883F328
105:100680000B881D4B16A1D1E90001C3E9000100F060
106:1006900089F81A4B1A498B4212D30020194B1A4978
107:1006A0008B4218D303F06AF8186850F82240586853
108:1006B00040F82240013298688242F5D30C33EAE7D1
109:1006C0000022F8E71C6844F8220001325C68A2426C
110:1006D000F8D30833E4E70022F8E700BFAFF3008067
111:1006E000A5EDF5FEA5EDF5FE0000000000ED00E033
112:1006F000F80B002000040020F80B00202806000062
113:100700004C0600004C06000064060000EFF3088071
114:10071000EFF309812DE9F00F6B46724600F038F9CE
115:1007200008B0FFF79FFFFEE708B5EFF31083012B3A
116:100730000C4A07D1126ABFF34F8F511C4A424A41FB
117:10074000104608BD01F0BEFB00B172B6126ABFF3DD
118:100750004F8F531C5A425A4101F0B4FB0028EFD08E
119:1007600062B6EDE70080FF0008B5EFF31083012BC0
120:100770000B4A06D1D269BFF34F8F02F00102104637
121:1007800008BD01F09FFB00B172B6D269BFF34F8F75
122:1007900002F0010201F096FB0028F0D062B6EEE70D
123:1007A0000080FF006F4A10B5D2F8D03043F002034A
124:1007B000C2F8D03001F086FB30B14FF05023002258
125:1007C000C3F81421C3F8182101F08BFB28B10122D2
126:1007D000654BC3F8382AC3F878254FF47F02D2F866
127:1007E0003031D2F83421BFF34F8FC3F30B03092B01
128:1007F00005D1012A1EBF01225B4BC3F8782501F009
129:1008000070FB18B10E22594BC3F8E42E01F05AFBCD
130:1008100030B10022544BC3F80C270122C3F8102733
131:100820000022D30003F57F03D3F80013BFF34F8FEB
132:10083000013108D0D3F800130132D3F80433B2F5F4
133:10084000807F0B60EDD1EFF31084FFF78DFF002860
134:100850004DD0BFF34F8F464BD3F80024012AFBD174
135:10086000C3F80425D3F80024012AFBD1012C03D0BE
136:1008700001F028FB00B172B6FFF776FF58B13D4A90
137:10088000D36923F00103D361BFF34F8F384AD2F805
138:100890000034012BFBD1FFF747FF68B1354A136ADB
139:1008A00023F0FF0343F020031362BFF34F8F304A5E
140:1008B000D2F80034012BFBD1012C03D001F002FB54
141:1008C00000B162B600222A4BC3F80425D3F80024F5
142:1008D000012AFBD1BFF34F8F2249274BCA6802F48C
143:1008E000E0621343CB60BFF34F8F00BFFDE7FFF71C
144:1008F0001BFF0028ADD11B4AD2F88C3043F4406373
145:10090000C2F88C304FF47F03D3F83021D3F8343160
146:10091000BFF34F8FC2F30B02092A16D1013B022B02
147:1009200002D8164AD35C83B1124815490368104AAD
148:100930008B420CBF5A230023C2F8103EC36A8B427D
149:100940000CBF5A230023C2F8003E064AD2F8883072
150:1009500043F47003C2F88830BFF34F8FBFF36F8F3B
151:1009600010BD00BF00ED00E00040005000A00350AB
152:10097000009003500080FF000400FA05C43300001B
153:10098000FA50FA507C22014905F0D0B8DC1800205A
154:1009900038B51D46374B384C5B68C3F308032360FA
155:1009A000EFF30383C4E901206365C2F3801302F00F
156:1009B0000C020C2AE16038D10BB9EFF389812022B7
157:1009C0002E48216105F0B2F825B1202229462C4895
158:1009D00005F0ACF8274B9A6AA265D96AE165986B75
159:1009E000206602F400406066586BA06602F080004A
160:1009F000E0669A62D962D3F8E4202267D3F8E8105F
161:100A0000616702F04001A167C3F8E42000F06AF8D2
162:100A10000E211C4801F077FA2268D31E042B1CD843
163:100A2000DFE803F0090F1215180013B9EFF38881FE
164:100A3000C5E70146C3E70C211348BDE8384001F083
165:100A400062BA12211148F8E70B211148F5E70D2190
166:100A50001048F2E70E211048EFE70F2A98BF142143
167:100A6000BDE8384089BF25210C480D48103A01F0F7
168:100A7000F5BB00BF00ED00E0DC180020F0180020FE
169:100A800010190020C7330000D5330000E133000007
170:100A9000F3330000FE3300000B3400001934000073
171:100AA0002D3400002DE9F34106460F460C4DD5F8D4
172:100AB0002C80C04710F00104FBD1394630466B69E9
173:100AC000984740B9C047C307FCD42B6A019302B0D2
174:100AD000BDE8F0411847204602B0BDE8F08100BFF4
175:100AE0005434000010B5094C0020A36898472369CE
176:100AF00002209847A46A4FF4E1310120A047234621
177:100B0000BDE8104001211520184700BF54340000F3
178:100B100010B5044C002023699847E368BDE81040F5
179:100B2000184700BF54340000064B82B018680023F9
180:100B300082B262F30F03000C60F31F43184602B049
181:100B4000704700BF9C340000014B1869704700BF1C
182:100B500084100020014B5869704700BF84100020AA
183:100B600038B50C4D0C4695F8203013B94FF0FF30D6
184:100B700038BD0A460146284600F06CFF064B9842F5
185:100B800005D00B3B9842F1D100206C61F0E76FF08B
186:100B90000100EDE7841000200B00AD0BF0B51B4EFB
187:100BA000054696F820300C4691B01BB94FF0FF3047
188:100BB00011B0F0BD00F06043B3F1005F21D100231C
189:100BC0000A460146304600F031FC114B98421AD0DB
190:100BD0000B3B9842EAD1346111E0A71B402F28BF9C
191:100BE0004027A9193A46684604F0A0FF39466846EE
192:100BF000FFF7D4FF0028DBD14036B442EDD8002007
193:100C0000D6E70026F9E76FF00100D1E78410002055
194:100C10000B00AD0BC3B2012B10B540F096804DF622
195:100C2000C023994270D028D8B1F5615F6FD011D838
196:100C3000B1F5965F6DD008D8B1F5966F6BD0B1F570
197:100C4000166F6BD06FF007005DE0B1F5165FF9D15C
198:100C5000454B33E047F61223994262D007D8B1F5ED
199:100C6000964F61D0B1F5E14FECD1404B26E0B1F5A4
200:100C7000164FE7D14FF41D0320E03D4B994255D06C
201:100C800011D8B1F5E13F54D007D8B1F5614F53D039
202:100C9000B1F5963FD6D1374B10E0B1F5613FD1D1D8
203:100CA0004FF06C730AE0B1F5612F48D0324B994296
204:100CB00048D0B1F5E12FC5D14FF0E86310F4E06FF3
205:100CC00046D110F4404103D0B1F5804F43D11021FB
206:100CD00010F4405203D0B2F5805F3FD10E2210F4E1
207:100CE000403003D0B0F5403F3BD10120234C20766B
208:100CF0006276E361A1760A4324681043C4F8243580
209:100D0000C4F86C05002010BD4FF46503D6E71C4BFA
210:100D1000D4E71C4BD2E74FF49E23CFE74FF41D23BB
211:100D2000CCE74FF40003C9E7174BC7E74FF08063E8
212:100D3000C4E74FF0EB73C1E74FF46B03BEE74FF02E
213:100D40007063BBE74FF08053B8E76FF00300DAE75A
214:100D50006FF00800D7E76FF00A00D4E76FF00900E2
215:100D6000D1E76FF00B00CEE70050270000C0750000
216:100D700090D0030000903A0140420F008410002000
217:100D800000F03A0000B0130000A04E0010B5114C66
218:100D9000204600F0D5FD0021206884F8201000F0E6
219:100DA00047FF226842F30732002A11DB0121530971
220:100DB0009B0003F1604303F56143D3F8800202F026
221:100DC0001F0201FA02F20243C3F88022D3F88032F4
222:100DD000002010BD8410002010B5264C0021206892
223:100DE0008EB000F017FF226842F30732002A12DBB0
224:100DF000012053099B0003F1604303F56143D3F8DD
225:100E0000801202F01F0200FA02F221EA0202C3F885
226:100E10008022D3F880322422002105A804F0ABFE02
227:100E2000D4E902124FF0FF33CDE90133CDE90333AA
228:100E30004FF0EB730B93072301A88DF8363001F0C8
229:100E400080F8014600220B4800F03AFA0A4B98421B
230:100E50000DD10C9B002023831B0CA3760B9BC4E9B4
231:100E60000400E361012384F820300EB010BD6FF060
232:100E70000100FAE7841000200000AD0B7FB50025CB
233:100E80000C46C0F808511646D0F80821D0F80022C8
234:100E900022F02002C0F80022104AC0F8082301F016
235:100EA000A0F8A560256104F14C03D3E8EF1F21F4FD
236:100EB0007F0121F47041C3E8E21F002AF5D110221E
237:100EC0002946684604F057FE042368468DF8003032
238:100ED0000196D4E90013984704B070BD10020A00CF
239:100EE00000F01F03400909D1074A02EB8303D3F83E
240:100EF0000012064A0A40C3F80022704700228033DD
241:100F000052F82330FFDE00BF00258450F0F8FCFFCC
242:100F10002DE9F04F804690F804A05020664F0E4611
243:100F200000FB0A70416885B049B113F0020304D098
244:100F3000836B002B00F0B2800123009300E000914E
245:100F40004FF0500909FB0A73DB6CD90600F1A6804B
246:100F50004FF0010BB3180293029BB34200F0A7803D
247:100F600006F06043039398F80450D8F8004009FB5A
248:100F700005739A6B9AB9039BB3F1005F40F09980B7
249:100F8000019200F0A1FD09FB0572D16C204601F031
250:100F9000010100F0F4FF28B900F09EFDE3E7012312
251:100FA0000193EEE7516C33460029BCBFD4F84C15D1
252:100FB0005164019A42B109FB05713078D1E90E23E1
253:100FC000D054D1E90E3213441BB1C4F84435C4F8EF
254:100FD00048B50022C4F82021D4F82011C4F85821C3
255:100FE000D4F85811C4F85021D4F850210822C4F87C
256:100FF0000025009AE2B14FF48003C4F80433C4F82A
257:1010000008B000F069FD502303FB0A725168002903
258:101010004BD1D26C120748D503FB0A734C33D3E88B
259:10102000EF1F21F00801C3E8E21F002A36D0F6E7DF
260:10103000C4F808B0019300F04FFD09FB0572D16CB4
261:10104000019B01F001012046019300F098FF8446C6
262:10105000019BD4F84C05D4F84425BCF1000F0DD108
263:101060009342F0D005EB850507EB0515D1B100F0F3
264:101070002BFD2946204600F0F9FFC2E705EB850568
265:10108000934207EB0515F1D10028EFD100F01CFDCC
266:101090002946204600F0EAFF00F01EFD074805B093
267:1010A000BDE8F08FC4F80CB0E1E7013654E704481E
268:1010B000F5E70448F3E700BF581900200800AD0B1E
269:1010C0000000AD0B0400AD0B430904D10123034A1A
270:1010D00083409360704700239B60FFDE00258450AF
271:1010E00000F01F0340090BD1084A02EB8302D2F83B
272:1010F0000012074B0B4043F00303C2F80032704765
273:101100000022803352F82330FFDE00BF00258450D8
274:10111000F0F8FCFF2DE9F84391F8303005460C4615
275:1011200090F804800F6853BB5023DFF85091781C6F
276:1011300003FB0893DE6C46F00072DA6404D0384694
277:10114000FFF7C2FFFFF7CCFF6068411C01D0FFF73B
278:10115000C7FE94F82C30012B11D1502303FB0893C8
279:10116000E06846F02066421CDE6401D0FFF7B8FE5E
280:10117000A068431C03D0FFF7A7FFFFF7B1FF94F867
281:101180002F0038B950223D4B02FB0833DA6C42F095
282:101190008072DA6494F82CC094F82D1094F82EE044
283:1011A000A26A2B6841EA0C01E668D4E90198C3F809
284:1011B00024254EEA0102C3F86C2550B9BCF1010F99
285:1011C000C3F80C75C3F8149504BFC3F80885C3F8B9
286:1011D0001065D3F8682503F26458012A08BFDA6065
287:1011E000D3F86425012A13D1082149F64046244F3B
288:1011F000C3F8001547F001075A60D8F800309BBBD0
289:101200002B68D3F88024C3F880240022C3F800257B
290:1012100000212B6894F83220C3F81011D3F8100184
291:10122000C3F82011D3F82001C3F82411D3F8240106
292:10123000C3F84411D3F84401C3F85811D3F8581136
293:1012400043F307335201002BD2B212DB0D49C81809
294:1012500080F800230122580903F01F0302FA03F368
295:1012600041F82030BDE8F8834020B847013EC4D1A2
296:10127000C6E7054903F00F03CA54F3E758190020E5
297:10128000A034000000E100E014ED00E000F01F03D6
298:1012900040090BD1084A02EB8302D2F80012074B37
299:1012A0000B4043F00203C2F8003270470022803343
300:1012B00052F82330FFDE00BF00258450F0F8FCFF19
301:1012C0002DE9F3479046502290F80490514C02FBD0
302:1012D00009FA04EB0A070D4697F84810064600295C
303:1012E00040F0858009EB890004EB001004F043FC1A
304:1012F0002B69AA6944F80A306B69BB6302B1013AF1
305:10130000502303FB0943DA632A6A042A81BFEA698E
306:101310009A610022DA6195F83130B8F1000F37D0C8
307:1013200083F001073F0233B1502303FB0943DA6C1A
308:1013300042F00102DA64502303FB09440123C4F89C
309:10134000048084F848303468D4F84C2112BB294614
310:101350003046FFF7DFFE0822002334688DF807309F
311:10136000C4F800250DF10702C4F84425C4F8483537
312:1013700001230A25A360E360D4F85831002B38D14B
313:10138000254B402043F001039847013DF4D128E06C
314:101390004746C8E708224FF06409C4F80025636097
315:1013A0001D4B43F0010AD4F84431F3B9D4F8243189
316:1013B000DBB94FF42070D047B9F10109F3D14B46A6
317:1013C0000022C4F84C21D4F84C11C4F81021D4F8F0
318:1013D0001011C4F84421D4F84411C4F80025002B9E
319:1013E000B5D10E4802B0BDE8F0870123E8E70C480C
320:1013F000F8E70023C4F820319845D4F82021C4F838
321:101400000035084B08BF00231F4333680648C3F864
322:101410000473E7E758190020A03400000100AD0B69
323:101420000C00AD0B10020A000000AD0B2DE9F047D7
324:1014300084460F469E4616460579002A51D04FF045
325:10144000500ADFF8BC80D0F800900AFB058ADAF871
326:10145000044074B96BB9DAF82C50002D43D1CAF8A6
327:101460002C20FFF755FD0446CAF82C502046BDE855
328:10147000F0871EF0030F07D0734632463946BDE8A9
329:10148000F0476046FFF744BD07F06043B3F1005FEB
330:101490004FF0500414D104FB058400F015FBE26A00
331:1014A0001AB1134C00F018FBE0E7C4E90A7605EB2B
332:1014B0008505484608EB051100F0E3FD0D4CF1E70A
333:1014C00004FB0584A36B83B100F0FEFAE36A002BF2
334:1014D000E7D1E36C012243F00203C4E90A76E36436
335:1014E000E5E7054CC2E7024CC0E7044CBEE700BF8D
336:1014F0000B00AD0B0000AD0B0600AD0B0A00AD0BF1
337:10150000581900202DE9F84350230679284D046826
338:1015100003FB0653D4F80473DA6AC4F8087322B9DB
339:101520002448C4F80473BDE8F88306EB860005F18F
340:101530004C024FEA001802EB0012D2E8EFCF4CF059
341:10154000080CC2E8E0CF0028F7D10122E26031B3F5
342:10155000D96C01EA02094946204600F010FD002836
343:10156000FAD000F0B1FAB9F1000F1CD1D4F8203153
344:1015700053B10123E360D4F85831002BFBD020464F
345:1015800005EB080100F072FD00F0A6FA0023C4F894
346:101590002031D4F82021502202FB0655EB62064888
347:1015A000C4F80473BFE7D4F85831002BE7D1EBE758
348:1015B000581900200500AD0B0000AD0B2DE9F843D4
349:1015C00090F80480484F08EB8806360106F14C0578
350:1015D00004683D44D5E8EF3F43F48052C5E8E02F6E
351:1015E0000028F7D1DB047BD4480705D5502303FB43
352:1015F00008739B69002B75D03C4B3E44C4F80833FC
353:101600000823C4F800350023C4F81031D4F81021A1
354:10161000C4F84C31D4F84C21C4F844310A03D4F84E
355:1016200044318B0303F4804302F400524903134313
356:1016300001F400410B43D5E8EF2F1A43C5E8E12F31
357:101640000029F8D14FF0500909FB0879D9F8083082
358:10165000BBB9D9F8043063B9D5E8EF3F23F47F0371
359:1016600023F47043C5E8E23F002AF5D12048BDE8E5
360:10167000F8830321304600F08FFCD9F80830002BA6
361:10168000EAD0D4F80433590713D5502303FB087369
362:101690005A6872B1DB6C1A030BD5D5E8EF3F23F41F
363:1016A0000023C5E8E23F002AF7D10621304600F0CA
364:1016B00073FC502303FB0873DB6CDB0401D40D487F
365:1016C000D5E7D4F84C310BB901232360502303FB39
366:1016D00008735B68002BF2D0044BC4F80433EEE7C8
367:1016E0000548C4E70548C2E75819002010020A005F
368:1016F0000200AD0B0000AD0B0B00AD0B0800AD0BF5
369:101700002DE9F84F056801F06043D5F804A3B3F163
370:10171000005F90F804B089461746C5F808A37CD14D
371:101720005023404E03FB0B639A6852B15B68002B59
372:101730005ED1D5F81021002A5AD0C5F81031D5F85D
373:101740001031502404FB0B64E269C4E90297002ABB
374:101750003CD00BEB8B0897424FEA081824D24FF08D
375:10176000000B3A46A1694846C4E902BB04F0DEF921
376:10177000E269A069D21BC119E26104F0A1F96368B2
377:101780006BB1B04449463A46404600F016FCE36C63
378:10179000990404D55A4641462846FFF76FFB224874
379:1017A000C5F804A3BDE8F88F4846A16904F0BEF966
380:1017B000E36963620023E3611C4B9844D8E8EF3F80
381:1017C00043F40023C8E8E23F002AF7D1502303FB8B
382:1017D0000B63586ADA689968DB6C121A0144C5F821
383:1017E0003415C5F83825DA04D9D501232B60D6E79E
384:1017F000502303FB0B6633698BB9F36CC5F8349542
385:101800005B04C6E90497C5F83875C8D5D5F8003229
386:1018100043F02003C5F80032C1E70548C0E705489A
387:10182000BEE700BF581900200000AD0BA41900202E
388:101830000A00AD0B0B00AD0B50232DE9F0413C4DE0
389:1018400090F80480046803FB0853DB6CD4F80002B2
390:1018500003F48223B3F5805F68D1D4F80463C4F83D
391:10186000086309B9830656D4D4F8003223F0200364
392:10187000C4F800324FF4842308EB8801090101F118
393:101880004C072F44D7E8EF0F1843C7E8EC0FBCF123
394:10189000000FF7D12AB9502303FB08535B68002BD4
395:1018A00041D1244BC4F8083301236360D4F8443198
396:1018B000002BFBD00023C4F84C31D4F84C21C4F8E1
397:1018C0001031D4F81021C4F84431D4F844315023F5
398:1018D00003FB0853DA6C12F400421FD1DA61204690
399:1018E00000F07FFB502303FB08550023AB602B6106
400:1018F000D7E8EF3F23F47F0323F47043C7E8E23FC8
401:10190000002AF5D126F4202626F404760A48C4F8E5
402:101910000463BDE8F0814FF48033ADE720462944ED
403:1019200000F071FBDBE701236360EFE70348F0E7BA
404:101930005819002010020A000000AD0B0500AD0B85
405:101940002DE9F8432F4A03680679C3F8082343F3C7
406:101950000733002B04460DDB01215A0903F01F0356
407:10196000994002F12003284A42F82310BFF34F8F19
408:10197000BFF36F8F012220461146FFF75DFF012163
409:101980002046FFF7BFFD50212279204D236801FB3F
410:101990000252D46CD3F80C05E201D3F81495D3F8B5
411:1019A0000875D3F8108509D54FF0FF32C3F80C2520
412:1019B000C3F81425C3F80825C3F81025A30116D5CC
413:1019C000411C01D0FFF762FCB9F1FF3F02D048464D
414:1019D000FFF75CFC22010AD5B8F1FF3F02D0404678
415:1019E000FFF754FC7B1C02D03846FFF74FFC502316
416:1019F000002203FB0653DA6483F848205A60BDE8EE
417:101A0000F88300BF10034A0000E100E058190020ED
418:101A100010B5502402790B4B04FB02335B686BB9A1
419:101A20000368D3F810211AB9D3F80025082A07D083
420:101A300011B1D3F83C350B60034810BD0348FCE7F7
421:101A40000348FAE7581900200000AD0B0800AD0B61
422:101A50000B00AD0BF7B505461646FFF751FE164BCA
423:101A60000446984222D1032128462F79FFF7A6FD8C
424:101A7000124B984201D0A0421BD15022104B02FBC6
425:101A800007335B6893B90C4C284601A9FFF7C0FFE8
426:101A9000A042F9D1019BB34207D301222846114647
427:101AA00003B0BDE8F040FFF7C7BE064C204603B0C8
428:101AB000F0BD0446FAE700BF0000AD0B0B00AD0B14
429:101AC000581900200800AD0B72B6024A13680133A2
430:101AD00013607047A8190020034A1368013B136084
431:101AE00003B962B6704700BFA81900200722024B55
432:101AF000C3F80423704700BF00300050084BD3F8F0
433:101B00000801D3F80021003818BF012080000AB175
434:101B100040F00100D3F804310BB140F002007047EF
435:101B2000003000500022074BC3F80021D3F8001109
436:101B3000C3F80421D3F80411C3F80821D3F80831FD
437:101B4000704700BF0030005000231720094A03F5FA
438:101B5000C0710133202B42F82100F8D10023172057
439:101B6000044A03F5E0710133202B42F82100F8D13B
440:101B7000704700BF0030005010B59DF80840C00B02
441:101B800043EA0423064CC90B43EA0213884200D9F6
442:101B900010BDC2B202F5C07244F822300130F5E740
443:101BA0000030005010B59DF8084000F1604043EA55
444:101BB000042301F16041074C400B490B43EA021337
445:101BC000884200D910BDC2B202F5E07244F822305A
446:101BD0000130F5E700300050C0F30E03C3F50043B9
447:101BE000B3FA83F3C3F11B03064AC0F3C730DBB279
448:101BF00040F4807043F48073C2F80005C2F80435E5
449:101C0000704700BF0030005043030148184470473C
450:101C1000FF1FF81F054BC0F30730090241F03001E8
451:101C200000F5007043F82010704700BF00300050EE
452:101C3000044BC0F30730090200F5007043F8201090
453:101C4000704700BF00300050003A18BF0122003931
454:101C500018BF012103688900074841EA420118635F
455:101C600059605A6842F001025A60BFF34F8FBFF3C8
456:101C70006F8F0020704700BF04AAFF0008B5FFF770
457:101C80003DFF044B162118600348BDE8084000F0F2
458:101C90003AB900BFEC1F0020A63400000C22014915
459:101CA00003F044BFEC1F002010B501F006FB044612
460:101CB00090B901F097FF044680B90A4A2E21D368F3
461:101CC000094823F008031B041B0C43F0BF6343F4D3
462:101CD0000033D36000F017F9204610BD45F22354BD
463:101CE000FAE700BF00ED00E0BC340000024B1860D2
464:101CF000024B002019607047FC1F0020F81F0020D5
465:101D00001FB5374C426923685A6282699A62C26978
466:101D1000DA62026A1A63426A5A63826A9A63C26A20
467:101D2000DA63026B1A64426B5A60826B9A60C26B10
468:101D3000DA60026C1A61426C5A61826C9A61C26C00
469:101D4000DA61026D1A62826D5A65C26D9A65026F20
470:101D5000DA65026E1A66826E5A66426F9A66EFF311
471:101D600088825A64EFF389829A644268DA64EFF3F6
472:101D700094821A65026801A81A67FFF78FFF23682B
473:101D8000019ADA6601221A70164B1C686408640016
474:101D90002046214622462346B7EE000AF7EE000A07
475:101DA000B7EE001AF7EE001AB7EE002AF7EE002A97
476:101DB000B7EE003AF7EE003AB7EE004AF7EE004A07
477:101DC000B7EE005AF7EE005AB7EE006AF7EE006A77
478:101DD000B7EE007AF7EE007A03F081FF04B010BD91
479:101DE000FC1F0020F81F002000B5A1B001A8FEF7DD
480:101DF000C9FD029B63B15B060AD4019B23F0020379
481:101E0000052B05D1044B1B6813B101A8FFF778FF20
482:101E100021B05DF804FB00BFF81F0020BFF34F8F17
483:101E20000549064BCA6802F4E0621343CB60BFF376
484:101E30004F8F00BFFDE700BF00ED00E00400FA0592
485:101E400038B543680C2B30D14B68042B2DD14FF0A3
486:101E5000FF3304680D6821682B6031B3A26822B398
487:101E60000623012001F081F9F8B96168104B99420D
488:101E70000DD9A2680F485318834202D9F43883421F
489:101E800010D8206803F052FE0020286038BD0A4BAD
490:101E900099420AD9A26809488B188342F1D90730C0
491:101EA000814202D906488342EBD90220EEE700BF07
492:101EB000FF01FF002C02FF002F01FF003801FF008F
493:101EC0004C01FF004FF47F03D3F83001D3F83431D5
494:101ED000BFF34F8FC0F30B00A0F1090358425841E4
495:101EE00070474FF47F02D2F83031D2F83401BFF39B
496:101EF0004F8FC3F30B03092B03D1431E58425841A4
497:101F0000704700207047FEF7CDBD012070476FF08D
498:101F100003007047002382B00193019802B070471C
499:101F20006FF003007047002382B00193019802B064
500:101F30007047022814BF6FF0030000207047FEF7BF
501:101F40002DBE30B501EB8202914200D130BD51F877
502:101F5000044B04F07F037F2B4FEA144408BF4FF07B
503:101F6000FF33032CF0D8DFE804F002040608036016
504:101F7000EAE74360E8E78360E6E7C360E4E7034637
505:101F8000D0F8580130B931B9D3F82001003818BF62
506:101F9000012070470120704730B504460D4685B0DA
507:101FA00010220021684603F0E6FDD4E900136846DC
508:101FB0008DF80050984705B030BD7FB504460E46F9
509:101FC000154600211022684603F0D5FD012368461E
510:101FD0008DF80030CDE90165D4E90013984704B0CD
511:101FE00070BD10B50446FFF76FFDD4F8583133B11A
512:101FF000D4F8043313F4800308BFC4F80035BDE8F7
513:102000001040FFF769BD70B50D4604460522AA21B0
514:10201000D0F83C65A86903F0AEFD0522AB69C4F8B1
515:102020003435C4F838250022C4F81021D4F8101132
516:102030000121E162D4F810110029FBD0C4F84C2131
517:10204000D4F84C11C4F81021D4F81021D4F83C2550
518:102050009642EA6109D15A1E043312F8011FAA29D7
519:1020600003D19A42F9D10023EB6170BDD0F8583109
520:1020700033B1CB6CC3F30032DB0458BFC0F800258A
521:10208000704770B5CE6C0D4606F001010446FFF7AF
522:1020900076FF38B94FF4800346F00406EE64C4F8C6
523:1020A000043370BDD5E90A365AB1296CEA6B761A49
524:1020B000964228BF164619443246A86B03F036FDF7
525:1020C000AB6B4FF0FF326A641BB1C4F84435C4F8FF
526:1020D00048650023C4F82031D4F82021C4F85831D1
527:1020E000D4F85821C4F85031D4F850310823C4F83A
528:1020F00000354FF48003C4F804330123A360D0E714
529:10210000C0037047C00300F5FF407F3070470020D8
530:1021100070471F2070474FF40040704700F57F4024
531:10212000C03040037047402070475F2070474FF435
532:10213000005070474B6830B513F01F052DD1026871
533:102140000C681068C0F30720844226D2506855609E
534:1021500094600C7C23F01F0304F001041C438B7C6F
535:10216000DB0003F018031C434B7C5B0003F0060309
536:102170002343D3608B68013B23F01F04CB685B00D3
537:1021800003F00E03234343F0010313615060BFF3D8
538:102190004F8FBFF36F8F284630BD0120FCE70368E7
539:1021A00000205A68C9B258609960D86018615A60B6
540:1021B000704770B50546002403681E68C6F30726FD
541:1021C000B44201D1002070BD21462846FFF7E7FF49
542:1021D0000134F5E70020704708B5FFF705FE72B639
543:1021E00020BFFDE7002070470020704770470B4676
544:1021F00070B5114618B1032806D0032070BD1846EB
545:10220000BDE87040FFF71CBE5A68082A01D00220C2
546:10221000F4E74C68042CFAD11D684FF0FF330E68C8
547:10222000296833600029F2D06B68002BEFD0262399
548:102230007422012000F099FF0028E8D122462323D0
549:102240000120696800F091FF04460028DFD1D5E93C
550:102250000001FFF74BFD30602046CFE730B50C465C
551:10226000154685B038B139B1FFF74DFE041E03DACB
552:10227000204605B030BD044640F60D23ADF80E30C3
553:1022800009230B4901A805F00F028A5C2D091A5495
554:10229000013B012BF7D147F630030C21ADF8043098
555:1022A000FFF731FE0028B4BF04462418E0E700BF62
556:1022B000EA34000008B5194B83F30A88184800F087
557:1022C000E7FF40BBFFF7F0FC28BBFFF783FF10BB25
558:1022D000FFF788FFD8B9FFF789FF00F067FA3521CB
559:1022E0001048FFF710FE17210F48FFF70CFE1821CA
560:1022F0000E48FFF708FE00F03FFC21210C48FFF7D5
561:1023000002FE00F03FFA00F0CDFE002008BDFFF70E
562:102310006BFF0028DFD000F021FEEEE70004002074
563:10232000AC190020FA3400002F35000046350000BB
564:102330005E3500002DE9F04F93B00093574B814676
565:10234000D3F800B00BB2002B0D461646C1F302685D
566:10235000C1F3024A04DA6FF0800013B0BDE8F08FD9
567:102360008B42C36001D10020F7E708EB0A03042B7E
568:10237000F1D8CC0F64014FEAC80731463A46DBF882
569:10238000080044F0020300F0F0FE01460028E2D10C
570:10239000202202A803F0EFFB3A46314602A84FEA9A
571:1023A000CA0603F0C3FB32460099DBF8080044F08C
572:1023B000060300F0DAFE07460028CCD101462022B1
573:1023C0000AA803F0D8FB324600990AA802AE03F02F
574:1023D000ADFB33460137B84514D91A46BC460DE06B
575:1023E000D2F808E0D16818687144884203D259686D
576:1023F00008448645AFD30CF1010C0832C445EFD137
577:102400000833E7E715F0006F18BF202409F118071B
578:1024100007EB880844F00203474513D1202C26D14E
579:10242000002D02DBC5F3C0456C0109F128050AAE99
580:1024300005EB8A0A44F0060455451AD1009BC9F8F9
581:102440007C3090E77268DBF8080056F8081B0193AF
582:1024500000F08BFE00287FF47EAF56F8042C019B21
583:1024600047F8042F56F8082C38633A62D4E7002462
584:10247000DBE77268234656F8081BDBF8080000F01B
585:1024800074FE00287FF467AF56F8043C45F8043F1B
586:1024900056F8083C28642B63CEE700BFB019002033
587:1024A0002DE9F0411F461A4B0D461646D3F8008021
588:1024B00000F051FF044608B900F050FDE368002B1E
589:1024C00001DA00F04BFD032D01D900F047FD04EBCC
590:1024D0008504E569E36CED1A16D006233A463146C9
591:1024E000D8F8080000F041FE08B100F037FDBD4209
592:1024F00028BF3D46E36CE16B2A461944304603F0A1
593:1025000015FBE36C2B44E3642846BDE8F08100BF73
594:10251000B01900202DE9F0411D461A4B0F46164612
595:10252000D3F8008000F017FF044608B900F016FD4C
596:10253000E368002B01DA00F011FD032F01D900F050
597:102540000DFD04EB8704E36AE26E9B1AAB4201D2F5
598:1025500000F004FD02232A463146D8F8080000F0B6
599:1025600004FE08B100F0FAFCE36EE06D2A46314645
600:10257000184403F0DBFAE36E00202B44E366BDE869
601:10258000F08100BFB01900202DE9F04105464FF061
602:1025900001080E4E0E4B37685C681CB92846376040
603:1025A000BDE8F0812268936813F400700CD1A36930
604:1025B000012B09D0D368346023B19847002801DA91
605:1025C00000F0CCFCC4F81880246AE6E7B0190020BB
606:1025D000B419002038B5044610B96FF0800038BD3A
607:1025E0008368002BF9D01A68002AF6D05D68002DA8
608:1025F000F3D00B4BE861A8691D6020B92B68DB683C
609:1026000053B90123AB61A36804F10C001B681B697B
610:10261000984701232360E2E798470028F1DADCE7D6
611:10262000B01900204268024B08461A60704700BF8C
612:10263000B0190020002330B505680446AA68C0E937
613:10264000063312F4406F85B01CD012F4006202D041
614:1026500000F0C2F90246A96A2B6968460B440731AB
615:1026600023F0070321F00701CDE9021300930023B3
616:1026700005490193EB6800F09FFA684600F04EFEB2
617:10268000024B1C6005B030BD89250000B019002048
618:1026900001F00C0370B50C2B0CBF154605464A061D
619:1026A0000C461ED58B0658BF2835AB6913F8026C53
620:1026B00084F00803C3F3C003C6F38012934201D031
621:1026C00000F04CFC16F0A00F1ED176B1032E17D0EF
622:1026D00032461C210E48FFF7C1FD6FF083032B60CB
623:1026E0000CE000F03BFC2026E2E700F03BFB044658
624:1026F000FEF70EFA2146074800F00AFE204670BD9C
625:10270000284600F03FFAF9E732461F210248E2E787
626:102710007F350000F80B00209B350000EFF30880A8
627:102720007146EFF30982EFF30B830CB406B4FFF7A5
628:10273000AFFF8646009900F0080001F00801401A3A
629:1027400002DC12DB04B070471EF020031CBF2DE931
630:10275000F00FBDF1080D0A4C254626462746A04637
631:10276000A146A246A34630B4704704B030BC1EF068
632:1027700020031CBF1DF1080DBDE8F00F04B0704729
633:10278000A5EDF5FE084BDA6882F07F4282F47F0205
634:1027900042F48042DA6000221A765A76DA76DA77E4
635:1027A000602283F82220704700ED00E0114BD3F83F
636:1027B000882042F47002C3F88820BFF34F8FBFF324
637:1027C0006F8FD3F88C2042F44062C3F88C20D3F88A
638:1027D000342242F08042C3F83422D3F8342242F04B
639:1027E0003C42C3F834224FF0E022D36843F4200384
640:1027F000D360704700ED00E0009A164B9A4227D153
641:1028000001229043014641EC100B41EC110B41ECCD
642:10281000120B41EC130B41EC140B41EC150B41EC8A
643:10282000160B41EC170BEFF3148222F0040282F333
644:102830001488BFF36F8F02460346044605460646DA
645:10284000074680468146824683468446864604473C
646:10285000FEE70000A5EDF5FE2DE9F041044618B9AC
647:1028600043F6DA30BDE8F0810029F9D0836800250D
648:1028700013F4406F14BF01230023134F43F00203EE
649:10288000DFF848800B6000F13006236AAB4201D8C4
650:102890000020E7E71421A369E26906EB830301FB4B
651:1028A00002330C226A4399188968090709D59B5895
652:1028B000BB4201D04345D3D1186810B10121FFF7C5
653:1028C000A9F90135E1E700BFB4100020AC100020E9
654:1028D00070B5324C86B03248FFF76BFC2368012597
655:1028E0005A1C01932F4B2260DA681B694FF4407623
656:1028F000039300232A4801A902920495ADF81460BD
657:102900008DF81630FFF716FC18B143F6DA3006B032
658:1029100070BD23688DF816005A1C0193224B204885
659:102920000293224B01A9CDE903352260ADF8146072
660:10293000FFF700FC0028E8D123688DF816005A1C28
661:1029400001931B4B164802931A4B01A9CDE903359D
662:102950002260ADF81460FFF7EDFB0028D5D12368A5
663:102960008DF816005A1C0193134B0D480293134B1C
664:1029700001A903930223049340F201132260ADF8EE
665:102980001430FFF7D7FB04460028BED12A4629465B
666:102990000348FFF759F92046B9E700BFBC190020EA
667:1029A000A81000202C36000060360000005F0000F8
668:1029B0002006000020060000000C0020200C002053
669:1029C000014B1868704700BF2C360000014B1B6894
670:1029D000186870472C360000014B1B685868704718
671:1029E0002C36000008B5FFF749F9FFF79BF80A4BB2
672:1029F0005A68103AD3B2120609D401215A0903F0D9
673:102A00001F03994002F16003044A42F82310BDE815
674:102A1000084000F0A3BA00BF00ED00E000E100E0D4
675:102A20000020034BD8765A6A42F470225A627047EB
676:102A300000ED00E00349044BCA68002092B2134342
677:102A4000CB60704700ED00E00800FA0500224FF06F
678:102A5000FF300D4B02F1A0010132102A43F8210092
679:102A6000F8D1D3F88022002022F00802C3F8802297
680:102A7000D3F88022D3F8802222F40072C3F8802297
681:102A8000D3F88032704700BF00E100E008B5FFF7DF
682:102A90002DF80822024BC3F880211A60002008BDDF
683:102AA00000E100E0064BD3F8D02022F00102C3F889
684:102AB000D020D3F8D02042F00202C3F8D0207047D3
685:102AC00000ED00E037B50124FFF73EF8134D224634
686:102AD000052347F6FF7100200094FFF74DF82246CA
687:102AE00007234FF000500E490094FFF75BF8D5E93B
688:102AF0000101072300220094FFF73EF8072300227C
689:102B0000084909480094FFF74DF82969E868013938
690:102B1000FFF762F8002003B030BD00BF2C36000084
691:102B2000FF7F0020FFFF03200080002038B5002435
692:102B30000E4D002155F8040B0134FFF779F81C2CD9
693:102B4000F7D10020012240F20111094BC3F88004A3
694:102B5000C3F88424C3F8C004C3F8C424054AC2F8E7
695:102B600040154FF48072C3F8402438BDBC350000D6
696:102B700000300050009003500122014B1A60704752
697:102B8000C019002010B50446094B228918686168F5
698:102B90000623806800F0E9FA28B9064B1B68012B70
699:102BA00001D100F087F86FF08603236010BD00BFED
700:102BB000B0190020C01900202DE9F84305461E4633
701:102BC0000068134B9046AA68A0F1080440E902335C
702:102BD000503890420F4601D200F0C0F9A4F14809E4
703:102BE00048220021484602F0C6FF002344E907338B
704:102BF00044F8143C4FF0807344F8043C6FF0020337
705:102C000044E9036744F8208CC5E90093BDE8F883E4
706:102C1000A5EDF5FE30B5094C024661680023084673
707:102C200040B105686D68954205D11BB1826860604E
708:102C30009A60816030BD03468068F1E7441A002045
709:102C400038B504462AB10B689B68DB0512D5002015
710:102C500038BD0B4B1D680DB900F080F900222B68C0
711:102C600099692C338A4203D053F8040FA04204D14F
712:102C70009142ECD16FF0FC00EAE70132F2E700BFCD
713:102C8000B019002070B504460E46154600213022CA
714:102C90000C3002F070FF064B20461B68A660636094
715:102CA000656100F001FA00232061236070BD00BF60
716:102CB000B0190020044B1B681BB11B680BB158688E
717:102CC00070474FF0FF307047B0190020064B10B529
718:102CD0001C680CB900F042F923689B6813F4406F3C
719:102CE00014BF0120002010BDB01900202DE9F843C9
720:102CF000904607460C46FFF7E9FF024624B96FF0FD
721:102D000080042046BDE8F8836300F8D5144B04F036
722:102D10001F0153F82150002DF1D02B682946586827
723:102D2000FFF78EFFB0B9C4F30721284600F001FB7E
724:102D300004460028E3D1EFF3108972B600F0C1F920
725:102D4000064689F3108840B142462946FFF79AFFAC
726:102D50003E60D6E76FF08104D3E76FF08204D0E7DE
727:102D6000C41900202DE9F04100F0AAF90023134E08
728:102D7000134F73607B6000F0E5F8DFF84880304661
729:102D800000F022F80446A8B139468023424600F0FC
730:102D90007FF80546204600F011FB206804F1080189
731:102DA000FFF75AFD08B100F0D9F829462046FFF791
732:102DB00041FCE4E7BDE8F04100F071B9B41900202E
733:102DC000441A0020C4190020F8B5054608B900F0DF
734:102DD000C5F82A4E346814F1290F4CD8284B1968CD
735:102DE00004F128038B4246D2236AA26903EB430312
736:102DF0000C321344606AE269024402EB820213441B
737:102E00009B00E31801D2994201D200F0A7F8236891
738:102E10001C4A1B0C1B04934201D000F09FF823882E
739:102E2000B3F5817F01D300F099F86368002B01DAD4
740:102E300000F094F8144A176807F124031360134A4A
741:102E40001268934201D900F089F8236AA26903EB62
742:102E500043030C32616A1344E2693C600A4402EBAA
743:102E600082021344326802EB83026B6832603B6279
744:102E70006F603846F8BD0027FBE700BFC410002094
745:102E80004836000000005F5FC0100020443600009C
746:102E90002DE9F74F0F4690460646009300B109B959
747:102EA00000F05CF8D6F800A0DAF818200AF1300338
748:102EB00003EB820BDAF81C40204B1D6854B10C2246
749:102EC00002FB04541C601E4B1B689C4201D900F09D
750:102ED00045F82C4625464FF00009DAF81C204A45F3
751:102EE00000D91CB9002003B0BDE8F08F142303FB08
752:102EF00009B20023C5E900269268AB60930516D598
753:102F0000B8F1000F02D0009B802B03D0019200F09B
754:102F100025F8019A12F0E00FD0B202D158F8202023
755:102F20001AB1019000F01AF8019848F820507A6818
756:102F300009F10109AA607D600C35CEE7BC100020C4
757:102F40004036000008B5FFF73BFD034B9860FFF7E4
758:102F50003DFD80F3888808BD00ED02E0FFF73CB935
759:102F60008230012808B506D8FFF7B0FE18B9BDE8D1
760:102F70000840FFF7F3BF08BDF8B506460D4600F060
761:102F8000EAF9044608B9FFF7E9FFA7680FB9FFF7A8
762:102F9000E5FFE368991C20D05A1C21D1A5B315F197
763:102FA000820F13D102232360EFF3108672B62946F5
764:102FB0002046FFF737FB054686F310882368022B6F
765:102FC00024D1204600F086F82846F8BD15F1830F7D
766:102FD000EAD0FFF7C3FF0025E6E702232360FAE704
767:102FE000002BF6DB204600F0DAF93B689B689B0576
768:102FF00001D50223236015F1810FD5D16369002B20
769:10300000D2DBFFF7ABFFCFE73546F4E700232360C1
770:10301000DAE708B5FFF7E0F86FF0830008BD2DE9A7
771:10302000F3410E46174698460546FFF74FFE00F05F
772:10303000A6F92946024601A8FFF758FE044660B9E2
773:1030400043463A4631460198FFF774F9044640B1C9
774:103050006B0002D5019800F03DF8204602B0BDE8B3
775:10306000F0810198FFF7B6FA0446F6E740F2011046
776:10307000704770B50546FFF729FE06462846FFF75C
777:10308000C9FD044608B9002070BD014632462846F5
778:10309000FFF7D6FD0028F6D12368D868F4E76FF073
779:1030A0000200704700DF70474FF480507047B0F562
780:1030B000805F03D1EFF30B808038704700207047AA
781:1030C0007047EFF30B8000F1800383F30B887047A8
782:1030D00000207047EFF30B83803B83F30B8870472E
783:1030E00080EA0000E1EE100A00EE100A00EE900AFD
784:1030F00001EE100A01EE900A02EE100A02EE900AAA
785:1031000003EE100A03EE900A04EE100A04EE900A91
786:1031100005EE100A05EE900A06EE100A06EE900A79
787:1031200007EE100A07EE900A08EE100A08EE900A61
788:1031300009EE100A09EE900A0AEE100A0AEE900A49
789:103140000BEE100A0BEE900A0CEE100A0CEE900A31
790:103150000DEE100A0DEE900A0EEE100A0EEE900A19
791:103160000FEE100A0FEE900A70472DE9F0410E465F
792:103170001546002A4AD0C4074BD480F00204C4F399
793:103180004004A40003F00602062A4AD144F00104D8
794:1031900022462946304602F077FBB8BB46E800F2EB
795:1031A00005EB0608100E120208F1FF3747E800F39E
796:1031B0004FEA136166D51B0264D5884262D046E8A7
797:1031C00000F547E800F7FEF7A2FF2D0E85424FEA13
798:1031D000176734D3FEF79DFF874230D82846FEF7A5
799:1031E00091FF2246C6F101010144304602F04CFB3A
800:1031F000002847D00135AF4218D83846FEF780FF87
801:103200002246A8EB000102F03FFBD8B30020BDE846
802:10321000F081EFF39484A40004F0040444F0120459
803:10322000B0E7990731D544F00804B1E72846FEF726
804:1032300067FF0646FEF76FFF22460146D5E7FEF719
805:1032400072FF85421ED3FEF770FF87421AD82846C8
806:10325000FEF7DAFC2246C6F101010144304602F0D5
807:1032600013FB78B10135AF4203D83846FEF756FF5D
808:10327000C6E72846FEF752FF0646FEF758FF2246ED
809:103280000146EBE76FF07F00C1E74CF2DA20BEE7C2
810:1032900010B50446FFF706FCFFF714FC10B143F627
811:1032A000DA3010BDFFF742FC0028F8D1FFF710FB21
812:1032B0000028F4D102232360F3E708B5FFF7B0FB41
813:1032C00010B143F6DA3008BDFFF7B4FB0028F8D19F
814:1032D00000F01CF80028F4D162B6FDF703FCFFF7FC
815:1032E000B5FB0028EDD1FFF7D1FB0028EBD0E8E7D4
816:1032F000EFF30880EFF309812DE9F00F6B4672467A
817:10330000FDF746FB08B0FFF76DFBFEE700207047B6
818:1033100004460D46FFF7E4FEA54628470368283318
819:1033200083F30988836883F30B88BFF36F8F40684A
820:10333000704703689A68DB6812F4806F05D18B428E
821:103340002CBF00206FF0FA0070478B420CBF0020AA
822:103350006FF0FA00704710B5FFF7A9FE0446FFF7BB
823:10336000B7FE50B9FFF7A6FCA3685B681B685B68F3
824:10337000834218BF0024204610BD0024FBE738B567
825:10338000054648B100F01BF8B5EBD07F044601D0EC
826:10339000FFF7E4FD204638BDFFF78CFCF4E700237F
827:1033A00010B500F1280252F8041F19B1C16F146C56
828:1033B00019444C600833202BF5D110BD70474FF0F5
829:1033C000FF307047000001464154414C20455252A5
830:1033D0004F523A2000486172644661756C740D0A60
831:1033E000004D656D4D616E616765206661756C7439
832:1033F0000D0A004275734661756C740D0A005573B1
833:103400006167654661756C740D0A0053656375727A
834:10341000654661756C740D0A005265736572766558
835:103420006420457863657074696F6E2000506C612C
836:1034300074666F726D2065787465726E616C206958
837:103440006E7465727275707420284952516E293AF3
838:1034500020000000290B00000B1F0000D90D000008
839:103460008D0D0000331F00003F1F0000610B0000A6
840:103470000F1F0000490B0000550B0000150C000049
841:10348000151F0000211F0000271F00001D00000065
842:10349000100004001C0002001100060003020202DA
843:1034A0000338FDD87047506C6174666F726D2045AB
844:1034B0007863657074696F6E3A0D0A00416C6C2018
845:1034C00070696E732068617665206265656E206341
846:1034D0006F6E66696775726564206173206E6F6ECA
847:1034E0002D7365637572650D0A00303132333435E2
848:1034F000363738394142434445461B5B313B333410
849:103500006D5B536563205468726561645D2053652B
850:103510006375726520696D61676520696E6974699C
851:10352000616C697A696E67211B5B306D0D0A00540E
852:10353000462D4D20466C6F6174204142493A204827
853:103540006172640D0A004C617A7920737461636B57
854:10355000696E6720656E61626C65640D0A001B5BB5
855:10356000313B33346D426F6F74696E672054462D62
856:103570004D2076322E302E301B5B306D0D0A0055FB
857:103580006E6B6E6F776E2053504D205356432072F2
858:1035900065717565737465643A2000556E6B6E6F66
859:1035A000776E20535643206E756D6265722072658A
860:1035B000717565737465643A200000000040005026
861:1035C000005000500080005000A0005000B000509B
862:1035D00000E0005000F000500000015000100150C9
863:1035E0000040015000500150007001500080015017
864:1035F00000B0015000C0015000D0015000E0015067
865:1036000000F0015000000250001002500020025053
866:103610000030025000400250006002500080025012
867:1036200000A002500090035000258450008000004C
868:1036300000800000FFFF0F00007C00000080000001
869:0C3640002C1200201412002000020000D8
870:10366000009A204B9A4208D110B502F0A7FA02F056
871:10367000A9F906BC96460C46744702F0E3FA009A94
872:10368000184B9A4208D110B502F0A4FA02F09AF948
873:1036900006BC96460C46744702F0D4FA0CB4029A63
874:1036A000104B9A420CD14FF0004319430CBC10B59B
875:1036B00000F09EF802F086F906BC96460C46744768
876:1036C00002F0C0FA009A074B9A4202D106490868F4
877:1036D000744702F0B7FA009A024B9A4200D174473D
878:1036E00002F0B0FAA5EDF5FE801000200348044B6F
879:1036F000834202D0034B03B118477047A811002042
880:10370000A8110020000000000548064B1B1AD90F25
881:1037100001EBA301491002D0034B03B118477047D6
882:10372000A8110020A81100200000000010B5064CD0
883:10373000237843B9FFF7DAFF044B13B10448AFF322
884:1037400000800123237010BDC0180020000000007D
885:10375000EC5E000008B5044B1BB104490448AFF30C
886:103760000080BDE80840CFE700000000C41800203A
887:10377000EC5E0000A3F5803A704700BF174B002BAA
888:1037800008BF134B9D46FFF7F5FF00218B460F4600
889:103790001348144A121A02F0EEF90E4B002B00D017
890:1037A00098470D4B002B00D09847002000210400C3
891:1037B0000D000D48002802D00C48AFF3008002F045
892:1037C000DBF820002900FEF775FD02F0C1F800BF0C
893:1037D000000008000000000000000000F80B0020BE
894:1037E000A8110020B8280020000000000000000000
895:1037F0002DE9F84304460D4616461F46EFF30583B0
896:10380000C3F308030BB1FFF7A9FBDFF834903B4685
897:10381000204632462946D9F80080FFF700FCD9F847
898:1038200000300446984506D0DB6901461869BDE8BA
899:10383000F843FFF7A1BBFFF793FB2046BDE8F883F1
900:10384000B019002001680E4A0346914215D1C169A2
901:10385000A2F11022A2F1EF1291420ED18268012A48
902:103860000BD8C26812B101698A4206D0586928B1E2
903:103870009B691B1A5842584170470120704700BF8E
904:1038800055AA00FF0D4B70B59E68A6B13046FFF7F4
905:10389000D9FF044678B9F3686BB935690DB920468C
906:1038A00070BD2846FFF7CEFF28B9EB68B34202D1BE
907:1038B0002E462D69F2E70124F1E700BF4C1A0020E3
908:1038C0002DE9F041394E3468F368D4B1B468C4B11D
909:1038D000002861D000295FD001FB00F5B5FBF0F0B6
910:1038E000884259D1291D57D8AA070DD025F00302C7
911:1038F00004321C4603E0616891424FD2A469002C57
912:10390000F9D12046BDE8F0812A46F2E7891A232939
913:1039100004F12007D4E9050C1AD80123A360A0B153
914:10392000C0F818C0A36903B158610023C4E9053386
915:103930003369DB0702D5FFF7A5FFA0BB2A460021AC
916:1039400038463C4602F017F9DBE7C6F80CC0E9E759
917:1039500002F1200804EB08032039C3E9011E2169A4
918:10396000DFF84CE0DC60196144F808E0AEF1102E9D
919:10397000AEF1EF1EC3F81CE001B1CB60C3E9050C4A
920:1039800040B18361996901B14B6101212361C4E9AF
921:103990000121CAE7F360F5E70024B2E7D4F808E0B4
922:1039A000BEF1000FB2D0012001F0D2FF4C1A00206E
923:1039B00055AA00FFF8B5054600283AD0364E3368C0
924:1039C000002B36D0B268002A33D0834203D8726805
925:1039D0001344984202D3012001F0BAFFA0F1200461
926:1039E0002046FFF72FFF0028F5D155F8183C012B92
927:1039F000F1D145F8180C55E90570DFB1BB68CBB9BA
928:103A000055F81C2C7B68203213447B60386100B170
929:103A1000C76020220021204602F0ADF8386908B1C5
930:103A200083682BB333699B0703D5FFF72BFF00286F
931:103A3000D1D1F8BD40B3836833BB42686368134497
932:103A4000203363600369D4E90521236192B9B9B9D0
933:103A5000426981696261A161A2B19461A26902B106
934:103A6000546103B1DC602022002102F084F8D9E720
935:103A70003C46E2E79161A1690029E9D04A61E7E7A4
936:103A8000F160F8E7F460E9E7F36845F8083C03B152
937:103A90005C61F460C6E700BF4C1A002038B50D46E3
938:103AA000142200210446124802F065F81149124818
939:103AB00000F02CF8232D1AD914F003031FBF043D86
940:103AC000ED18C3F10403E4182A460021204602F051
941:103AD00052F8074B094AC3E900459C602260A2F1F5
942:103AE0001022203DA2F1EF126560E261DC6038BD7A
943:103AF0004C1A0020B5390000C138000055AA00FF5B
944:103B0000014B1B68184700BFC8100020024B18600B
945:103B1000024B002019607047CC100020C810002014
946:103B200010B50A46044619B1024B00211B6898479C
947:103B300010BD00BFD0100020054B0A46197819B1FE
948:103B40000146181D02F0B8B86FF08800704700BF3A
949:103B5000601A002010B5074C00F032F8204602F041
950:103B6000BCF8201F0821FFF7DBFFBDE8104002F082
951:103B7000A0B800BF641A002070B50C4D2B787BB93B
952:103B800002F095F8044670B90126281D6E7002F007
953:103B900091F8044638B900F00BF8044618B92E70B5
954:103BA0000024204670BDFFF7D5FFFAE7601A002019
955:103BB0000122024B002083F880257047681A0020FC
956:103BC000F8B5074C2025264601272046276202F03B
957:103BD0005DF8013D04F12C04F7D186F88055F8BD5D
958:103BE000681A002010B50C4C236813B10B4B1B68EE
959:103BF0002BB900F089FC30B90122084B1A6001236F
960:103C00002360002010BD0138062801D9044810BDEA
961:103C1000044B53F8200010BD042000200020002099
962:103C2000FE8FFFFF545D0000144B2DE9F043002888
963:103C300014BF04461C46124F236883B0BB4219D000
964:103C400016460D4620464FF4147104F1040900F0A5
965:103C500047F804F58E78484600F0CEF8404600F06C
966:103C600019FA2B464A4640460649009600F034FBB6
967:103C700008B92760002003B0BDE8F08308200020C9
968:103C8000A5BCC95A7D3E000070B50D4C1D460028EC
969:103C900014BF064626460B4B306882B098420DD1C1
970:103CA00006F58E70002633460096144600F03EFB63
971:103CB000002818BF34462C6002B070BD0248FBE7F4
972:103CC00008200020A5BCC95AE88FFFFF38B131B1E8
973:103CD000002201440346013081421A70FAD1704734
974:103CE00038B131B1002201440346013088421A70D4
975:103CF000FAD170472DE9F043202B1D460646884631
976:103D000091468BB026D8DBB202AF8DF80480B04666
977:103D100058F8041B8DF8053021B9404601F038F9F8
978:103D2000044640B9012302224046336001A901F054
979:103D300043F9044638B138462021FFF7D1FF204629
980:103D40000BB0BDE8F0832A464946404601F034F9FD
981:103D50000446F0E702AF1946104600233A4601F048
982:103D6000B1FA04460028E6D12023B9461D46CCE727
983:103D70002DE9F041D0F8F830A6B0002BD8BF02AE44
984:103D800031DD05460027D0F80C4102AEA4F1010850
985:103D90009022D5F8FC403146D0F8000101AB0197E4
986:103DA000B8FA88F8A0474FEA5818044620B9019B92
987:103DB00053B9B8F1000F16D030469021FFF790FFAD
988:103DC000204626B0BDE8F081014632462846FFF77E
989:103DD00091FF58B9D5F80431019A1344C5F804315C
990:103DE000B8F1000FE8D16FF03C04E5E70446204647
991:103DF00026B0BDE8F08100BF70B50025044614224E
992:103E000004F588762946C0F8F850FC3001F0B3FE7E
993:103E100008222946304601F0AEFE144B30461B689E
994:103E20009847204640F8045B01F098F8104B304664
995:103E30001B689847C8B9D4F8F830AB420FDC03EBE5
996:103E4000830204EB82022021C2F800010120C2E9B2
997:103E5000421008490133C2F8FC10C4F8F830064B90
998:103E60003046BDE870401B68184770BDF010002058
999:103E7000EC100020614E0000E81000202DE9F04712
1000:103E8000202A88B07AD83F4B00F5887904461B6811
1001:103E900048461746884698470546F8B940F2011645
1002:103EA000D4F8F830002B65D02046FFF761FF0546B7
1003:103EB00038B9D4F8F830002B14DC013EF2D16FF0A1
1004:103EC0003B056E4620213046FFF70AFF2E4B484641
1005:103ED0001B689847002818BF6FF01D05284608B0DA
1006:103EE000BDE8F087D4E94132934203D3D4F80C21E2
1007:103EF000012A02D0013ED7D1E1E71F2BFAD96E4645
1008:103F000001462022304604F1040A01F034FE314615
1009:103F1000504601F07BF805460028D3D1504601F009
1010:103F200031F8504601F01AF82946504601F030F8B1
1011:103F300005460028C6D150462022314601F03CF803
1012:103F400005460028BED1034632462021304601F006
1013:103F5000B9F905460028B5D1D4F8F8303A46002B17
1014:103F6000C8BF002340463146C8BFC4F8043101F041
1015:103F7000DDFDA7E76FF03F056E46A3E76FF03B0559
1016:103F8000ACE700BFEC100020E810002070B590B046
1017:103F900000287AD03E4C0D46402236210646204667
1018:103FA00001F0E9FD40225C21A01801F0E4FD2B1D89
1019:103FB000A34203D904F144039D4252D32B682268E3
1020:103FC000534023602B68226C534023646B68626803
1021:103FD000534063606B68626C53406364AB68A26873
1022:103FE0005340A360AB68A26C5340A364EB68E268E3
1023:103FF0005340E360EB68E26C5340E3642B69226951
1024:1040000053402361226D2B695340236562696B69BC
1025:10401000534063616B69626D53406365AB69A2692C
1026:104020005340A361AB69A26D5340A365EB69E2699C
1027:104030005340E361EB69E26D5340E3650021304694
1028:1040400000F0A6FF044628B940223046104900F08F
1029:10405000B3FF044640216846FFF742FE204610B0F9
1030:1040600070BD631E04F13F01013D1F3415F8010FBF
1031:1040700013F8012F42401A7011F8012F2878A3423B
1032:1040800082EA00020A70F1D1D8E76FF07304E5E725
1033:104090005822002010B54FF49A720021044601F016
1034:1040A0006AFD42F21072044BC4F8202104F59670A8
1035:1040B0001B68BDE810401847F01000202DE9F04FB4
1036:1040C00004468846914695B0002900F0A780002A52
1037:1040D0000CBF0126022600238DF80C30002C00F0C6
1038:1040E0009F80DFF844A104AF0AF1400B0021204675
1039:1040F00000F04EFF034648B1384620210193FFF7F8
1040:10410000EFFD019B184615B0BDE8F08F40225146E7
1041:10411000204600F051FF03460028EDD104F1F405DC
1042:1041200020222946204600F047FF03460028E3D11D
1043:104130000122204603A900F03FFF03460028DBD1FF
1044:10414000022E62D020460CA900F060FF0346002832
1045:10415000D2D10146204600F01BFF03460028CBD1F8
1046:1041600040225946204600F027FF03460028C3D1CD
1047:10417000202220460CA900F01FFF03460028BBD1D7
1048:104180003946204600F042FF03460028B4D13946A4
1049:104190002046FFF7FBFE03460028ADD1202229462A
1050:1041A000204600F009FF03460028A5D120460CA9AF
1051:1041B00000F02CFF034600289ED10146204600F067
1052:1041C000E7FE0346002897D140225946204600F0DA
1053:1041D000F3FE034600288FD1202220460CA900F0D0
1054:1041E000EBFE0346002887D12946204600F00EFF4B
1055:1041F0000346002880D19DF80C200132D2B2B24291
1056:104200008DF80C20FFF472AF76E74A46414620460F
1057:1042100000F0D2FE0346002894D06DE701265AE74D
1058:104220006FF0730304AF67E7582200202DE9F041D7
1059:104230000446884615461F46D0F81801E0B013B171
1060:1042400000EB40004008B5F5807F3ED82844B0F52B
1061:10425000C07F3AD84FF4C0720021684601F08BFC51
1062:104260006946D4F82431D4F81821D4F828019847A5
1063:1042700070BBD4F8186157B1D4E9493072080DEB1E
1064:104280000601984720BBD4F8183106EB5306B8F165
1065:10429000000F00D08DB9324669462046FFF70EFF69
1066:1042A000054610B90123C4F8143131466846FFF7BA
1067:1042B00017FD284660B0BDE8F0810DEB06004146D1
1068:1042C0002A462E4401F032FCE5E76FF00405F0E7E2
1069:1042D0006FF00805EDE700BF2DE9F047044604F153
1070:1042E000F4050F4691461E46DDF8208000F036FEAC
1071:1042F00029462046FFF74AFE08B1BDE8F087284668
1072:104300002022012101F037FCD4F81831C4F82471BF
1073:10431000C4F8289113B92023C4F818314246314615
1074:104320002046BDE8F0470123FFF780BFB2F5806F5C
1075:1043300000F295802DE9F04F89B09A46129BB3F5B3
1076:10434000807F00F29080D0F82431164604460F4654
1077:104350004BB3D0F81C31012B05D0D0F81421D0F884
1078:1043600020319A421FDD514600232046129AFFF762
1079:104370005DFF014698B900231293002E5ED0DFF84E
1080:10438000EC9009F1400B0021204600F001FE202EA8
1081:104390003546014628BF202504F1F40890B10846AF
1082:1043A00009B0BDE8F08FBAF1000FE6D0129B002BE8
1083:1043B000E1D051461A462046FFF780FE014600280C
1084:1043C000DBD0ECE749464022204600F0F5FD0146EF
1085:1043D0000028E4D141462022204600F0EDFD0146B0
1086:1043E0000028DCD16946204600F010FE0146002876
1087:1043F000D5D1204600F0CCFD01460028CFD159464A
1088:104400004022204600F0D8FD01460028C7D1694669
1089:104410002022204600F0D0FD01460028BFD14146B1
1090:10442000204600F0F3FD01460028B8D138462A4660
1091:10443000414601F07BFB761B2F44A4D15146204618
1092:10444000129AFFF73BFE01460028A8D10846D4F88F
1093:1044500014310133C4F8143109B0BDE8F08F6FF0A6
1094:104460000201084670476FF0040198E758220020C7
1095:10447000002130B58DB0282202A8019101F07BFB0C
1096:1044800002A800F047FF044610B120460DB030BD31
1097:10449000174D4FF0FF31286800F042F9044620B173
1098:1044A000144800F0D3F9012C18D0002000F068F96E
1099:1044B000D0B9114A02A901A800F0C4FC04460120A9
1100:1044C00000F05EF960B9286800F032F90028DCD00D
1101:1044D0000A4800F0BBF920460DB030BD0524F2E7D4
1102:1044E000074800F0B3F9EEE7064800F0AFF9E0E75F
1103:1044F000D4100020705D0000D8220020C85D0000AC
1104:10450000A85D0000885D000030B583B000F05CF865
1105:1045100028B100F0ABF80324204603B030BD00F012
1106:1045200077F8D8B900F02CF9E0B9224CD4F8283942
1107:104530001B0EF02B0AD1D4F8242A1F4B9A4231D0FB
1108:1045400000F044F8072400F091F8E5E7062400F0B5
1109:104550003DF800F08BF8204603B030BD042420461F
1110:1045600003B030BD00F032F800F080F8FFF780FFB4
1111:10457000044698B9114D2B68002BCDD10246014657
1112:10458000FFF752FB50B968220D4901ABFFF77CFBE6
1113:1045900020B920460B4B2B6003B030BD05242046CC
1114:1045A00003B030BD012000F0EBF80028DAD1C4F8E8
1115:1045B0000C0ADBE7001084500000E020F824002003
1116:1045C000FC2400205AEA5A5A002070470020704705
1117:1045D000430504D54FF0FF32034BC3F80821024BCB
1118:1045E000C3F8080A704700BF00108450014BC3F89D
1119:1045F000040A70470010845008B100F06BB84FF403
1120:104600007500704708B100F04FB84FF4750070475F
1121:1046100010B5114800F070F800B110BD0F4800F05F
1122:104620006BF80028F9D10E4C204600F065F8002800
1123:10463000F3D10C4B0C481C6000F05EF801460028DA
1124:10464000EBD100F02DF8044608B1204610BD00F073
1125:1046500079F82046FAE700BFE4100020E0100020BF
1126:10466000DC100020D4100020D810002008B5084825
1127:1046700000F04CF8074800F049F8074800F046F809
1128:10468000064800F043F8BDE8084000F00BB800BF52
1129:10469000E4100020E0100020DC100020D8100020E2
1130:1046A00000207047704700BF024610B4084CD4F891
1131:1046B000003A1342FBD021B1D4F804310B60C4F8A6
1132:1046C0000831034B0020C3F8082A5DF8044B7047FB
1133:1046D00000108450044AD2F8003A1842FBD0C2F8C5
1134:1046E000080A0020704700BF0010845001F0E8B9AC
1135:1046F0000A46002101F03FBA08B5034B02681B6867
1136:1047000010689847002008BD1011002008B5034B21
1137:1047100002685B6810689847002008BD10110020EF
1138:10472000024B02689B681068184700BF10110020F8
1139:1047300008B5034B0268DB6810689847002008BD85
1140:104740001011002070B5094C094D2069AB689847DD
1141:1047500018B1084B08485B6898470021074AEB6886
1142:1047600011602069BDE87040184700BFFC100020B0
1143:1047700010110020F4100020E05D000064250020EE
1144:10478000F8B51A4D1A4E0446B26828699047E8B940
1145:10479000184F3B684CB1A3B1012B19D0013B3B60D2
1146:1047A0002869F36898470020F8BD43B90121124AEF
1147:1047B000C2F800151149D1F81029002AFBD10133A4
1148:1047C0003B60F368286998470020F8BD0C48F8BDA5
1149:1047D0000A4AD2F81039002BFBD1074A6FF07E400D
1150:1047E000C2F80035FFF702FF3B68D7E7FC10002056
1151:1047F0001011002064250020000084500010845017
1152:10480000E98FFFFF014B1B68184700BF1011002004
1153:10481000014B9B68184700BF10110020014BDB685B
1154:10482000184700BF10110020BFF34F8F0549064BFA
1155:10483000CA6802F4E0621343CB60BFF34F8F00BF3E
1156:10484000FDE700BF00ED00E00400FA0530B44FF0D2
1157:10485000FE320025074B084C08494968C3F800247C
1158:10486000C3F80424C3F80824C3F80C24C4F8005582
1159:1048700030BC08470010845000008450F410002021
1160:1048800010B5044650B1636813F0685F05D0064A5E
1161:10489000934202D000236260236010BD034B0448A2
1162:1048A0005B689847EFE700BF2C5F5CA9F41000201D
1163:1048B000005E0000C8B143680D4A934213D013F064
1164:1048C000685F0ED0012350E8002F194640E8001C15
1165:1048D0009CF0000FF7D1012AF5D0BFF35F8F0020C5
1166:1048E000704704487047044870476FF4E0407047D1
1167:1048F0002C5F5CA9E98FFFFFEA8FFFFF034680B1C1
1168:10490000426809498A420AD012F0685F05D0BFF3B5
1169:104910005F8F002210461A607047044870470448B1
1170:1049200070476FF4E04070472C5F5CA9E98FFFFF90
1171:10493000EA8FFFFF10B5044620B10023034A23602D
1172:10494000626010BD0248FFF781FFF6E73A00003AC7
1173:10495000285E00002DE9F047002878D00C46002999
1174:1049600075D01D46002B72D007461AB101220023D4
1175:104970002A6003602B68002B64D02946204600F093
1176:10498000B7FD804600285FD12146286800F096FDDB
1177:104990008046002858D12B68082B6CD0042B6DD092
1178:1049A000A3F10209B9FA89F94FEA59190121354EE3
1179:1049B000C6F8C411C6F84011C6F8C411636AC6F837
1180:1049C0003031D6F830219342F6D14FF0000A4FF043
1181:1049D000FF30C6F82CA1FFF7FBFD6FF01B0350461C
1182:1049E000C6F80031FFF702FEC6F80C91D6F8040AAB
1183:1049F00040F48060FFF7FAFD0A23C6F83831089BBF
1184:104A0000012B29D02369204AA2FB03231B09626AD8
1185:104A1000404602FB03F303EB43031A4ADB039B0903
1186:104A2000C2F8D8310123C2F82C313B682A6823F040
1187:104A30007F4343EA02633B602A6843EA02233B6008
1188:104A4000BDE8F087DFF844804046BDE8F087DFF836
1189:104A500040804046BDE8F0874FF47F03D3F80C2C2C
1190:104A6000013206D0D3F80C3C074AA2FB03231B09F2
1191:104A7000CDE71623CBE74FF0030997E74FF0020984
1192:104A800094E700BF00108450ABAAAAAA310CF10031
1193:104A9000350CF10058B34B1EB3F5047F27D230B567
1194:104AA0004FF0000ECD00744671464B0901F01F0C0B
1195:104AB00050F82330BCF11F0F23FA0CF306D003F09B
1196:104AC000010319B901211C468E46EEE79C4201F113
1197:104AD000010106D01C464FF0010EA942E5D100208D
1198:104AE00030BD0EF1010E9645F7D1024830BD0148A8
1199:104AF000704700BF360CF100C0B32DE9F0434C1EE7
1200:104B0000B4F5047F1DD2E3B1DAB100252E46A846E4
1201:104B10002C46CF0003F1FF394FEA541C04F01F0E5E
1202:104B200050F82C10BEF11F0F21FA0EFC0CD00CF027
1203:104B3000010C4CB90126E04634463546ECE7964276
1204:104B400016D90C48BDE8F083AB420BD0C44508BF72
1205:104B50000136A945F3D001350134BC42DCD1002037
1206:104B6000BDE8F0830125E0462E46F5E70148704791
1207:104B70001D46F1E7370CF1002DE9F04F91B0834667
1208:104B8000DDE91B460D46002E6ED10F691C60002327
1209:104B90001A990B60002A00F02F819D4B6A6AD3F8A6
1210:104BA0003811D3F830319A4269D10A2967D19BF87C
1211:104BB0000330089304F10803079304230593954BEE
1212:104BC000934CA3FB07239B0803EB4303A7EB43038F
1213:104BD000039306971A9B069E1E60002E00F0EA8043
1214:104BE00000F096FC00230993BBF1000F00F0D58084
1215:104BF00098464FF0010ADDF81C90002D00F0CD80A2
1216:104C0000089B002B3DD0284608A900F071FC002825
1217:104C100039D0814B984220D0089B082B00F0E480CB
1218:104C200000225B000893294608AB58460092FFF724
1219:104C300091FE7A4B984200F0D38070B9DBF80020E7
1220:104C4000130A03F47F03134323F07F43CBF80030B0
1221:104C5000059B013B0593BDD10020039000F058FC5B
1222:104C6000039811B0BDE8F08F4FF47F01D1F80C0C20
1223:104C700001300CBF4FF40477D1F80C7C86E768480C
1224:104C8000EBE76648C5E72946089800F017FC0028BE
1225:104C9000BFD1089B082B00F0A980042B00F0A9804D
1226:104CA000A3F10203B3FA83F35B090493C4F8C4A12C
1227:104CB000C4F840A1C4F8C4A16B6AC4F83031D4F878
1228:104CC00030219342F6D100234FF0FF30C4F82C314D
1229:104CD000FFF77EFC002318466FF01B03C4F8003179
1230:104CE000FFF784FC049B4B4FC4F80C31D4F8040A42
1231:104CF00040F48060FFF77AFC0A23C4F838312B694E
1232:104D000009A8A7FB03236A6A1B0902FB03F303EB51
1233:104D10004303DB039B09C4F8D831C4F82CA1DBF8AA
1234:104D20000030089923F07F420B0243EA01631343EA
1235:104D3000CBF8003000F0B2FB099B03F01A030343E9
1236:104D40007FF46AAFA7FB0637D4F81431B8EB970F9E
1237:104D50000A93D4F818310B93D4F81C310C93D4F87F
1238:104D600020310D93D4F824310E93D4F828310F93C9
1239:104D700001D1039B9BB9484618220AA9183EFFF7A8
1240:104D8000B5FC09F1180908F101089EB100F0C0FB5B
1241:104D900000230993002D7FF433AF224839E74846BA
1242:104DA0001A46F61A0AA9994408F10108FFF79EFC71
1243:104DB000002EEBD1069F079E6A6939463046FFF701
1244:104DC00069FEAA6940B94FF4806339463046FFF75F
1245:104DD00093FE00283FF440AF00231A9A136018E7AF
1246:104DE0002B6A002B3FF439AF0F4836E703230493B7
1247:104DF0005CE70223049359E70122294658460096AE
1248:104E000008ABFFF7A7FD00283FF4D4AE25E700BFAD
1249:104E100000108450ABAAAAAA020CF100310CF100D8
1250:104E2000300CF100350CF100320CF10030B4DDE94A
1251:104E3000023402940024049DCDE9035430BCFFF7F2
1252:104E40009BBE00BF30B51546012487B005AB00936B
1253:104E50000022CDE9015404ABFFF78EFE07B030BD50
1254:104E6000F0B587B0002966D01E46002B63D01446EB
1255:104E7000002A60D0314F0D4638684FF0FF31FFF700
1256:104E80004FFC00284DD10020FFF77AFC002844D1C8
1257:104E90002B4800F03FFAD8B101204FF0FF35FFF763
1258:104EA0006FFC002835D14FF408712648FEF70EFF3D
1259:104EB00004212548FEF70AFF21482821FEF706FFB6
1260:104EC0003868FFF735FC00282FD1284607B0F0BD21
1261:104ED0001C4A0346029205AA019204AA039000927A
1262:104EE000174902461848FFF7A1FF03460028D3D10F
1263:104EF00028461D46059B22469C4228BF1A46049917
1264:104F000032600831FFF7F2FB0120FFF739FC00287F
1265:104F1000C9D00E48FFF79AFCC5E70D48FFF796FC8D
1266:104F2000B6E70C48FFF792FCADE70B48FFF78EFCA5
1267:104F3000284607B0F0BD4FF0FF35C6E7D41000207B
1268:104F40007C250020A425002078250020A85D0000F5
1269:104F5000885D0000705D00004C5E000010B50446E6
1270:104F600028B12046BDE81040F421FFF7C1BB04483A
1271:104F7000FFF76CFC2046BDE81040F421FFF7B8BBFA
1272:104F8000645E000010B1F421FEF7A0BE704700BFC0
1273:104F900008B521B1012908D06FF0360008BD012104
1274:104FA00000F058F80028F7D108BD022100F052F8AF
1275:104FB0000028F9D0F0E700BF30B505468818B0F5F5
1276:104FC000801F0B461446A1B001D8802A0CD9B3F536
1277:104FD000801F17D922461946284600F07DF804465E
1278:104FE00084B9204621B030BD6846FFF77FFB2246DA
1279:104FF0006946284600F070F8802104466846FFF7AD
1280:1050000077FBEDE76FF03604EBE700BF70B5E8B172
1281:105010000E46D9B1044600F031F80546B0B9236810
1282:10502000012B0BD0022B01D0284670BD1C2230462C
1283:1050300004F10801FFF75AFB284670BD20223046D4
1284:1050400004F10801FFF752FB284670BD6FF03605EA
1285:10505000EAE700BF78B138B50D46F0210446FFF706
1286:1050600047FB402320462560E36500F091FA0038B5
1287:1050700018BF012038BD0120704700BFF0B5056E94
1288:10508000A5B0044604AEE5B90023012701933046DC
1289:105090006760294602AA009300F046FA10B1012089
1290:1050A00025B0F0BD2A46204602A900F099FA002852
1291:1050B000F5D1204600F0AAFB0028F0D1206625B0EB
1292:1050C000F0BD802D2A46304628BF802204F16401BD
1293:1050D000FFF70CFB256ED7E7002800F0AE802DE926
1294:1050E000F04F1446A5B0002A3DD00F46002949D004
1295:1050F000B2F5803F0546006E20D34FF6FF7805F1EC
1296:10510000640AEB6D1A1AB2FBF3F103FB1122002AB9
1297:1051100065D18342B9464FF6FF7672D0B6FBF3FBFA
1298:1051200003FB0BFBBBF1000F30D1002E45D1A4F5E2
1299:105130007F44FF3CB4F5803F4744E2D2EA6D161A43
1300:10514000B6FBF2F302FB1366A64228BF2646002EEA
1301:1051500075D1824200F08D80B4FBF2F602FB06F6B8
1302:105160002EB9002C79D1002025B0BDE8F08F0023A6
1303:1051700031463846CDE9003302AA00F0D5F90028BF
1304:1051800000F09580012025B0BDE8F08F002359463E
1305:105190004846CDE9003302AA00F0C6F90028F1D153
1306:1051A0005A46284602A900F01BFA0028EAD1A6EBCD
1307:1051B0000B06286ED944002EB9D019304946324624
1308:1051C00005EB8000FFF792FAA4F57F44286EFF3CC0
1309:1051D0003044B4F5803F4744286692D2AEE742455A
1310:1051E00028BF4246164639465044FFF77FFA286EDC
1311:1051F000EB6D3044834207EB06092866A8EB0606F0
1312:105200008CD1802B28BF802351461A4604A8FFF773
1313:105210006DFA0023E96D02AACDE9003304A800F07D
1314:1052200083F90028AED12846EA6D02A900F0D8F92A
1315:105230000028A7D1EB6D286670E70120704705F1C3
1316:105240006403394632461844FFF750FA286EEA6D77
1317:105250003044A41B374428667BE72B6E2246193363
1318:1052600005EB83003946FFF741FA2B6E23442B668A
1319:1052700079E7802A28BF802205F1640104A8FFF79E
1320:1052800035FA0023E96D04A8CDE9003302AA00F045
1321:105290004BF900287FF476AF2846EA6D02A900F0AA
1322:1052A0009FF900287FF46EAFEA6D286654E7324616
1323:1052B000284602A900F094F900287FF463AF374430
1324:1052C000A41B4EE7F8B51C460546114816460F4686
1325:1052D000FFF744FE21460E48FFF75AFE044620B170
1326:1052E0000B48FFF74FFE2046F8BD3A4629460848CE
1327:1052F000FFF762FE04460028F2D131460448FFF76A
1328:1053000085FE04460248FFF73DFE2046F8BD00BF7B
1329:10531000C42700201C2370B582B001A90546019363
1330:1053200000F032F8044638B9019B1C2B07D0144C0E
1331:105330001C212846FFF7DCF9204602B070BDD5E9F4
1332:105340000112131E18BF0123003918BF01210126C5
1333:1053500028689B00EA6843EA4103002818BF43F02D
1334:105360000103EE612AB9C5E90834002BE4D1054CEC
1335:10537000DEE7204643F00803C5E9083402B070BDFB
1336:10538000370CF0000E0CF0000346002866D0002910
1337:1053900064D00A681C2A61D14FF47F023B49D2F8DD
1338:1053A000100C88425CD0D2F8101C013158D0D2F8D1
1339:1053B000101C4FF47F021960D2F8140C3449884253
1340:1053C00060D0D2F8141C01315CD0D2F8141C4FF418
1341:1053D0007F025960D2F8181C11F5947F4FD0D2F893
1342:1053E000181C01314BD0D2F8181C4FF47F02996081
1343:1053F000D2F81C0C274988423ED0D2F81C1C01313F
1344:105400003AD0D2F81C1C4FF47F02D960D2F8001CAD
1345:1054100070312FD0D2F8001C01312BD0D2F8001CF3
1346:105420004FF47F021961D2F8041CAF3120D0D2F8BA
1347:10543000041C01311CD0D2F8041C4FF47F025961C6
1348:10544000D2F8080C144988420DD0D2F8081C01315A
1349:1054500009D0D2F8082C00209A61704701207047CB
1350:1054600040F6FC01A5E740F2373200209A61704710
1351:105470005121E2E79021D3E742F60411C3E740F659
1352:10548000D861B2E742F2D001A1E700BFFCF8FFFF0C
1353:10549000D020FFFF0429FFFF37F3FFFF014608B5C7
1354:1054A0004FF48060FFF7AEF80022034BC3F8C82129
1355:1054B000C3F82C2108BD00BF001084500138072814
1356:1054C00005D8DFE800F0100E040A040404060748BB
1357:1054D0007047CB6800204B6270478B6800204B629E
1358:1054E00070474B68F6E70B68F4E700BF310CF1003A
1359:1054F0000B6802E0082B0B6006D8026A13424FEAE1
1360:105500004303F7D00020704700487047310CF1008A
1361:105510000022044B4FF48060C3F82C21C3F8C4214F
1362:10552000FFF756B800108450F0B5002483B0B0F1F6
1363:10553000005F8DF8074025D38C468444BCF1804F32
1364:1055400004461FD817461D4601220DF1070300F03F
1365:1055500097F90646B0B99DF80730099A3C603B714F
1366:1055600092B14DB10246089928460DF1070300F0AB
1367:1055700087F938B99DF807303046099A15601371DC
1368:1055800003B0F0BD4FF47506304603B0F0BD00BF68
1369:10559000D8B108B50368012B04D0022B0FD043B15A
1370:1055A0000B4808BD20220B490830FFF79FF8002068
1371:1055B00008BD142208490830FFF798F8F7E72022C1
1372:1055C00006490830FFF792F8F1E74FF4730070478F
1373:1055D0000100F300745E0000B45E0000945E000001
1374:1055E0002DE9F843002900F0F9800446002800F076
1375:1055F000F98003680F469046002B00F0C380013B02
1376:10560000012B00F2D7804FF0FF3178484FF00209AC
1377:10561000FFF786F8002840F0BF800020FFF7B0F8C1
1378:105620000646002840F0C280714AD2F81C39002B8F
1379:10563000FBD16F4DD5F8203C002BFBD14FF0FF3054
1380:10564000FEF7C6FFD5F8040A20F04000FEF7CEFFB3
1381:1056500001230722C5F81838C5F80029C5F8C43752
1382:10566000A36CC5F8CC37E36CC5F8D037C5F8C09744
1383:1056700023685BB1013B012B18D8636AC5F85C361F
1384:10568000236AC5F85836E369C5F85436A269584B01
1385:10569000C3F850266269C3F84C262269C3F848262D
1386:1056A000E268C3F84426A268C3F84026504AD2F8FC
1387:1056B0001039002BFBD1B8F1000F5FD06368402098
1388:1056C000012B08BFC2F884363A68494BC3F8282C2E
1389:1056D000C3F82C8CFEF790FF0646454AD2F81039E5
1390:1056E000002BFBD1424AD2F8203C002BFBD123688F
1391:1056F0005BB1013B012B18D8D2F85C366362D2F85B
1392:1057000058362362D2F85436E361394BD3F8502629
1393:10571000A261D3F84C266261D3F848262261D3F8FF
1394:105720004426E260D3F84036A36000230121304ACA
1395:10573000D2F8CC07A064D2F8D007E064C2F8C4174E
1396:10574000C2F88436C2F8C837D2F81039002BFBD122
1397:10575000C2F81838002E3BD1254BD3F8040A40F08C
1398:105760004000FEF743FF0120FFF70AF860BB1F4827
1399:10577000FEF7DEFF10BB3046BDE8F8830423C2F815
1400:10578000C837AAE74FF0FF3118484FF00109FEF77C
1401:10579000C7FF00283FF441AF1648FFF757F8002035
1402:1057A000FEF7EEFF064600283FF43EAF1248FFF733
1403:1057B0004DF839E7114E3046BDE8F8831048FFF741
1404:1057C00045F83046BDE8F8830E48FFF73FF8CEE7CE
1405:1057D000102104F10800FEF78BFFBDE70A4E3046AA
1406:1057E000BDE8F8834FF47306C5E700BFE41000205E
1407:1057F00000108450705D0000885D00000100F3001F
1408:10580000C85D0000A85D00000300F300A0B30346DC
1409:1058100070B4D0E90240D3E9041226BA05BA0CBA32
1410:1058200010BAC3E90440D3E90612986A09BAC3E979
1411:10583000026512BA996100BAD3E9084125BA0CBAD7
1412:10584000C3E90725D3E90B12C3E9094009BAD86BAC
1413:1058500012BAD962D3E90D4125BAC3E90C250CBAB5
1414:1058600000BAD3E9101209BA12BAC3E90E4019649A
1415:1058700000205A6470BC70474FF47300704700BF3B
1416:1058800000201870704700BF431810B501D21F2ABE
1417:1058900001D9002010BD013902F014030144102B7E
1418:1058A00080EA01043CD009DC8BB1042BF1D11F2C20
1419:1058B00040E840F315D941E840F10EE0142BE8D15F
1420:1058C0001F2C40E8C0F30CD941E8C0F105E01F2CC3
1421:1058D00040E800F305D941E800F11C460B468C4234
1422:1058E000D7D122F01402013A0A2AD2D801A151F8E4
1423:1058F00022F000BF435900003D5900002F5900001D
1424:1059000093580000935800009358000093580000EB
1425:105910004959000043590000375900002F59000031
1426:105920001F2C40E880F3DCD941E880F1D5E713F47F
1427:10593000001FAFD1ADE713F4801FFAE75B02A9D5D2
1428:10594000A7E713F4002FF4E713F4802FF1E700BF6B
1429:1059500008B5074B044613B10021AFF30080054B97
1430:105960001868836A03B19847204600F029F800BF01
1431:1059700000000000C85E000070B50D4D00260D4C03
1432:10598000641BA410A64209D10B4D00260B4C00F05D
1433:10599000D5F9641BA410A64205D170BD55F8043B8F
1434:1059A00001369847EEE755F8043B01369847F2E791
1435:1059B000A0110020A0110020A0110020A41100209F
1436:1059C000FEE700BFB7EE000AF7EE000AB7EE001AD6
1437:1059D000F7EE001AB7EE002AF7EE002AB7EE003A0B
1438:1059E000F7EE003AB7EE004AF7EE004AB7EE005A7B
1439:1059F000F7EE005AB7EE006AF7EE006AB7EE007AEB
1440:105A0000F7EE007AF1EE10CA40F29F01CFF20001EA
1441:105A10003CEA010CE1EE10CA002383F300887047D2
1442:105A2000FDF79CBAEFF30880EFF309812DE9F00F41
1443:105A30006B467246FAF7ACFF08B0FFF7F1FFFEE7DE
1444:105A4000FDF78CBAEFF30880EFF309812DE9F00F31
1445:105A50006B467246FAF79CFF08B0FFF7F1FFFEE7CE
1446:105A6000FDF77CBAEFF30880EFF309812DE9F00F21
1447:105A70006B467246FAF78CFF08B0FFF7F1FFFEE7BE
1448:105A8000FDF76CBAEFF30880EFF309812DE9F00F11
1449:105A90006B467246FAF77CFF08B0FFF7F1FFFEE7AE
1450:105AA000FDF75CBAEFF30880EFF309812DE9F00F01
1451:105AB0006B467246FAF76CFF08B0FFF7F1FFFEE79E
1452:105AC000814270B40546144602D370BC00F02EB873
1453:105AD000821821443CB141EA020313F003030FD1C1
1454:105AE000E018032812D86FF00300A30843430020F6
1455:105AF00019441A442344984210D1284670BC704778
1456:105B000011F8013D013C02F8013DE3E7581850F857
1457:105B1000046C981840F8046C043BE1E70C1A14F884
1458:105B2000016C141A04F8016C0130E4E770B5044606
1459:105B30003AB141EA040313F003030CD1D518032D45
1460:105B40000FD822F003031C441944002302F003027F
1461:105B500093420CD170BD11F8013B013A04F8013BAE
1462:105B6000E6E7CD1A2E68E51A2E60043BE6E75D5C99
1463:105B7000E5540133ECE7F0B5044662B922F00303C3
1464:105B8000234402F003021A44934214D1F0BD04F8F6
1465:105B9000011B013AF1E7A307F9D115460B0443EACB
1466:105BA00001630B4343EA01231619032DE6D9771B42
1467:105BB0003B60043DF9E703F8011BE5E708B5EFF3A7
1468:105BC0000583C3F308030BB1FDF7C8F9BDE808402E
1469:105BD000FDF74CBA10B50446EFF30583C3F3080391
1470:105BE0000BB1FDF7BBF92046BDE81040FDF741BA07
1471:105BF0002DE9F04104460D4616461F46EFF3058396
1472:105C0000C3F308030BB1FDF7A9F93B463246294619
1473:105C10002046BDE8F041FCF743BC2DE9F0410446C5
1474:105C20000D4616461F46EFF30583C3F308030BB179
1475:105C3000FDF794F93B46324629462046BDE8F0413F
1476:105C4000FCF768BC08B5EFF30583C3F308030BB199
1477:105C5000FDF784F9BDE80840FDF7DBB90020704787
1478:105C6000704710B5044608B1FDF75AFF2046BDE85D
1479:105C70001040FDF745BF10B50446406A10B1A16A57
1480:105C8000FFF7EFFF0020C4E9090010BD38B5044656
1481:105C9000FFF7F1FF236A2C22012B0CBF05466FF0A2
1482:105CA000960500212046FFF766FF284638BD0020F4
1483:105CB000704770470020704713B5002001AB1446B1
1484:105CC000FDF7E2FF30B9019BA34218BF6FF09300CC
1485:105CD00002B010BD6FF09200FAE7002070472DE986
1486:105CE000E04F2746A046A146A246A346A4462DED76
1487:105CF000108B4FF0000545EC185B45EC195A45EC4C
1488:105D00001A5A45EC1B5A45EC1C5A45EC1D5A45ECF9
1489:105D10001E5A45EC1F5AF1EE105A4FF66076C0F647
1490:105D2000FF763540E1EE105A84F30088254626467A
1491:105D3000A447BDEC108BBDE8E08F0000F8B500BFB4
1492:105D4000F8BC08BC9E467047F8B500BFF8BC08BC5C
1493:105D50009E467047FF8FFFFFFF8FFFFFFE8FFFFF05
1494:105D6000FE8FFFFFFD8FFFFFFC8FFFFFFC8FFFFF0C
1495:105D70004661696C20746F2061637175697265207A
1496:105D80006D757465780A00004661696C20746F2037
1497:105D9000696E63726561736520504D20636F756E27
1498:105DA0007465720A000000004661696C20746F20FF
1499:105DB000646563726561736520504D20636F756E15
1500:105DC0007465720A000000004661696C20746F20DF
1501:105DD00072656C65617365206D757465780A000085
1502:105DE000436F756C64206E6F74206C6F636B2070F2
1503:105DF0006F7765722073617665206D7574657800C4
1504:105E00006D757465785F667265652063616C6C653D
1505:105E1000642077697468204E554C4C207061726123
1506:105E20006D6574657200000043616E277420696EB1
1507:105E3000697469616C697A65206D757465782C2068
1508:105E4000776173204E554C4C0D0A00004661696C19
1509:105E500020746F20756E6C6F636B206D7574657840
1510:105E60000A0000000A637478206973204E554C4C78
1511:105E70000A00000067E6096A85AE67BB72F36E3CF4
1512:105E80003AF54FA57F520E518C68059BABD9831F05
1513:105E900019CDE05BD89E05C107D57C3617DD703083
1514:105EA00039590EF7310BC0FF11155868A78FF964E7
1515:105EB000A44FFABE0123456789ABCDEFFEDCBA984B
1516:105EC00076543210F0E1D2C34011002054464D5FA9
1517:105ED00043525950544F0054464D5F504C41544624
1518:105EE0004F524D5F53455256494345000000000054
1519:105EF00000000000000000000000000000000000A2
1520:107C00007FE97FE9FBF72CBD7FE97FE9FBF737BD13
1521:107C10007FE97FE9FBF75FBD7FE97FE9FBF752BDB5
1522:107C20007FE97FE9FBF73ABD00000000000000009B
1523:107C30000000000000000000000000000000000044
1524:107C40007AFFFFFF00900050000000008C3400001D
1525:107C50000400000000000000000000000000000020
1526:107C6000000000000000000090ED00E000A00350C4
1527:107C70007FA60350009000506F9500501412002012
1528:107C8000A811002044010000615C00005D5C000060
1529:107C9000775B0000DC1000200C1100200411002094
1530:107CA00000110020FC1000201D48000011480000B9
1531:107CB000054800000000000029480000381100209D
1532:107CC00030110020281100200000000020110020A9
1533:107CD0003549000081480000B5480000FD4800001B
1534:107CE000682500203A00003A6C2500203A00003A4E
1535:107CF000702500203A00003A742500203A00003A2E
1536:107D00000000000000000000000000000000000073
1537:107D10000000000000000000000000000000000063
1538:107D20000000000000000000000000000000000053
1539:107D30000000000000000000000000000000000043
1540:107D40000000000000000000000000000000000033
1541:107D50000000000000000000000000000000000023
1542:087D6000553700002D3700002B
1543:00000001FF
diff --git a/examples/nrf9151/s/.cargo/config.toml b/examples/nrf9151/s/.cargo/config.toml
new file mode 100644
index 000000000..f64c63966
--- /dev/null
+++ b/examples/nrf9151/s/.cargo/config.toml
@@ -0,0 +1,8 @@
1[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2runner = "probe-rs run --chip nRF9160_xxAA"
3
4[build]
5target = "thumbv8m.main-none-eabihf"
6
7[env]
8DEFMT_LOG = "trace"
diff --git a/examples/nrf9151/s/Cargo.toml b/examples/nrf9151/s/Cargo.toml
new file mode 100644
index 000000000..7253fc4be
--- /dev/null
+++ b/examples/nrf9151/s/Cargo.toml
@@ -0,0 +1,20 @@
1[package]
2edition = "2021"
3name = "embassy-nrf9151-secure-examples"
4version = "0.1.0"
5license = "MIT OR Apache-2.0"
6
7[dependencies]
8embassy-executor = { version = "0.6.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
9embassy-time = { version = "0.3.2", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
10embassy-nrf = { version = "0.2.0", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] }
11
12defmt = "0.3"
13defmt-rtt = "0.4"
14
15cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
16cortex-m-rt = "0.7.0"
17panic-probe = { version = "0.3", features = ["print-defmt"] }
18
19[profile.release]
20debug = 2
diff --git a/examples/nrf9151/s/build.rs b/examples/nrf9151/s/build.rs
new file mode 100644
index 000000000..30691aa97
--- /dev/null
+++ b/examples/nrf9151/s/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
11use std::env;
12use std::fs::File;
13use std::io::Write;
14use std::path::PathBuf;
15
16fn 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/nrf9151/s/memory.x b/examples/nrf9151/s/memory.x
new file mode 100644
index 000000000..4c7d4ebf0
--- /dev/null
+++ b/examples/nrf9151/s/memory.x
@@ -0,0 +1,5 @@
1MEMORY
2{
3 FLASH : ORIGIN = 0x00000000, LENGTH = 1024K
4 RAM : ORIGIN = 0x20018000, LENGTH = 160K
5}
diff --git a/examples/nrf9151/s/src/bin/blinky.rs b/examples/nrf9151/s/src/bin/blinky.rs
new file mode 100644
index 000000000..7457a95a3
--- /dev/null
+++ b/examples/nrf9151/s/src/bin/blinky.rs
@@ -0,0 +1,22 @@
1#![no_std]
2#![no_main]
3
4use embassy_executor::Spawner;
5use embassy_nrf::gpio::{Level, Output, OutputDrive};
6use embassy_time::Timer;
7use {defmt_rtt as _, panic_probe as _};
8
9#[embassy_executor::main]
10async fn main(_spawner: Spawner) {
11 let p = embassy_nrf::init(Default::default());
12 let mut led = Output::new(p.P0_00, Level::Low, OutputDrive::Standard);
13
14 loop {
15 led.set_high();
16 defmt::info!("high");
17 Timer::after_millis(500).await;
18 led.set_low();
19 defmt::info!("low");
20 Timer::after_millis(1000).await;
21 }
22}
diff --git a/examples/nrf9160/.cargo/config.toml b/examples/nrf9160/.cargo/config.toml
index 1444b0cd1..f64c63966 100644
--- a/examples/nrf9160/.cargo/config.toml
+++ b/examples/nrf9160/.cargo/config.toml
@@ -1,5 +1,4 @@
1[target.'cfg(all(target_arch = "arm", target_os = "none"))'] 1[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2# replace nRF82840_xxAA with your chip as listed in `probe-rs chip list`
3runner = "probe-rs run --chip nRF9160_xxAA" 2runner = "probe-rs run --chip nRF9160_xxAA"
4 3
5[build] 4[build]
diff --git a/examples/nrf9160/Cargo.toml b/examples/nrf9160/Cargo.toml
index 2ff692b24..c30b54ebd 100644
--- a/examples/nrf9160/Cargo.toml
+++ b/examples/nrf9160/Cargo.toml
@@ -5,9 +5,9 @@ version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 8embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
9embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 9embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
10embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf9160-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 10embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = ["defmt", "nrf9160-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] }
11 11
12defmt = "0.3" 12defmt = "0.3"
13defmt-rtt = "0.4" 13defmt-rtt = "0.4"
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 9bd403f02..5ed51a5c0 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -6,12 +6,12 @@ license = "MIT OR Apache-2.0"
6 6
7 7
8[dependencies] 8[dependencies]
9embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal", features = ["defmt"] } 9embassy-embedded-hal = { version = "0.2.0", path = "../../embassy-embedded-hal", features = ["defmt"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-98304", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-98304", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
13embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl"] } 13embassy-rp = { version = "0.2.0", path = "../../embassy-rp", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl"] }
14embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
15embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "raw", "dhcpv4", "medium-ethernet", "dns"] } 15embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "raw", "dhcpv4", "medium-ethernet", "dns"] }
16embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", features = ["defmt"] } 16embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", features = ["defmt"] }
17embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 17embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
@@ -29,6 +29,9 @@ reqwless = { version = "0.12.0", features = ["defmt",]}
29serde = { version = "1.0.203", default-features = false, features = ["derive"] } 29serde = { version = "1.0.203", default-features = false, features = ["derive"] }
30serde-json-core = "0.5.1" 30serde-json-core = "0.5.1"
31 31
32# for assign resources example
33assign-resources = { git = "https://github.com/adamgreig/assign-resources", rev = "94ad10e2729afdf0fd5a77cd12e68409a982f58a" }
34
32#cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 35#cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
33cortex-m = { version = "0.7.6", features = ["inline-asm"] } 36cortex-m = { version = "0.7.6", features = ["inline-asm"] }
34cortex-m-rt = "0.7.0" 37cortex-m-rt = "0.7.0"
@@ -41,7 +44,7 @@ display-interface = "0.4.1"
41byte-slice-cast = { version = "1.2.0", default-features = false } 44byte-slice-cast = { version = "1.2.0", default-features = false }
42smart-leds = "0.3.0" 45smart-leds = "0.3.0"
43heapless = "0.8" 46heapless = "0.8"
44usbd-hid = "0.7.0" 47usbd-hid = "0.8.1"
45 48
46embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 49embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
47embedded-hal-async = "1.0" 50embedded-hal-async = "1.0"
diff --git a/examples/rp/src/bin/assign_resources.rs b/examples/rp/src/bin/assign_resources.rs
new file mode 100644
index 000000000..ff6eff4a2
--- /dev/null
+++ b/examples/rp/src/bin/assign_resources.rs
@@ -0,0 +1,79 @@
1//! This example demonstrates how to assign resources to multiple tasks by splitting up the peripherals.
2//! It is not about sharing the same resources between tasks, see sharing.rs for that or head to https://embassy.dev/book/#_sharing_peripherals_between_tasks)
3//! Of course splitting up resources and sharing resources can be combined, yet this example is only about splitting up resources.
4//!
5//! There are basically two ways we demonstrate here:
6//! 1) Assigning resources to a task by passing parts of the peripherals
7//! 2) Assigning resources to a task by passing a struct with the split up peripherals, using the assign-resources macro
8//!
9//! using four LEDs on Pins 10, 11, 20 and 21
10
11#![no_std]
12#![no_main]
13
14use assign_resources::assign_resources;
15use defmt::*;
16use embassy_executor::Spawner;
17use embassy_rp::gpio::{Level, Output};
18use embassy_rp::peripherals::{self, PIN_20, PIN_21};
19use embassy_time::Timer;
20use {defmt_rtt as _, panic_probe as _};
21
22#[embassy_executor::main]
23async fn main(spawner: Spawner) {
24 // initialize the peripherals
25 let p = embassy_rp::init(Default::default());
26
27 // 1) Assigning a resource to a task by passing parts of the peripherals.
28 spawner
29 .spawn(double_blinky_manually_assigned(spawner, p.PIN_20, p.PIN_21))
30 .unwrap();
31
32 // 2) Using the assign-resources macro to assign resources to a task.
33 // we perform the split, see further below for the definition of the resources struct
34 let r = split_resources!(p);
35 // and then we can use them
36 spawner.spawn(double_blinky_macro_assigned(spawner, r.leds)).unwrap();
37}
38
39// 1) Assigning a resource to a task by passing parts of the peripherals.
40#[embassy_executor::task]
41async fn double_blinky_manually_assigned(_spawner: Spawner, pin_20: PIN_20, pin_21: PIN_21) {
42 let mut led_20 = Output::new(pin_20, Level::Low);
43 let mut led_21 = Output::new(pin_21, Level::High);
44
45 loop {
46 info!("toggling leds");
47 led_20.toggle();
48 led_21.toggle();
49 Timer::after_secs(1).await;
50 }
51}
52
53// 2) Using the assign-resources macro to assign resources to a task.
54// first we define the resources we want to assign to the task using the assign_resources! macro
55// basically this will split up the peripherals struct into smaller structs, that we define here
56// naming is up to you, make sure your future self understands what you did here
57assign_resources! {
58 leds: Leds{
59 led_10: PIN_10,
60 led_11: PIN_11,
61 }
62 // add more resources to more structs if needed, for example defining one struct for each task
63}
64// this could be done in another file and imported here, but for the sake of simplicity we do it here
65// see https://github.com/adamgreig/assign-resources for more information
66
67// 2) Using the split resources in a task
68#[embassy_executor::task]
69async fn double_blinky_macro_assigned(_spawner: Spawner, r: Leds) {
70 let mut led_10 = Output::new(r.led_10, Level::Low);
71 let mut led_11 = Output::new(r.led_11, Level::High);
72
73 loop {
74 info!("toggling leds");
75 led_10.toggle();
76 led_11.toggle();
77 Timer::after_secs(1).await;
78 }
79}
diff --git a/examples/rp/src/bin/shared_bus.rs b/examples/rp/src/bin/shared_bus.rs
new file mode 100644
index 000000000..c6cb5d64c
--- /dev/null
+++ b/examples/rp/src/bin/shared_bus.rs
@@ -0,0 +1,115 @@
1//! This example shows how to share (async) I2C and SPI buses between multiple devices.
2
3#![no_std]
4#![no_main]
5
6use defmt::*;
7use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice;
8use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
9use embassy_executor::Spawner;
10use embassy_rp::bind_interrupts;
11use embassy_rp::gpio::{AnyPin, Level, Output};
12use embassy_rp::i2c::{self, I2c, InterruptHandler};
13use embassy_rp::peripherals::{I2C1, SPI1};
14use embassy_rp::spi::{self, Spi};
15use embassy_sync::blocking_mutex::raw::NoopRawMutex;
16use embassy_sync::mutex::Mutex;
17use embassy_time::Timer;
18use static_cell::StaticCell;
19use {defmt_rtt as _, panic_probe as _};
20
21type Spi1Bus = Mutex<NoopRawMutex, Spi<'static, SPI1, spi::Async>>;
22type I2c1Bus = Mutex<NoopRawMutex, I2c<'static, I2C1, i2c::Async>>;
23
24bind_interrupts!(struct Irqs {
25 I2C1_IRQ => InterruptHandler<I2C1>;
26});
27
28#[embassy_executor::main]
29async fn main(spawner: Spawner) {
30 let p = embassy_rp::init(Default::default());
31 info!("Here we go!");
32
33 // Shared I2C bus
34 let i2c = I2c::new_async(p.I2C1, p.PIN_15, p.PIN_14, Irqs, i2c::Config::default());
35 static I2C_BUS: StaticCell<I2c1Bus> = StaticCell::new();
36 let i2c_bus = I2C_BUS.init(Mutex::new(i2c));
37
38 spawner.must_spawn(i2c_task_a(i2c_bus));
39 spawner.must_spawn(i2c_task_b(i2c_bus));
40
41 // Shared SPI bus
42 let spi_cfg = spi::Config::default();
43 let spi = Spi::new(p.SPI1, p.PIN_10, p.PIN_11, p.PIN_12, p.DMA_CH0, p.DMA_CH1, spi_cfg);
44 static SPI_BUS: StaticCell<Spi1Bus> = StaticCell::new();
45 let spi_bus = SPI_BUS.init(Mutex::new(spi));
46
47 // Chip select pins for the SPI devices
48 let cs_a = Output::new(AnyPin::from(p.PIN_0), Level::High);
49 let cs_b = Output::new(AnyPin::from(p.PIN_1), Level::High);
50
51 spawner.must_spawn(spi_task_a(spi_bus, cs_a));
52 spawner.must_spawn(spi_task_b(spi_bus, cs_b));
53}
54
55#[embassy_executor::task]
56async fn i2c_task_a(i2c_bus: &'static I2c1Bus) {
57 let i2c_dev = I2cDevice::new(i2c_bus);
58 let _sensor = DummyI2cDeviceDriver::new(i2c_dev, 0xC0);
59 loop {
60 info!("i2c task A");
61 Timer::after_secs(1).await;
62 }
63}
64
65#[embassy_executor::task]
66async fn i2c_task_b(i2c_bus: &'static I2c1Bus) {
67 let i2c_dev = I2cDevice::new(i2c_bus);
68 let _sensor = DummyI2cDeviceDriver::new(i2c_dev, 0xDE);
69 loop {
70 info!("i2c task B");
71 Timer::after_secs(1).await;
72 }
73}
74
75#[embassy_executor::task]
76async fn spi_task_a(spi_bus: &'static Spi1Bus, cs: Output<'static>) {
77 let spi_dev = SpiDevice::new(spi_bus, cs);
78 let _sensor = DummySpiDeviceDriver::new(spi_dev);
79 loop {
80 info!("spi task A");
81 Timer::after_secs(1).await;
82 }
83}
84
85#[embassy_executor::task]
86async fn spi_task_b(spi_bus: &'static Spi1Bus, cs: Output<'static>) {
87 let spi_dev = SpiDevice::new(spi_bus, cs);
88 let _sensor = DummySpiDeviceDriver::new(spi_dev);
89 loop {
90 info!("spi task B");
91 Timer::after_secs(1).await;
92 }
93}
94
95// Dummy I2C device driver, using `embedded-hal-async`
96struct DummyI2cDeviceDriver<I2C: embedded_hal_async::i2c::I2c> {
97 _i2c: I2C,
98}
99
100impl<I2C: embedded_hal_async::i2c::I2c> DummyI2cDeviceDriver<I2C> {
101 fn new(i2c_dev: I2C, _address: u8) -> Self {
102 Self { _i2c: i2c_dev }
103 }
104}
105
106// Dummy SPI device driver, using `embedded-hal-async`
107struct DummySpiDeviceDriver<SPI: embedded_hal_async::spi::SpiDevice> {
108 _spi: SPI,
109}
110
111impl<SPI: embedded_hal_async::spi::SpiDevice> DummySpiDeviceDriver<SPI> {
112 fn new(spi_dev: SPI) -> Self {
113 Self { _spi: spi_dev }
114 }
115}
diff --git a/examples/rp/src/bin/sharing.rs b/examples/rp/src/bin/sharing.rs
new file mode 100644
index 000000000..5416e20ce
--- /dev/null
+++ b/examples/rp/src/bin/sharing.rs
@@ -0,0 +1,150 @@
1//! This example shows some common strategies for sharing resources between tasks.
2//!
3//! We demonstrate five different ways of sharing, covering different use cases:
4//! - Atomics: This method is used for simple values, such as bool and u8..u32
5//! - Blocking Mutex: This is used for sharing non-async things, using Cell/RefCell for interior mutability.
6//! - Async Mutex: This is used for sharing async resources, where you need to hold the lock across await points.
7//! The async Mutex has interior mutability built-in, so no RefCell is needed.
8//! - Cell: For sharing Copy types between tasks running on the same executor.
9//! - RefCell: When you want &mut access to a value shared between tasks running on the same executor.
10//!
11//! More information: https://embassy.dev/book/#_sharing_peripherals_between_tasks
12
13#![no_std]
14#![no_main]
15
16use core::cell::{Cell, RefCell};
17use core::sync::atomic::{AtomicU32, Ordering};
18
19use cortex_m_rt::entry;
20use defmt::info;
21use embassy_executor::{Executor, InterruptExecutor};
22use embassy_rp::clocks::RoscRng;
23use embassy_rp::interrupt::{InterruptExt, Priority};
24use embassy_rp::peripherals::UART0;
25use embassy_rp::uart::{self, InterruptHandler, UartTx};
26use embassy_rp::{bind_interrupts, interrupt};
27use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
28use embassy_sync::{blocking_mutex, mutex};
29use embassy_time::{Duration, Ticker};
30use rand::RngCore;
31use static_cell::{ConstStaticCell, StaticCell};
32use {defmt_rtt as _, panic_probe as _};
33
34type UartAsyncMutex = mutex::Mutex<CriticalSectionRawMutex, UartTx<'static, UART0, uart::Async>>;
35
36struct MyType {
37 inner: u32,
38}
39
40static EXECUTOR_HI: InterruptExecutor = InterruptExecutor::new();
41static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
42
43// Use Atomics for simple values
44static ATOMIC: AtomicU32 = AtomicU32::new(0);
45
46// Use blocking Mutex with Cell/RefCell for sharing non-async things
47static MUTEX_BLOCKING: blocking_mutex::Mutex<CriticalSectionRawMutex, RefCell<MyType>> =
48 blocking_mutex::Mutex::new(RefCell::new(MyType { inner: 0 }));
49
50bind_interrupts!(struct Irqs {
51 UART0_IRQ => InterruptHandler<UART0>;
52});
53
54#[interrupt]
55unsafe fn SWI_IRQ_0() {
56 EXECUTOR_HI.on_interrupt()
57}
58
59#[entry]
60fn main() -> ! {
61 let p = embassy_rp::init(Default::default());
62 info!("Here we go!");
63
64 let uart = UartTx::new(p.UART0, p.PIN_0, p.DMA_CH0, uart::Config::default());
65 // Use the async Mutex for sharing async things (built-in interior mutability)
66 static UART: StaticCell<UartAsyncMutex> = StaticCell::new();
67 let uart = UART.init(mutex::Mutex::new(uart));
68
69 // High-priority executor: runs in interrupt mode
70 interrupt::SWI_IRQ_0.set_priority(Priority::P3);
71 let spawner = EXECUTOR_HI.start(interrupt::SWI_IRQ_0);
72 spawner.must_spawn(task_a(uart));
73
74 // Low priority executor: runs in thread mode
75 let executor = EXECUTOR_LOW.init(Executor::new());
76 executor.run(|spawner| {
77 // No Mutex needed when sharing between tasks running on the same executor
78
79 // Use Cell for Copy-types
80 static CELL: ConstStaticCell<Cell<[u8; 4]>> = ConstStaticCell::new(Cell::new([0; 4]));
81 let cell = CELL.take();
82
83 // Use RefCell for &mut access
84 static REF_CELL: ConstStaticCell<RefCell<MyType>> = ConstStaticCell::new(RefCell::new(MyType { inner: 0 }));
85 let ref_cell = REF_CELL.take();
86
87 spawner.must_spawn(task_b(uart, cell, ref_cell));
88 spawner.must_spawn(task_c(cell, ref_cell));
89 });
90}
91
92#[embassy_executor::task]
93async fn task_a(uart: &'static UartAsyncMutex) {
94 let mut ticker = Ticker::every(Duration::from_secs(1));
95 loop {
96 let random = RoscRng.next_u32();
97
98 {
99 let mut uart = uart.lock().await;
100 uart.write(b"task a").await.unwrap();
101 // The uart lock is released when it goes out of scope
102 }
103
104 ATOMIC.store(random, Ordering::Relaxed);
105
106 MUTEX_BLOCKING.lock(|x| x.borrow_mut().inner = random);
107
108 ticker.next().await;
109 }
110}
111
112#[embassy_executor::task]
113async fn task_b(uart: &'static UartAsyncMutex, cell: &'static Cell<[u8; 4]>, ref_cell: &'static RefCell<MyType>) {
114 let mut ticker = Ticker::every(Duration::from_secs(1));
115 loop {
116 let random = RoscRng.next_u32();
117
118 uart.lock().await.write(b"task b").await.unwrap();
119
120 cell.set(random.to_be_bytes());
121
122 ref_cell.borrow_mut().inner = random;
123
124 ticker.next().await;
125 }
126}
127
128#[embassy_executor::task]
129async fn task_c(cell: &'static Cell<[u8; 4]>, ref_cell: &'static RefCell<MyType>) {
130 let mut ticker = Ticker::every(Duration::from_secs(1));
131 loop {
132 info!("=======================");
133
134 let atomic_val = ATOMIC.load(Ordering::Relaxed);
135 info!("atomic: {}", atomic_val);
136
137 MUTEX_BLOCKING.lock(|x| {
138 let val = x.borrow().inner;
139 info!("blocking mutex: {}", val);
140 });
141
142 let cell_val = cell.get();
143 info!("cell: {:?}", cell_val);
144
145 let ref_cell_val = ref_cell.borrow().inner;
146 info!("ref_cell: {:?}", ref_cell_val);
147
148 ticker.next().await;
149 }
150}
diff --git a/examples/rp/src/bin/uart_buffered_split.rs b/examples/rp/src/bin/uart_buffered_split.rs
index fac61aa04..468d2b61a 100644
--- a/examples/rp/src/bin/uart_buffered_split.rs
+++ b/examples/rp/src/bin/uart_buffered_split.rs
@@ -31,7 +31,7 @@ async fn main(spawner: Spawner) {
31 static RX_BUF: StaticCell<[u8; 16]> = StaticCell::new(); 31 static RX_BUF: StaticCell<[u8; 16]> = StaticCell::new();
32 let rx_buf = &mut RX_BUF.init([0; 16])[..]; 32 let rx_buf = &mut RX_BUF.init([0; 16])[..];
33 let uart = BufferedUart::new(uart, Irqs, tx_pin, rx_pin, tx_buf, rx_buf, Config::default()); 33 let uart = BufferedUart::new(uart, Irqs, tx_pin, rx_pin, tx_buf, rx_buf, Config::default());
34 let (rx, mut tx) = uart.split(); 34 let (mut tx, rx) = uart.split();
35 35
36 unwrap!(spawner.spawn(reader(rx))); 36 unwrap!(spawner.spawn(reader(rx)));
37 37
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml
index 58ea894f3..87491b1d2 100644
--- a/examples/std/Cargo.toml
+++ b/examples/std/Cargo.toml
@@ -6,8 +6,8 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["log"] } 8embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["log"] }
9embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-std", "executor-thread", "log", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-std", "executor-thread", "log", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["log", "std", ] } 10embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["log", "std", ] }
11embassy-net = { version = "0.4.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "medium-ip", "tcp", "udp", "dns", "dhcpv4", "proto-ipv6"] } 11embassy-net = { version = "0.4.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "medium-ip", "tcp", "udp", "dns", "dhcpv4", "proto-ipv6"] }
12embassy-net-tuntap = { version = "0.1.0", path = "../../embassy-net-tuntap" } 12embassy-net-tuntap = { version = "0.1.0", path = "../../embassy-net-tuntap" }
13embassy-net-ppp = { version = "0.1.0", path = "../../embassy-net-ppp", features = ["log"]} 13embassy-net-ppp = { version = "0.1.0", path = "../../embassy-net-ppp", features = ["log"]}
diff --git a/examples/stm32c0/Cargo.toml b/examples/stm32c0/Cargo.toml
index 331046a80..9102467eb 100644
--- a/examples/stm32c0/Cargo.toml
+++ b/examples/stm32c0/Cargo.toml
@@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
8# Change stm32c031c6 to your chip name, if necessary. 8# Change stm32c031c6 to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32c031c6", "memory-x", "unstable-pac", "exti"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32c031c6", "memory-x", "unstable-pac", "exti"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13 13
14defmt = "0.3" 14defmt = "0.3"
15defmt-rtt = "0.4" 15defmt-rtt = "0.4"
diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml
index 15fb55ca7..724efdaff 100644
--- a/examples/stm32f0/Cargo.toml
+++ b/examples/stm32f0/Cargo.toml
@@ -13,8 +13,8 @@ defmt = "0.3"
13defmt-rtt = "0.4" 13defmt-rtt = "0.4"
14panic-probe = { version = "0.3", features = ["print-defmt"] } 14panic-probe = { version = "0.3", features = ["print-defmt"] }
15embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 15embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
16embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 16embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
17embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 17embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
18static_cell = "2" 18static_cell = "2"
19portable-atomic = { version = "1.5", features = ["unsafe-assume-single-core"] } 19portable-atomic = { version = "1.5", features = ["unsafe-assume-single-core"] }
20 20
diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml
index 38b615795..0084651a3 100644
--- a/examples/stm32f1/Cargo.toml
+++ b/examples/stm32f1/Cargo.toml
@@ -8,9 +8,9 @@ license = "MIT OR Apache-2.0"
8# Change stm32f103c8 to your chip name, if necessary. 8# Change stm32f103c8 to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any" ] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any" ] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15 15
16defmt = "0.3" 16defmt = "0.3"
diff --git a/examples/stm32f2/Cargo.toml b/examples/stm32f2/Cargo.toml
index ec9b54920..60eb0eb93 100644
--- a/examples/stm32f2/Cargo.toml
+++ b/examples/stm32f2/Cargo.toml
@@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
8# Change stm32f207zg to your chip name, if necessary. 8# Change stm32f207zg to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f207zg", "unstable-pac", "memory-x", "time-driver-any", "exti"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f207zg", "unstable-pac", "memory-x", "time-driver-any", "exti"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13 13
14defmt = "0.3" 14defmt = "0.3"
15defmt-rtt = "0.4" 15defmt-rtt = "0.4"
diff --git a/examples/stm32f3/Cargo.toml b/examples/stm32f3/Cargo.toml
index 62c0fed16..7fda410d9 100644
--- a/examples/stm32f3/Cargo.toml
+++ b/examples/stm32f3/Cargo.toml
@@ -8,9 +8,9 @@ license = "MIT OR Apache-2.0"
8# Change stm32f303ze to your chip name, if necessary. 8# Change stm32f303ze to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f303ze", "unstable-pac", "memory-x", "time-driver-any", "exti"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f303ze", "unstable-pac", "memory-x", "time-driver-any", "exti"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15 15
16defmt = "0.3" 16defmt = "0.3"
diff --git a/examples/stm32f3/src/bin/blocking-tsc.rs b/examples/stm32f3/src/bin/blocking-tsc.rs
new file mode 100644
index 000000000..5c8dac94f
--- /dev/null
+++ b/examples/stm32f3/src/bin/blocking-tsc.rs
@@ -0,0 +1,98 @@
1// Example of polling TSC (Touch Sensing Controller) that lights an LED when touch is detected.
2//
3// Suggested physical setup on STM32F303ZE Nucleo board:
4// - Connect a 1000pF capacitor between pin A0 and GND. This is your sampling capacitor.
5// - Connect one end of a 1K resistor to pin A1 and leave the other end loose.
6// The loose end will act as touch sensor which will register your touch.
7//
8// Troubleshooting the setup:
9// - If no touch seems to be registered, then try to disconnect the sampling capacitor from GND momentarily,
10// now the led should light up. Next try using a different value for the sampling capacitor.
11// Also experiment with increasing the values for `ct_pulse_high_length`, `ct_pulse_low_length`, `pulse_generator_prescaler`, `max_count_value` and `discharge_delay`.
12//
13// All configuration values and sampling capacitor value have been determined experimentally.
14// Suitable configuration and discharge delay values are highly dependent on the value of the sample capacitor. For example, a shorter discharge delay can be used with smaller capacitor values.
15//
16#![no_std]
17#![no_main]
18
19use defmt::*;
20use embassy_stm32::gpio::{Level, Output, Speed};
21use embassy_stm32::tsc::{self, *};
22use embassy_time::Timer;
23use {defmt_rtt as _, panic_probe as _};
24
25/// This example is written for the nucleo-stm32f303ze, with a stm32f303ze chip.
26///
27/// Make sure you check/update the following (whether you use the F303ZE or another board):
28///
29/// * [ ] Update .cargo/config.toml with the correct `probe-rs run --chip STM32F303ZETx`chip name.
30/// * [ ] Update Cargo.toml to have the correct `embassy-stm32` feature, for F303ZE it should be `stm32f303ze`.
31/// * [ ] If your board has a special clock or power configuration, make sure that it is
32/// set up appropriately.
33/// * [ ] If your board has different pin mapping, update any pin numbers or peripherals
34/// to match your schematic
35///
36/// If you are unsure, please drop by the Embassy Matrix chat for support, and let us know:
37///
38/// * Which example you are trying to run
39/// * Which chip and board you are using
40///
41/// Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org
42#[embassy_executor::main]
43async fn main(_spawner: embassy_executor::Spawner) {
44 let device_config = embassy_stm32::Config::default();
45 let context = embassy_stm32::init(device_config);
46
47 let tsc_conf = Config {
48 ct_pulse_high_length: ChargeTransferPulseCycle::_8,
49 ct_pulse_low_length: ChargeTransferPulseCycle::_8,
50 spread_spectrum: false,
51 spread_spectrum_deviation: SSDeviation::new(2).unwrap(),
52 spread_spectrum_prescaler: false,
53 pulse_generator_prescaler: PGPrescalerDivider::_32,
54 max_count_value: MaxCount::_255,
55 io_default_mode: false,
56 synchro_pin_polarity: false,
57 acquisition_mode: false,
58 max_count_interrupt: false,
59 channel_ios: TscIOPin::Group1Io1.into(),
60 shield_ios: 0, // no shield
61 sampling_ios: TscIOPin::Group1Io2.into(),
62 };
63
64 let mut g1: PinGroup<embassy_stm32::peripherals::TSC, G1> = PinGroup::new();
65 g1.set_io1(context.PA0, PinType::Sample);
66 g1.set_io2(context.PA1, PinType::Channel);
67
68 let mut touch_controller = tsc::Tsc::new_blocking(context.TSC, Some(g1), None, None, None, None, None, tsc_conf);
69
70 // LED2 on the STM32F303ZE nucleo-board
71 let mut led = Output::new(context.PB7, Level::High, Speed::Low);
72
73 // smaller sample capacitor discharge faster and can be used with shorter delay.
74 let discharge_delay = 5; // ms
75
76 // the interval at which the loop polls for new touch sensor values
77 let polling_interval = 100; // ms
78
79 info!("polling for touch");
80 loop {
81 touch_controller.start();
82 touch_controller.poll_for_acquisition();
83 touch_controller.discharge_io(true);
84 Timer::after_millis(discharge_delay).await;
85
86 let grp1_status = touch_controller.group_get_status(Group::One);
87 match grp1_status {
88 GroupStatus::Complete => {
89 let group_one_val = touch_controller.group_get_value(Group::One);
90 info!("{}", group_one_val);
91 led.set_high();
92 }
93 GroupStatus::Ongoing => led.set_low(),
94 }
95
96 Timer::after_millis(polling_interval).await;
97 }
98}
diff --git a/examples/stm32f334/Cargo.toml b/examples/stm32f334/Cargo.toml
index 84c44a7b7..1cc0a97da 100644
--- a/examples/stm32f334/Cargo.toml
+++ b/examples/stm32f334/Cargo.toml
@@ -6,10 +6,10 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
9embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f334r8", "unstable-pac", "memory-x", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f334r8", "unstable-pac", "memory-x", "time-driver-any", "exti"] }
12embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 12embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
13embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 13embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
14 14
15defmt = "0.3" 15defmt = "0.3"
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml
index d909c7e68..b85361596 100644
--- a/examples/stm32f4/Cargo.toml
+++ b/examples/stm32f4/Cargo.toml
@@ -8,9 +8,9 @@ license = "MIT OR Apache-2.0"
8# Change stm32f429zi to your chip name, if necessary. 8# Change stm32f429zi to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt" ] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt" ] }
14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } 14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] }
15embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", features = ["defmt"] } 15embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", features = ["defmt"] }
16embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 16embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
@@ -30,7 +30,7 @@ heapless = { version = "0.8", default-features = false }
30nb = "1.0.0" 30nb = "1.0.0"
31embedded-storage = "0.3.1" 31embedded-storage = "0.3.1"
32micromath = "2.0.0" 32micromath = "2.0.0"
33usbd-hid = "0.7.0" 33usbd-hid = "0.8.1"
34static_cell = "2" 34static_cell = "2"
35chrono = { version = "^0.4", default-features = false} 35chrono = { version = "^0.4", default-features = false}
36 36
diff --git a/examples/stm32f469/Cargo.toml b/examples/stm32f469/Cargo.toml
index 634f13f4e..6a5bd0b29 100644
--- a/examples/stm32f469/Cargo.toml
+++ b/examples/stm32f469/Cargo.toml
@@ -7,8 +7,8 @@ license = "MIT OR Apache-2.0"
7[dependencies] 7[dependencies]
8# Specific examples only for stm32f469 8# Specific examples only for stm32f469
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f469ni", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f469ni", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] }
10embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 10embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
11embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 11embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
12 12
13defmt = "0.3" 13defmt = "0.3"
14defmt-rtt = "0.4" 14defmt-rtt = "0.4"
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml
index 7fc7d6f42..8c591ebd2 100644
--- a/examples/stm32f7/Cargo.toml
+++ b/examples/stm32f7/Cargo.toml
@@ -8,11 +8,11 @@ license = "MIT OR Apache-2.0"
8# Change stm32f777zi to your chip name, if necessary. 8# Change stm32f777zi to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } 13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] }
14embedded-io-async = { version = "0.6.1" } 14embedded-io-async = { version = "0.6.1" }
15embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 15embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
16embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 16embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
17 17
18defmt = "0.3" 18defmt = "0.3"
diff --git a/examples/stm32g0/Cargo.toml b/examples/stm32g0/Cargo.toml
index b9d710ca7..a50074ce0 100644
--- a/examples/stm32g0/Cargo.toml
+++ b/examples/stm32g0/Cargo.toml
@@ -8,9 +8,9 @@ license = "MIT OR Apache-2.0"
8# Change stm32g0b1re to your chip name, if necessary. 8# Change stm32g0b1re to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32g0b1re", "memory-x", "unstable-pac", "exti"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32g0b1re", "memory-x", "unstable-pac", "exti"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", default-features = false, features = ["defmt"] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", default-features = false, features = ["defmt"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15 15
16defmt = "0.3" 16defmt = "0.3"
diff --git a/examples/stm32g4/Cargo.toml b/examples/stm32g4/Cargo.toml
index ac6010f5f..2768147a1 100644
--- a/examples/stm32g4/Cargo.toml
+++ b/examples/stm32g4/Cargo.toml
@@ -8,11 +8,11 @@ license = "MIT OR Apache-2.0"
8# Change stm32g491re to your chip name, if necessary. 8# Change stm32g491re to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32g491re", "memory-x", "unstable-pac", "exti"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32g491re", "memory-x", "unstable-pac", "exti"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15usbd-hid = "0.7.0" 15usbd-hid = "0.8.1"
16 16
17defmt = "0.3" 17defmt = "0.3"
18defmt-rtt = "0.4" 18defmt-rtt = "0.4"
diff --git a/examples/stm32h5/Cargo.toml b/examples/stm32h5/Cargo.toml
index 59d3a9759..30b1d2be9 100644
--- a/examples/stm32h5/Cargo.toml
+++ b/examples/stm32h5/Cargo.toml
@@ -8,10 +8,10 @@ license = "MIT OR Apache-2.0"
8# Change stm32h563zi to your chip name, if necessary. 8# Change stm32h563zi to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h563zi", "memory-x", "time-driver-any", "exti", "unstable-pac", "low-power"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h563zi", "memory-x", "time-driver-any", "exti", "unstable-pac", "low-power"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6"] } 13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6"] }
14embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
15embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 15embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
16 16
17defmt = "0.3" 17defmt = "0.3"
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index 78343b74f..13fce7dc7 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -8,11 +8,11 @@ license = "MIT OR Apache-2.0"
8# Change stm32h743bi to your chip name, if necessary. 8# Change stm32h743bi to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743bi", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743bi", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } 11embassy-embedded-hal = { version = "0.2.0", path = "../../embassy-embedded-hal" }
12embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 12embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
13embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 13embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } 14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] }
15embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 15embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
16embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 16embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
17 17
18defmt = "0.3" 18defmt = "0.3"
diff --git a/examples/stm32h735/Cargo.toml b/examples/stm32h735/Cargo.toml
index fc21cc894..93e9575b6 100644
--- a/examples/stm32h735/Cargo.toml
+++ b/examples/stm32h735/Cargo.toml
@@ -7,9 +7,9 @@ license = "MIT OR Apache-2.0"
7[dependencies] 7[dependencies]
8embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h735ig", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } 8embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h735ig", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] }
9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
10embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } 10embassy-embedded-hal = { version = "0.2.0", path = "../../embassy-embedded-hal" }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 13embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
14 14
15defmt = "0.3" 15defmt = "0.3"
diff --git a/examples/stm32h7rs/Cargo.toml b/examples/stm32h7rs/Cargo.toml
index 13d33320f..f97dfd722 100644
--- a/examples/stm32h7rs/Cargo.toml
+++ b/examples/stm32h7rs/Cargo.toml
@@ -8,10 +8,10 @@ license = "MIT OR Apache-2.0"
8# Change stm32h743bi to your chip name, if necessary. 8# Change stm32h743bi to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h7s3l8", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h7s3l8", "time-driver-tim2", "exti", "memory-x", "unstable-pac", "chrono"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] } 13embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] }
14embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
15embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 15embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
16 16
17defmt = "0.3" 17defmt = "0.3"
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml
index 5b0519ac4..2577f19e0 100644
--- a/examples/stm32l0/Cargo.toml
+++ b/examples/stm32l0/Cargo.toml
@@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
8# Change stm32l072cz to your chip name, if necessary. 8# Change stm32l072cz to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "unstable-pac", "time-driver-any", "exti", "memory-x"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "unstable-pac", "time-driver-any", "exti", "memory-x"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13 13
14defmt = "0.3" 14defmt = "0.3"
15defmt-rtt = "0.4" 15defmt-rtt = "0.4"
diff --git a/examples/stm32l0/src/bin/async-tsc.rs b/examples/stm32l0/src/bin/async-tsc.rs
new file mode 100644
index 000000000..c40b86af9
--- /dev/null
+++ b/examples/stm32l0/src/bin/async-tsc.rs
@@ -0,0 +1,122 @@
1// Example of async TSC (Touch Sensing Controller) that lights an LED when touch is detected.
2//
3// Suggested physical setup on STM32L073RZ Nucleo board:
4// - Connect a 1000pF capacitor between pin A0 and GND. This is your sampling capacitor.
5// - Connect one end of a 1K resistor to pin A1 and leave the other end loose.
6// The loose end will act as touch sensor which will register your touch.
7//
8// Troubleshooting the setup:
9// - If no touch seems to be registered, then try to disconnect the sampling capacitor from GND momentarily,
10// now the led should light up. Next try using a different value for the sampling capacitor.
11// Also experiment with increasing the values for `ct_pulse_high_length`, `ct_pulse_low_length`, `pulse_generator_prescaler`, `max_count_value` and `discharge_delay`.
12//
13// All configuration values and sampling capacitor value have been determined experimentally.
14// Suitable configuration and discharge delay values are highly dependent on the value of the sample capacitor. For example, a shorter discharge delay can be used with smaller capacitor values.
15//
16#![no_std]
17#![no_main]
18
19use defmt::*;
20use embassy_stm32::bind_interrupts;
21use embassy_stm32::gpio::{Level, Output, Speed};
22use embassy_stm32::tsc::{self, *};
23use embassy_time::Timer;
24use {defmt_rtt as _, panic_probe as _};
25
26bind_interrupts!(struct Irqs {
27 TSC => InterruptHandler<embassy_stm32::peripherals::TSC>;
28});
29
30#[cortex_m_rt::exception]
31unsafe fn HardFault(_: &cortex_m_rt::ExceptionFrame) -> ! {
32 cortex_m::peripheral::SCB::sys_reset();
33}
34
35/// This example is written for the nucleo-stm32l073rz, with a stm32l073rz chip.
36///
37/// Make sure you check/update the following (whether you use the L073RZ or another board):
38///
39/// * [ ] Update .cargo/config.toml with the correct `probe-rs run --chip STM32L073RZTx`chip name.
40/// * [ ] Update Cargo.toml to have the correct `embassy-stm32` feature, for L073RZ it should be `stm32l073rz`.
41/// * [ ] If your board has a special clock or power configuration, make sure that it is
42/// set up appropriately.
43/// * [ ] If your board has different pin mapping, update any pin numbers or peripherals
44/// to match your schematic
45///
46/// If you are unsure, please drop by the Embassy Matrix chat for support, and let us know:
47///
48/// * Which example you are trying to run
49/// * Which chip and board you are using
50///
51/// Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org
52#[embassy_executor::main]
53async fn main(_spawner: embassy_executor::Spawner) {
54 let device_config = embassy_stm32::Config::default();
55 let context = embassy_stm32::init(device_config);
56
57 let config = tsc::Config {
58 ct_pulse_high_length: ChargeTransferPulseCycle::_4,
59 ct_pulse_low_length: ChargeTransferPulseCycle::_4,
60 spread_spectrum: false,
61 spread_spectrum_deviation: SSDeviation::new(2).unwrap(),
62 spread_spectrum_prescaler: false,
63 pulse_generator_prescaler: PGPrescalerDivider::_16,
64 max_count_value: MaxCount::_255,
65 io_default_mode: false,
66 synchro_pin_polarity: false,
67 acquisition_mode: false,
68 max_count_interrupt: false,
69 channel_ios: TscIOPin::Group1Io1.into(),
70 shield_ios: 0, // no shield
71 sampling_ios: TscIOPin::Group1Io2.into(),
72 };
73
74 let mut g1: PinGroup<embassy_stm32::peripherals::TSC, G1> = PinGroup::new();
75 g1.set_io1(context.PA0, PinType::Sample);
76 g1.set_io2(context.PA1, PinType::Channel);
77
78 let mut touch_controller = tsc::Tsc::new_async(
79 context.TSC,
80 Some(g1),
81 None,
82 None,
83 None,
84 None,
85 None,
86 None,
87 None,
88 config,
89 Irqs,
90 );
91
92 // Check if TSC is ready
93 if touch_controller.get_state() != State::Ready {
94 info!("TSC not ready!");
95 loop {} // Halt execution
96 }
97 info!("TSC initialized successfully");
98
99 // LED2 on the STM32L073RZ nucleo-board (PA5)
100 let mut led = Output::new(context.PA5, Level::High, Speed::Low);
101
102 // smaller sample capacitor discharge faster and can be used with shorter delay.
103 let discharge_delay = 5; // ms
104
105 info!("Starting touch_controller interface");
106 loop {
107 touch_controller.start();
108 touch_controller.pend_for_acquisition().await;
109 touch_controller.discharge_io(true);
110 Timer::after_millis(discharge_delay).await;
111
112 let grp1_status = touch_controller.group_get_status(Group::One);
113 match grp1_status {
114 GroupStatus::Complete => {
115 let group_one_val = touch_controller.group_get_value(Group::One);
116 info!("{}", group_one_val);
117 led.set_high();
118 }
119 GroupStatus::Ongoing => led.set_low(),
120 }
121 }
122}
diff --git a/examples/stm32l0/src/bin/blocking-tsc.rs b/examples/stm32l0/src/bin/blocking-tsc.rs
new file mode 100644
index 000000000..7e4f40946
--- /dev/null
+++ b/examples/stm32l0/src/bin/blocking-tsc.rs
@@ -0,0 +1,116 @@
1// Example of polling TSC (Touch Sensing Controller) that lights an LED when touch is detected.
2//
3// Suggested physical setup on STM32L073RZ Nucleo board:
4// - Connect a 1000pF capacitor between pin A0 and GND. This is your sampling capacitor.
5// - Connect one end of a 1K resistor to pin A1 and leave the other end loose.
6// The loose end will act as touch sensor which will register your touch.
7//
8// Troubleshooting the setup:
9// - If no touch seems to be registered, then try to disconnect the sampling capacitor from GND momentarily,
10// now the led should light up. Next try using a different value for the sampling capacitor.
11// Also experiment with increasing the values for `ct_pulse_high_length`, `ct_pulse_low_length`, `pulse_generator_prescaler`, `max_count_value` and `discharge_delay`.
12//
13// All configuration values and sampling capacitor value have been determined experimentally.
14// Suitable configuration and discharge delay values are highly dependent on the value of the sample capacitor. For example, a shorter discharge delay can be used with smaller capacitor values.
15//
16#![no_std]
17#![no_main]
18
19use defmt::*;
20use embassy_stm32::gpio::{Level, Output, Speed};
21use embassy_stm32::tsc::{self, *};
22use embassy_time::Timer;
23use {defmt_rtt as _, panic_probe as _};
24
25/// This example is written for the nucleo-stm32l073rz, with a stm32l073rz chip.
26///
27/// Make sure you check/update the following (whether you use the L073RZ or another board):
28///
29/// * [ ] Update .cargo/config.toml with the correct `probe-rs run --chip STM32L073RZTx`chip name.
30/// * [ ] Update Cargo.toml to have the correct `embassy-stm32` feature, for L073RZ it should be `stm32l073rz`.
31/// * [ ] If your board has a special clock or power configuration, make sure that it is
32/// set up appropriately.
33/// * [ ] If your board has different pin mapping, update any pin numbers or peripherals
34/// to match your schematic
35///
36/// If you are unsure, please drop by the Embassy Matrix chat for support, and let us know:
37///
38/// * Which example you are trying to run
39/// * Which chip and board you are using
40///
41/// Embassy Chat: https://matrix.to/#/#embassy-rs:matrix.org
42#[embassy_executor::main]
43async fn main(_spawner: embassy_executor::Spawner) {
44 let device_config = embassy_stm32::Config::default();
45 let context = embassy_stm32::init(device_config);
46
47 let tsc_conf = Config {
48 ct_pulse_high_length: ChargeTransferPulseCycle::_4,
49 ct_pulse_low_length: ChargeTransferPulseCycle::_4,
50 spread_spectrum: false,
51 spread_spectrum_deviation: SSDeviation::new(2).unwrap(),
52 spread_spectrum_prescaler: false,
53 pulse_generator_prescaler: PGPrescalerDivider::_16,
54 max_count_value: MaxCount::_255,
55 io_default_mode: false,
56 synchro_pin_polarity: false,
57 acquisition_mode: false,
58 max_count_interrupt: false,
59 channel_ios: TscIOPin::Group1Io1.into(),
60 shield_ios: 0, // no shield
61 sampling_ios: TscIOPin::Group1Io2.into(),
62 };
63
64 let mut g1: PinGroup<embassy_stm32::peripherals::TSC, G1> = PinGroup::new();
65 g1.set_io1(context.PA0, PinType::Sample);
66 g1.set_io2(context.PA1, PinType::Channel);
67
68 let mut touch_controller = tsc::Tsc::new_blocking(
69 context.TSC,
70 Some(g1),
71 None,
72 None,
73 None,
74 None,
75 None,
76 None,
77 None,
78 tsc_conf,
79 );
80
81 // Check if TSC is ready
82 if touch_controller.get_state() != State::Ready {
83 info!("TSC not ready!");
84 loop {} // Halt execution
85 }
86 info!("TSC initialized successfully");
87
88 // LED2 on the STM32L073RZ nucleo-board (PA5)
89 let mut led = Output::new(context.PA5, Level::High, Speed::Low);
90
91 // smaller sample capacitor discharge faster and can be used with shorter delay.
92 let discharge_delay = 5; // ms
93
94 // the interval at which the loop polls for new touch sensor values
95 let polling_interval = 100; // ms
96
97 info!("polling for touch");
98 loop {
99 touch_controller.start();
100 touch_controller.poll_for_acquisition();
101 touch_controller.discharge_io(true);
102 Timer::after_millis(discharge_delay).await;
103
104 let grp1_status = touch_controller.group_get_status(Group::One);
105 match grp1_status {
106 GroupStatus::Complete => {
107 let group_one_val = touch_controller.group_get_value(Group::One);
108 info!("{}", group_one_val);
109 led.set_high();
110 }
111 GroupStatus::Ongoing => led.set_low(),
112 }
113
114 Timer::after_millis(polling_interval).await;
115 }
116}
diff --git a/examples/stm32l1/Cargo.toml b/examples/stm32l1/Cargo.toml
index 9e4ceac6a..062044f32 100644
--- a/examples/stm32l1/Cargo.toml
+++ b/examples/stm32l1/Cargo.toml
@@ -6,10 +6,10 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
9embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 9embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
10embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 10embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] }
12embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 12embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
13embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 13embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
14 14
15defmt = "0.3" 15defmt = "0.3"
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index de2b2bd4d..c5478b17b 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -8,10 +8,10 @@ license = "MIT OR Apache-2.0"
8# Change stm32l4s5vi to your chip name, if necessary. 8# Change stm32l4s5vi to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4s5qi", "memory-x", "time-driver-any", "exti", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4s5qi", "memory-x", "time-driver-any", "exti", "chrono"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", ] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", ] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../embassy-embedded-hal" }
14embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
15embassy-net-adin1110 = { version = "0.2.0", path = "../../embassy-net-adin1110" } 15embassy-net-adin1110 = { version = "0.2.0", path = "../../embassy-net-adin1110" }
16embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "udp", "tcp", "dhcpv4", "medium-ethernet"] } 16embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "udp", "tcp", "dhcpv4", "medium-ethernet"] }
17embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 17embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml
index e4a3c8e9c..16c184de2 100644
--- a/examples/stm32l5/Cargo.toml
+++ b/examples/stm32l5/Cargo.toml
@@ -8,12 +8,12 @@ license = "MIT OR Apache-2.0"
8# Change stm32l552ze to your chip name, if necessary. 8# Change stm32l552ze to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] } 14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"] }
15embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 15embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
16usbd-hid = "0.7.0" 16usbd-hid = "0.8.1"
17 17
18defmt = "0.3" 18defmt = "0.3"
19defmt-rtt = "0.4" 19defmt-rtt = "0.4"
diff --git a/examples/stm32u0/Cargo.toml b/examples/stm32u0/Cargo.toml
index afeb4dc34..2e890cdb5 100644
--- a/examples/stm32u0/Cargo.toml
+++ b/examples/stm32u0/Cargo.toml
@@ -8,9 +8,9 @@ license = "MIT OR Apache-2.0"
8# Change stm32u083rc to your chip name, if necessary. 8# Change stm32u083rc to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32u083rc", "memory-x", "unstable-pac", "exti", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32u083rc", "memory-x", "unstable-pac", "exti", "chrono"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", default-features = false, features = ["defmt"] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", default-features = false, features = ["defmt"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15 15
16defmt = "0.3" 16defmt = "0.3"
diff --git a/examples/stm32u5/Cargo.toml b/examples/stm32u5/Cargo.toml
index d0134b972..20d64c6f7 100644
--- a/examples/stm32u5/Cargo.toml
+++ b/examples/stm32u5/Cargo.toml
@@ -8,9 +8,9 @@ license = "MIT OR Apache-2.0"
8# Change stm32u585ai to your chip name, if necessary. 8# Change stm32u585ai to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32u585ai", "time-driver-any", "memory-x" ] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32u585ai", "time-driver-any", "memory-x" ] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.2.0", path = "../../embassy-usb", features = ["defmt"] } 13embassy-usb = { version = "0.3.0", path = "../../embassy-usb", features = ["defmt"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15 15
16defmt = "0.3" 16defmt = "0.3"
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml
index c3a11b14b..1e1a0efe2 100644
--- a/examples/stm32wb/Cargo.toml
+++ b/examples/stm32wb/Cargo.toml
@@ -9,8 +9,8 @@ license = "MIT OR Apache-2.0"
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] }
10embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", features = ["defmt", "stm32wb55rg"] } 10embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", features = ["defmt", "stm32wb55rg"] }
11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
12embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 12embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
13embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 13embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true } 14embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true }
15 15
16defmt = "0.3" 16defmt = "0.3"
diff --git a/examples/stm32wba/Cargo.toml b/examples/stm32wba/Cargo.toml
index dc788e15b..401281c0b 100644
--- a/examples/stm32wba/Cargo.toml
+++ b/examples/stm32wba/Cargo.toml
@@ -7,8 +7,8 @@ license = "MIT OR Apache-2.0"
7[dependencies] 7[dependencies]
8embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wba52cg", "time-driver-any", "memory-x", "exti"] } 8embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wba52cg", "time-driver-any", "memory-x", "exti"] }
9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 9embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
10embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 10embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
11embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 11embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
12embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true } 12embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional=true }
13 13
14defmt = "0.3" 14defmt = "0.3"
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml
index 3ea7d0cbe..46af5218c 100644
--- a/examples/stm32wl/Cargo.toml
+++ b/examples/stm32wl/Cargo.toml
@@ -8,9 +8,9 @@ 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.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "unstable-pac", "exti", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "unstable-pac", "exti", "chrono"] }
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-4096", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-4096", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.2.0", path = "../../embassy-embedded-hal" }
14 14
15defmt = "0.3" 15defmt = "0.3"
16defmt-rtt = "0.4" 16defmt-rtt = "0.4"
diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml
index 9d7acc175..9bd37550c 100644
--- a/examples/wasm/Cargo.toml
+++ b/examples/wasm/Cargo.toml
@@ -9,8 +9,8 @@ crate-type = ["cdylib"]
9 9
10[dependencies] 10[dependencies]
11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["log"] } 11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["log"] }
12embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-wasm", "executor-thread", "log", "integrated-timers"] } 12embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-wasm", "executor-thread", "log", "integrated-timers"] }
13embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["log", "wasm", ] } 13embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["log", "wasm", ] }
14 14
15wasm-logger = "0.2.0" 15wasm-logger = "0.2.0"
16wasm-bindgen = "0.2" 16wasm-bindgen = "0.2"
diff --git a/rust-toolchain-nightly.toml b/rust-toolchain-nightly.toml
index d965d67dd..dfa231344 100644
--- a/rust-toolchain-nightly.toml
+++ b/rust-toolchain-nightly.toml
@@ -1,5 +1,5 @@
1[toolchain] 1[toolchain]
2channel = "nightly-2024-06-18" 2channel = "nightly-2024-07-16"
3components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ] 3components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ]
4targets = [ 4targets = [
5 "thumbv7em-none-eabi", 5 "thumbv7em-none-eabi",
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 037fc5c6a..ce9040a70 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,5 +1,5 @@
1[toolchain] 1[toolchain]
2channel = "1.79" 2channel = "1.80"
3components = [ "rust-src", "rustfmt", "llvm-tools" ] 3components = [ "rust-src", "rustfmt", "llvm-tools" ]
4targets = [ 4targets = [
5 "thumbv7em-none-eabi", 5 "thumbv7em-none-eabi",
diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml
index c714e8f7e..f666634d5 100644
--- a/tests/nrf/Cargo.toml
+++ b/tests/nrf/Cargo.toml
@@ -9,9 +9,9 @@ teleprobe-meta = "1"
9 9
10embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 10embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt", ] } 11embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt", ] }
12embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "task-arena-size-16384", "integrated-timers"] } 12embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "task-arena-size-16384", "integrated-timers"] }
13embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 13embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
14embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "time-driver-rtc1", "gpiote", "unstable-pac"] } 14embassy-nrf = { version = "0.2.0", path = "../../embassy-nrf", features = ["defmt", "time-driver-rtc1", "gpiote", "unstable-pac"] }
15embedded-io-async = { version = "0.6.1", features = ["defmt-03"] } 15embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
16embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } 16embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] }
17embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] } 17embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] }
diff --git a/tests/perf-client/Cargo.toml b/tests/perf-client/Cargo.toml
index 6ecc2d5e1..eb2a33a30 100644
--- a/tests/perf-client/Cargo.toml
+++ b/tests/perf-client/Cargo.toml
@@ -5,6 +5,6 @@ edition = "2021"
5 5
6[dependencies] 6[dependencies]
7embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4"] } 7embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4"] }
8embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", ] } 8embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", ] }
9embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 9embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
10defmt = "0.3.0" 10defmt = "0.3.0"
diff --git a/tests/riscv32/Cargo.toml b/tests/riscv32/Cargo.toml
index 4f1d3e5c6..ae2b0e180 100644
--- a/tests/riscv32/Cargo.toml
+++ b/tests/riscv32/Cargo.toml
@@ -7,8 +7,8 @@ license = "MIT OR Apache-2.0"
7[dependencies] 7[dependencies]
8critical-section = { version = "1.1.1", features = ["restore-state-bool"] } 8critical-section = { version = "1.1.1", features = ["restore-state-bool"] }
9embassy-sync = { version = "0.6.0", path = "../../embassy-sync" } 9embassy-sync = { version = "0.6.0", path = "../../embassy-sync" }
10embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-riscv32", "executor-thread"] } 10embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-riscv32", "executor-thread"] }
11embassy-time = { version = "0.3.1", path = "../../embassy-time" } 11embassy-time = { version = "0.3.2", path = "../../embassy-time" }
12embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 12embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
13 13
14riscv-rt = "0.12.2" 14riscv-rt = "0.12.2"
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml
index 45050ee0e..def270558 100644
--- a/tests/rp/Cargo.toml
+++ b/tests/rp/Cargo.toml
@@ -8,13 +8,13 @@ license = "MIT OR Apache-2.0"
8teleprobe-meta = "1.1" 8teleprobe-meta = "1.1"
9 9
10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", ] } 12embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", ] }
13embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram"] } 13embassy-rp = { version = "0.2.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } 15embassy-net = { version = "0.4.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
16embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", features = ["defmt"] } 16embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", features = ["defmt"] }
17embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal/"} 17embassy-embedded-hal = { version = "0.2.0", path = "../../embassy-embedded-hal/"}
18cyw43 = { path = "../../cyw43", features = ["defmt", "firmware-logs"] } 18cyw43 = { path = "../../cyw43", features = ["defmt", "firmware-logs"] }
19cyw43-pio = { path = "../../cyw43-pio", features = ["defmt", "overclock"] } 19cyw43-pio = { path = "../../cyw43-pio", features = ["defmt", "overclock"] }
20perf-client = { path = "../perf-client" } 20perf-client = { path = "../perf-client" }
diff --git a/tests/rp/src/bin/timer.rs b/tests/rp/src/bin/timer.rs
new file mode 100644
index 000000000..be9242144
--- /dev/null
+++ b/tests/rp/src/bin/timer.rs
@@ -0,0 +1,25 @@
1#![no_std]
2#![no_main]
3teleprobe_meta::target!(b"rpi-pico");
4
5use defmt::{assert, *};
6use embassy_executor::Spawner;
7use embassy_time::{Instant, Timer};
8use {defmt_rtt as _, panic_probe as _};
9
10#[embassy_executor::main]
11async fn main(_spawner: Spawner) {
12 let _p = embassy_rp::init(Default::default());
13 info!("Hello World!");
14
15 let start = Instant::now();
16 Timer::after_millis(100).await;
17 let end = Instant::now();
18 let ms = (end - start).as_millis();
19 info!("slept for {} ms", ms);
20 assert!(ms >= 99);
21 assert!(ms < 110);
22
23 info!("Test OK");
24 cortex_m::asm::bkpt();
25}
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index f94814e70..2eac636e5 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -60,8 +60,8 @@ cm0 = ["portable-atomic/unsafe-assume-single-core"]
60teleprobe-meta = "1" 60teleprobe-meta = "1"
61 61
62embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] } 62embassy-sync = { version = "0.6.0", path = "../../embassy-sync", features = ["defmt"] }
63embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 63embassy-executor = { version = "0.6.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
64embassy-time = { version = "0.3.1", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] } 64embassy-time = { version = "0.3.2", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] }
65embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any"] } 65embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any"] }
66embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 66embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
67embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] } 67embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] }