diff options
Diffstat (limited to 'docs/modules/ROOT/examples/layer-by-layer')
6 files changed, 18 insertions, 19 deletions
diff --git a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml index 9048d9302..943249a17 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml +++ b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml | |||
| @@ -10,7 +10,6 @@ members = [ | |||
| 10 | [patch.crates-io] | 10 | [patch.crates-io] |
| 11 | embassy-executor = { path = "../../../../../embassy-executor" } | 11 | embassy-executor = { path = "../../../../../embassy-executor" } |
| 12 | embassy-stm32 = { path = "../../../../../embassy-stm32" } | 12 | embassy-stm32 = { path = "../../../../../embassy-stm32" } |
| 13 | stm32-metapac = { path = "../../../../../stm32-metapac" } | ||
| 14 | 13 | ||
| 15 | [profile.release] | 14 | [profile.release] |
| 16 | codegen-units = 1 | 15 | codegen-units = 1 |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml index e2933076f..a7236ed5e 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml | |||
| @@ -2,12 +2,13 @@ | |||
| 2 | name = "blinky-async" | 2 | name = "blinky-async" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | license = "MIT OR Apache-2.0" | ||
| 5 | 6 | ||
| 6 | [dependencies] | 7 | [dependencies] |
| 7 | cortex-m = "0.7" | 8 | cortex-m = "0.7" |
| 8 | cortex-m-rt = "0.7" | 9 | cortex-m-rt = "0.7" |
| 9 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"], default-features = false } | 10 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] } |
| 10 | embassy-executor = { version = "0.1.0", default-features = false, features = ["nightly"] } | 11 | embassy-executor = { version = "0.2.0", features = ["nightly", "arch-cortex-m", "executor-thread"] } |
| 11 | 12 | ||
| 12 | defmt = "0.3.0" | 13 | defmt = "0.3.0" |
| 13 | defmt-rtt = "0.3.0" | 14 | defmt-rtt = "0.3.0" |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml index dbd3aba8b..c15de2db2 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml | |||
| @@ -2,11 +2,12 @@ | |||
| 2 | name = "blinky-hal" | 2 | name = "blinky-hal" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | license = "MIT OR Apache-2.0" | ||
| 5 | 6 | ||
| 6 | [dependencies] | 7 | [dependencies] |
| 7 | cortex-m = "0.7" | 8 | cortex-m = "0.7" |
| 8 | cortex-m-rt = "0.7" | 9 | cortex-m-rt = "0.7" |
| 9 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"], default-features = false } | 10 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] } |
| 10 | 11 | ||
| 11 | defmt = "0.3.0" | 12 | defmt = "0.3.0" |
| 12 | defmt-rtt = "0.3.0" | 13 | defmt-rtt = "0.3.0" |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml index 0dd326015..9733658b6 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | name = "blinky-irq" | 2 | name = "blinky-irq" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | license = "MIT OR Apache-2.0" | ||
| 5 | 6 | ||
| 6 | [dependencies] | 7 | [dependencies] |
| 7 | cortex-m = "0.7" | 8 | cortex-m = "0.7" |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs index 743d0c342..aecba0755 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs | |||
| @@ -20,13 +20,13 @@ fn main() -> ! { | |||
| 20 | let led = Output::new(p.PB14, Level::Low, Speed::Low); | 20 | let led = Output::new(p.PB14, Level::Low, Speed::Low); |
| 21 | let mut button = Input::new(p.PC13, Pull::Up); | 21 | let mut button = Input::new(p.PC13, Pull::Up); |
| 22 | 22 | ||
| 23 | cortex_m::interrupt::free(|cs| unsafe { | 23 | cortex_m::interrupt::free(|cs| { |
| 24 | enable_interrupt(&mut button); | 24 | enable_interrupt(&mut button); |
| 25 | 25 | ||
| 26 | LED.borrow(cs).borrow_mut().replace(led); | 26 | LED.borrow(cs).borrow_mut().replace(led); |
| 27 | BUTTON.borrow(cs).borrow_mut().replace(button); | 27 | BUTTON.borrow(cs).borrow_mut().replace(button); |
| 28 | 28 | ||
| 29 | NVIC::unmask(pac::Interrupt::EXTI15_10); | 29 | unsafe { NVIC::unmask(pac::Interrupt::EXTI15_10) }; |
| 30 | }); | 30 | }); |
| 31 | 31 | ||
| 32 | loop { | 32 | loop { |
| @@ -64,25 +64,21 @@ const PORT: u8 = 2; | |||
| 64 | const PIN: usize = 13; | 64 | const PIN: usize = 13; |
| 65 | fn check_interrupt<P: Pin>(_pin: &mut Input<'static, P>) -> bool { | 65 | fn check_interrupt<P: Pin>(_pin: &mut Input<'static, P>) -> bool { |
| 66 | let exti = pac::EXTI; | 66 | let exti = pac::EXTI; |
| 67 | unsafe { | 67 | let pin = PIN; |
| 68 | let pin = PIN; | 68 | let lines = exti.pr(0).read(); |
| 69 | let lines = exti.pr(0).read(); | 69 | lines.line(pin) |
| 70 | lines.line(pin) | ||
| 71 | } | ||
| 72 | } | 70 | } |
| 73 | 71 | ||
| 74 | fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { | 72 | fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { |
| 75 | let exti = pac::EXTI; | 73 | let exti = pac::EXTI; |
| 76 | unsafe { | 74 | let pin = PIN; |
| 77 | let pin = PIN; | 75 | let mut lines = exti.pr(0).read(); |
| 78 | let mut lines = exti.pr(0).read(); | 76 | lines.set_line(pin, true); |
| 79 | lines.set_line(pin, true); | 77 | exti.pr(0).write_value(lines); |
| 80 | exti.pr(0).write_value(lines); | ||
| 81 | } | ||
| 82 | } | 78 | } |
| 83 | 79 | ||
| 84 | fn enable_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { | 80 | fn enable_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { |
| 85 | cortex_m::interrupt::free(|_| unsafe { | 81 | cortex_m::interrupt::free(|_| { |
| 86 | let rcc = pac::RCC; | 82 | let rcc = pac::RCC; |
| 87 | rcc.apb2enr().modify(|w| w.set_syscfgen(true)); | 83 | rcc.apb2enr().modify(|w| w.set_syscfgen(true)); |
| 88 | 84 | ||
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml index e7f4f5d1f..f872b94cb 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml | |||
| @@ -2,11 +2,12 @@ | |||
| 2 | name = "blinky-pac" | 2 | name = "blinky-pac" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | license = "MIT OR Apache-2.0" | ||
| 5 | 6 | ||
| 6 | [dependencies] | 7 | [dependencies] |
| 7 | cortex-m = "0.7" | 8 | cortex-m = "0.7" |
| 8 | cortex-m-rt = "0.7" | 9 | cortex-m-rt = "0.7" |
| 9 | stm32-metapac = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] } | 10 | stm32-metapac = { version = "1", features = ["stm32l475vg", "memory-x"] } |
| 10 | 11 | ||
| 11 | defmt = "0.3.0" | 12 | defmt = "0.3.0" |
| 12 | defmt-rtt = "0.3.0" | 13 | defmt-rtt = "0.3.0" |
