From 1eb70a7e5d8157041e28caf2c176ac4dde78e4c2 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Thu, 6 May 2021 09:20:09 -0400 Subject: [PATCH] Checkpoint. --- embassy-stm32-examples/.cargo/config | 8 +++++-- embassy-stm32-examples/Cargo.toml | 6 +++-- embassy-stm32-examples/src/bin/blinky.rs | 21 +++++++++--------- embassy-stm32-examples/src/bin/button_exti.rs | 22 ++++++++++--------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/embassy-stm32-examples/.cargo/config b/embassy-stm32-examples/.cargo/config index 7c1d4dfb..8713fbae 100644 --- a/embassy-stm32-examples/.cargo/config +++ b/embassy-stm32-examples/.cargo/config @@ -1,5 +1,8 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -runner = "probe-run --chip STM32F401CCUx" +#runner = "probe-run --chip STM32F401CCUx" +#runner = "probe-run --chip STM32L4S5VITx" +#runner = "probe-run --chip ${PROBE_RUN_CHIP}" +runner = "probe-run" rustflags = [ # LLD (shipped with the Rust toolchain) is used as the default linker @@ -25,4 +28,5 @@ rustflags = [ ] [build] -target = "thumbv7em-none-eabihf" +#target = "thumbv7em-none-eabihf" +target = "thumbv7em-none-eabi" diff --git a/embassy-stm32-examples/Cargo.toml b/embassy-stm32-examples/Cargo.toml index ab6fc6c1..dbc53738 100644 --- a/embassy-stm32-examples/Cargo.toml +++ b/embassy-stm32-examples/Cargo.toml @@ -18,9 +18,11 @@ defmt-error = [] [dependencies] embassy = { version = "0.1.0", path = "../embassy", features = ["defmt", "defmt-trace"] } embassy-traits = { version = "0.1.0", path = "../embassy-traits", features = ["defmt"] } -embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi"] } +#embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi"] } +embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32l4s5vi"] } embassy-extras = {version = "0.1.0", path = "../embassy-extras" } -stm32f4 = { version = "0.13", features = ["stm32f429"] } +#stm32f4 = { version = "0.13", features = ["stm32f429"] } +stm32l4 = { version = "0.13", features = ["stm32l4x5" ] } defmt = "0.2.0" defmt-rtt = "0.2.0" diff --git a/embassy-stm32-examples/src/bin/blinky.rs b/embassy-stm32-examples/src/bin/blinky.rs index 9ccd6c01..deee5236 100644 --- a/embassy-stm32-examples/src/bin/blinky.rs +++ b/embassy-stm32-examples/src/bin/blinky.rs @@ -12,7 +12,8 @@ use embedded_hal::digital::v2::OutputPin; use example_common::*; use cortex_m_rt::entry; -use stm32f4::stm32f429 as pac; +//use stm32f4::stm32f429 as pac; +use stm32l4::stm32l4x5 as pac; #[entry] fn main() -> ! { @@ -25,21 +26,21 @@ fn main() -> ! { w.dbg_standby().set_bit(); w.dbg_stop().set_bit() }); - pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); + pp.RCC.ahb1enr.modify(|_, w| w.dma1en().set_bit()); - pp.RCC.ahb1enr.modify(|_, w| { - w.gpioaen().enabled(); - w.gpioben().enabled(); - w.gpiocen().enabled(); - w.gpioden().enabled(); - w.gpioeen().enabled(); - w.gpiofen().enabled(); + pp.RCC.ahb2enr.modify(|_, w| { + w.gpioaen().set_bit(); + w.gpioben().set_bit(); + w.gpiocen().set_bit(); + w.gpioden().set_bit(); + w.gpioeen().set_bit(); + w.gpiofen().set_bit(); w }); let p = embassy_stm32::init(Default::default()); - let mut led = Output::new(p.PB7, Level::High); + let mut led = Output::new(p.PA5, Level::High); loop { info!("high"); diff --git a/embassy-stm32-examples/src/bin/button_exti.rs b/embassy-stm32-examples/src/bin/button_exti.rs index d6f545fa..6b7acdca 100644 --- a/embassy-stm32-examples/src/bin/button_exti.rs +++ b/embassy-stm32-examples/src/bin/button_exti.rs @@ -16,7 +16,8 @@ use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; use example_common::*; use cortex_m_rt::entry; -use stm32f4::stm32f429 as pac; +//use stm32f4::stm32f429 as pac; +use stm32l4::stm32l4x5 as pac; #[embassy::task] async fn main_task() { @@ -56,19 +57,20 @@ fn main() -> ! { w.dbg_standby().set_bit(); w.dbg_stop().set_bit() }); - pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); - pp.RCC.ahb1enr.modify(|_, w| { - w.gpioaen().enabled(); - w.gpioben().enabled(); - w.gpiocen().enabled(); - w.gpioden().enabled(); - w.gpioeen().enabled(); - w.gpiofen().enabled(); + pp.RCC.ahb1enr.modify(|_, w| w.dma1en().set_bit()); + + pp.RCC.ahb2enr.modify(|_, w| { + w.gpioaen().set_bit(); + w.gpioben().set_bit(); + w.gpiocen().set_bit(); + w.gpioden().set_bit(); + w.gpioeen().set_bit(); + w.gpiofen().set_bit(); w }); pp.RCC.apb2enr.modify(|_, w| { - w.syscfgen().enabled(); + w.syscfgen().set_bit(); w });