aboutsummaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorjrmoulton <[email protected]>2025-06-10 15:47:54 -0600
committerjrmoulton <[email protected]>2025-06-10 15:48:36 -0600
commitcfad9798ff99d4de0571a512d156b5fe1ef1d427 (patch)
treefc3bf670f82d139de19466cddad1e909db7f3d2e /docs/examples
parentfc342915e6155dec7bafa3e135da7f37a9a07f5c (diff)
parent6186d111a5c150946ee5b7e9e68d987a38c1a463 (diff)
merge new embassy changes
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/basic/.cargo/config.toml4
-rw-r--r--docs/examples/basic/Cargo.toml12
-rw-r--r--docs/examples/layer-by-layer/.cargo/config.toml3
-rw-r--r--docs/examples/layer-by-layer/Cargo.toml5
-rw-r--r--docs/examples/layer-by-layer/blinky-async/Cargo.toml12
-rw-r--r--docs/examples/layer-by-layer/blinky-hal/Cargo.toml10
-rw-r--r--docs/examples/layer-by-layer/blinky-irq/Cargo.toml12
-rw-r--r--docs/examples/layer-by-layer/blinky-pac/Cargo.toml10
-rw-r--r--docs/examples/layer-by-layer/blinky-pac/src/main.rs48
-rw-r--r--docs/examples/layer-by-layer/memory.x5
10 files changed, 58 insertions, 63 deletions
diff --git a/docs/examples/basic/.cargo/config.toml b/docs/examples/basic/.cargo/config.toml
index 8ca28df39..17616a054 100644
--- a/docs/examples/basic/.cargo/config.toml
+++ b/docs/examples/basic/.cargo/config.toml
@@ -1,6 +1,6 @@
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-run --list-chips` 2# replace nRF82840_xxAA with your chip as listed in `probe-rs chip list`
3runner = "probe-run --chip nRF52840_xxAA" 3runner = "probe-rs run --chip nRF52840_xxAA"
4 4
5[build] 5[build]
6target = "thumbv7em-none-eabi" 6target = "thumbv7em-none-eabi"
diff --git a/docs/examples/basic/Cargo.toml b/docs/examples/basic/Cargo.toml
index 5d391adf3..f5cf2b231 100644
--- a/docs/examples/basic/Cargo.toml
+++ b/docs/examples/basic/Cargo.toml
@@ -6,13 +6,13 @@ 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.6.0", path = "../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] } 9embassy-executor = { version = "0.7.0", path = "../../../embassy-executor", features = ["defmt", "arch-cortex-m", "executor-thread"] }
10embassy-time = { version = "0.3.2", path = "../../../embassy-time", features = ["defmt"] } 10embassy-time = { version = "0.4.0", path = "../../../embassy-time", features = ["defmt"] }
11embassy-nrf = { version = "0.2.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } 11embassy-nrf = { version = "0.3.1", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
12 12
13defmt = "0.3" 13defmt = "1.0.1"
14defmt-rtt = "0.3" 14defmt-rtt = "1.0.0"
15 15
16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
17cortex-m-rt = "0.7.0" 17cortex-m-rt = "0.7.0"
18panic-probe = { version = "0.3", features = ["print-defmt"] } 18panic-probe = { version = "1.0.0", features = ["print-defmt"] }
diff --git a/docs/examples/layer-by-layer/.cargo/config.toml b/docs/examples/layer-by-layer/.cargo/config.toml
index 3012f05dc..f30d9e446 100644
--- a/docs/examples/layer-by-layer/.cargo/config.toml
+++ b/docs/examples/layer-by-layer/.cargo/config.toml
@@ -1,5 +1,6 @@
1[target.'cfg(all(target_arch = "arm", target_os = "none"))'] 1[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2runner = "probe-run --chip STM32L475VG" 2# replace your chip as listed in `probe-rs chip list`
3runner = "probe-rs run --chip STM32L475VG"
3 4
4rustflags = [ 5rustflags = [
5 "-C", "link-arg=--nmagic", 6 "-C", "link-arg=--nmagic",
diff --git a/docs/examples/layer-by-layer/Cargo.toml b/docs/examples/layer-by-layer/Cargo.toml
index 0f233eae5..01666ec6e 100644
--- a/docs/examples/layer-by-layer/Cargo.toml
+++ b/docs/examples/layer-by-layer/Cargo.toml
@@ -3,14 +3,9 @@ resolver = "2"
3members = [ 3members = [
4 "blinky-pac", 4 "blinky-pac",
5 "blinky-hal", 5 "blinky-hal",
6 "blinky-irq",
7 "blinky-async", 6 "blinky-async",
8] 7]
9 8
10[patch.crates-io]
11embassy-executor = { path = "../../../embassy-executor" }
12embassy-stm32 = { path = "../../../embassy-stm32" }
13
14[profile.release] 9[profile.release]
15codegen-units = 1 10codegen-units = 1
16debug = 2 11debug = 2
diff --git a/docs/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
index 7f8d8af3e..2a6741b33 100644
--- a/docs/examples/layer-by-layer/blinky-async/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
@@ -5,11 +5,11 @@ edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8cortex-m = "0.7" 8cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
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.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x", "exti"] }
11embassy-executor = { version = "0.6.0", features = ["arch-cortex-m", "executor-thread"] } 11embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] }
12 12
13defmt = "0.3.0" 13defmt = "1.0.1"
14defmt-rtt = "0.3.0" 14defmt-rtt = "1.0.0"
15panic-probe = { version = "0.3.0", features = ["print-defmt"] } 15panic-probe = { version = "1.0.0", features = ["print-defmt"] }
diff --git a/docs/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
index c15de2db2..9a261f804 100644
--- a/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
@@ -5,10 +5,10 @@ edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8cortex-m = "0.7"
9cortex-m-rt = "0.7" 8cortex-m-rt = "0.7"
10embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] } 9cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
10embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x"] }
11 11
12defmt = "0.3.0" 12defmt = "1.0.1"
13defmt-rtt = "0.3.0" 13defmt-rtt = "1.0.0"
14panic-probe = { version = "0.3.0", features = ["print-defmt"] } 14panic-probe = { version = "1.0.0", features = ["print-defmt"] }
diff --git a/docs/examples/layer-by-layer/blinky-irq/Cargo.toml b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
index 9733658b6..c3ec9ad1a 100644
--- a/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
@@ -1,3 +1,5 @@
1[workspace]
2
1[package] 3[package]
2name = "blinky-irq" 4name = "blinky-irq"
3version = "0.1.0" 5version = "0.1.0"
@@ -5,10 +7,10 @@ edition = "2021"
5license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
6 8
7[dependencies] 9[dependencies]
8cortex-m = "0.7" 10cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
9cortex-m-rt = { version = "0.7" } 11cortex-m-rt = { version = "0.7" }
10embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "unstable-pac"] } 12embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32l475vg", "memory-x", "unstable-pac"] }
11 13
12defmt = "0.3.0" 14defmt = "1.0.1"
13defmt-rtt = "0.3.0" 15defmt-rtt = "1.0.0"
14panic-probe = { version = "0.3.0", features = ["print-defmt"] } 16panic-probe = { version = "1.0.0", features = ["print-defmt"] }
diff --git a/docs/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
index f872b94cb..4e7e2f2ff 100644
--- a/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
@@ -5,10 +5,10 @@ edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8cortex-m = "0.7" 8cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
9cortex-m-rt = "0.7" 9cortex-m-rt = "0.7"
10stm32-metapac = { version = "1", features = ["stm32l475vg", "memory-x"] } 10stm32-metapac = { version = "16", features = ["stm32l475vg"] }
11 11
12defmt = "0.3.0" 12defmt = "1.0.1"
13defmt-rtt = "0.3.0" 13defmt-rtt = "1.0.0"
14panic-probe = { version = "0.3.0", features = ["print-defmt"] } 14panic-probe = { version = "1.0.0", features = ["print-defmt"] }
diff --git a/docs/examples/layer-by-layer/blinky-pac/src/main.rs b/docs/examples/layer-by-layer/blinky-pac/src/main.rs
index 990d46cb6..cfbd91306 100644
--- a/docs/examples/layer-by-layer/blinky-pac/src/main.rs
+++ b/docs/examples/layer-by-layer/blinky-pac/src/main.rs
@@ -8,46 +8,38 @@ use {defmt_rtt as _, panic_probe as _, stm32_metapac as pac};
8fn main() -> ! { 8fn main() -> ! {
9 // Enable GPIO clock 9 // Enable GPIO clock
10 let rcc = pac::RCC; 10 let rcc = pac::RCC;
11 unsafe { 11 rcc.ahb2enr().modify(|w| {
12 rcc.ahb2enr().modify(|w| { 12 w.set_gpioben(true);
13 w.set_gpioben(true); 13 w.set_gpiocen(true);
14 w.set_gpiocen(true); 14 });
15 });
16 15
17 rcc.ahb2rstr().modify(|w| { 16 rcc.ahb2rstr().modify(|w| {
18 w.set_gpiobrst(true); 17 w.set_gpiobrst(true);
19 w.set_gpiocrst(true); 18 w.set_gpiocrst(true);
20 w.set_gpiobrst(false); 19 w.set_gpiobrst(false);
21 w.set_gpiocrst(false); 20 w.set_gpiocrst(false);
22 }); 21 });
23 }
24 22
25 // Setup button 23 // Setup button
26 let gpioc = pac::GPIOC; 24 let gpioc = pac::GPIOC;
27 const BUTTON_PIN: usize = 13; 25 const BUTTON_PIN: usize = 13;
28 unsafe { 26 gpioc.pupdr().modify(|w| w.set_pupdr(BUTTON_PIN, vals::Pupdr::PULL_UP));
29 gpioc.pupdr().modify(|w| w.set_pupdr(BUTTON_PIN, vals::Pupdr::PULLUP)); 27 gpioc.otyper().modify(|w| w.set_ot(BUTTON_PIN, vals::Ot::PUSH_PULL));
30 gpioc.otyper().modify(|w| w.set_ot(BUTTON_PIN, vals::Ot::PUSHPULL)); 28 gpioc.moder().modify(|w| w.set_moder(BUTTON_PIN, vals::Moder::INPUT));
31 gpioc.moder().modify(|w| w.set_moder(BUTTON_PIN, vals::Moder::INPUT));
32 }
33 29
34 // Setup LED 30 // Setup LED
35 let gpiob = pac::GPIOB; 31 let gpiob = pac::GPIOB;
36 const LED_PIN: usize = 14; 32 const LED_PIN: usize = 14;
37 unsafe { 33 gpiob.pupdr().modify(|w| w.set_pupdr(LED_PIN, vals::Pupdr::FLOATING));
38 gpiob.pupdr().modify(|w| w.set_pupdr(LED_PIN, vals::Pupdr::FLOATING)); 34 gpiob.otyper().modify(|w| w.set_ot(LED_PIN, vals::Ot::PUSH_PULL));
39 gpiob.otyper().modify(|w| w.set_ot(LED_PIN, vals::Ot::PUSHPULL)); 35 gpiob.moder().modify(|w| w.set_moder(LED_PIN, vals::Moder::OUTPUT));
40 gpiob.moder().modify(|w| w.set_moder(LED_PIN, vals::Moder::OUTPUT));
41 }
42 36
43 // Main loop 37 // Main loop
44 loop { 38 loop {
45 unsafe { 39 if gpioc.idr().read().idr(BUTTON_PIN) == vals::Idr::LOW {
46 if gpioc.idr().read().idr(BUTTON_PIN) == vals::Idr::LOW { 40 gpiob.bsrr().write(|w| w.set_bs(LED_PIN, true));
47 gpiob.bsrr().write(|w| w.set_bs(LED_PIN, true)); 41 } else {
48 } else { 42 gpiob.bsrr().write(|w| w.set_br(LED_PIN, true));
49 gpiob.bsrr().write(|w| w.set_br(LED_PIN, true));
50 }
51 } 43 }
52 } 44 }
53} 45}
diff --git a/docs/examples/layer-by-layer/memory.x b/docs/examples/layer-by-layer/memory.x
new file mode 100644
index 000000000..69f5b28a1
--- /dev/null
+++ b/docs/examples/layer-by-layer/memory.x
@@ -0,0 +1,5 @@
1MEMORY
2{
3 FLASH : ORIGIN = 0x08000000, LENGTH = 2048K /* BANK_1 */
4 RAM : ORIGIN = 0x20000000, LENGTH = 640K /* SRAM */
5}