diff options
| author | Bob McWhirter <[email protected]> | 2021-05-06 09:20:09 -0400 |
|---|---|---|
| committer | Bob McWhirter <[email protected]> | 2021-05-06 09:20:20 -0400 |
| commit | 1eb70a7e5d8157041e28caf2c176ac4dde78e4c2 (patch) | |
| tree | 2f9628bceb63f88a007e28e9f6c826950b84d514 | |
| parent | 386e4bf0de6369a3338f56877a779e1e05b4dcc2 (diff) | |
Checkpoint.
| -rw-r--r-- | embassy-stm32-examples/.cargo/config | 8 | ||||
| -rw-r--r-- | embassy-stm32-examples/Cargo.toml | 6 | ||||
| -rw-r--r-- | embassy-stm32-examples/src/bin/blinky.rs | 23 | ||||
| -rw-r--r-- | embassy-stm32-examples/src/bin/button_exti.rs | 24 |
4 files changed, 35 insertions, 26 deletions
diff --git a/embassy-stm32-examples/.cargo/config b/embassy-stm32-examples/.cargo/config index 7c1d4dfb6..8713fbae9 100644 --- a/embassy-stm32-examples/.cargo/config +++ b/embassy-stm32-examples/.cargo/config | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] |
| 2 | runner = "probe-run --chip STM32F401CCUx" | 2 | #runner = "probe-run --chip STM32F401CCUx" |
| 3 | #runner = "probe-run --chip STM32L4S5VITx" | ||
| 4 | #runner = "probe-run --chip ${PROBE_RUN_CHIP}" | ||
| 5 | runner = "probe-run" | ||
| 3 | 6 | ||
| 4 | rustflags = [ | 7 | rustflags = [ |
| 5 | # LLD (shipped with the Rust toolchain) is used as the default linker | 8 | # LLD (shipped with the Rust toolchain) is used as the default linker |
| @@ -25,4 +28,5 @@ rustflags = [ | |||
| 25 | ] | 28 | ] |
| 26 | 29 | ||
| 27 | [build] | 30 | [build] |
| 28 | target = "thumbv7em-none-eabihf" | 31 | #target = "thumbv7em-none-eabihf" |
| 32 | target = "thumbv7em-none-eabi" | ||
diff --git a/embassy-stm32-examples/Cargo.toml b/embassy-stm32-examples/Cargo.toml index ab6fc6c14..dbc537381 100644 --- a/embassy-stm32-examples/Cargo.toml +++ b/embassy-stm32-examples/Cargo.toml | |||
| @@ -18,9 +18,11 @@ defmt-error = [] | |||
| 18 | [dependencies] | 18 | [dependencies] |
| 19 | embassy = { version = "0.1.0", path = "../embassy", features = ["defmt", "defmt-trace"] } | 19 | embassy = { version = "0.1.0", path = "../embassy", features = ["defmt", "defmt-trace"] } |
| 20 | embassy-traits = { version = "0.1.0", path = "../embassy-traits", features = ["defmt"] } | 20 | embassy-traits = { version = "0.1.0", path = "../embassy-traits", features = ["defmt"] } |
| 21 | embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi"] } | 21 | #embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi"] } |
| 22 | embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32l4s5vi"] } | ||
| 22 | embassy-extras = {version = "0.1.0", path = "../embassy-extras" } | 23 | embassy-extras = {version = "0.1.0", path = "../embassy-extras" } |
| 23 | stm32f4 = { version = "0.13", features = ["stm32f429"] } | 24 | #stm32f4 = { version = "0.13", features = ["stm32f429"] } |
| 25 | stm32l4 = { version = "0.13", features = ["stm32l4x5" ] } | ||
| 24 | 26 | ||
| 25 | defmt = "0.2.0" | 27 | defmt = "0.2.0" |
| 26 | defmt-rtt = "0.2.0" | 28 | defmt-rtt = "0.2.0" |
diff --git a/embassy-stm32-examples/src/bin/blinky.rs b/embassy-stm32-examples/src/bin/blinky.rs index 9ccd6c01e..deee52368 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; | |||
| 12 | use example_common::*; | 12 | use example_common::*; |
| 13 | 13 | ||
| 14 | use cortex_m_rt::entry; | 14 | use cortex_m_rt::entry; |
| 15 | use stm32f4::stm32f429 as pac; | 15 | //use stm32f4::stm32f429 as pac; |
| 16 | use stm32l4::stm32l4x5 as pac; | ||
| 16 | 17 | ||
| 17 | #[entry] | 18 | #[entry] |
| 18 | fn main() -> ! { | 19 | fn main() -> ! { |
| @@ -25,21 +26,21 @@ fn main() -> ! { | |||
| 25 | w.dbg_standby().set_bit(); | 26 | w.dbg_standby().set_bit(); |
| 26 | w.dbg_stop().set_bit() | 27 | w.dbg_stop().set_bit() |
| 27 | }); | 28 | }); |
| 28 | pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); | 29 | pp.RCC.ahb1enr.modify(|_, w| w.dma1en().set_bit()); |
| 29 | 30 | ||
| 30 | pp.RCC.ahb1enr.modify(|_, w| { | 31 | pp.RCC.ahb2enr.modify(|_, w| { |
| 31 | w.gpioaen().enabled(); | 32 | w.gpioaen().set_bit(); |
| 32 | w.gpioben().enabled(); | 33 | w.gpioben().set_bit(); |
| 33 | w.gpiocen().enabled(); | 34 | w.gpiocen().set_bit(); |
| 34 | w.gpioden().enabled(); | 35 | w.gpioden().set_bit(); |
| 35 | w.gpioeen().enabled(); | 36 | w.gpioeen().set_bit(); |
| 36 | w.gpiofen().enabled(); | 37 | w.gpiofen().set_bit(); |
| 37 | w | 38 | w |
| 38 | }); | 39 | }); |
| 39 | 40 | ||
| 40 | let p = embassy_stm32::init(Default::default()); | 41 | let p = embassy_stm32::init(Default::default()); |
| 41 | 42 | ||
| 42 | let mut led = Output::new(p.PB7, Level::High); | 43 | let mut led = Output::new(p.PA5, Level::High); |
| 43 | 44 | ||
| 44 | loop { | 45 | loop { |
| 45 | info!("high"); | 46 | info!("high"); |
diff --git a/embassy-stm32-examples/src/bin/button_exti.rs b/embassy-stm32-examples/src/bin/button_exti.rs index d6f545fa4..6b7acdca0 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}; | |||
| 16 | use example_common::*; | 16 | use example_common::*; |
| 17 | 17 | ||
| 18 | use cortex_m_rt::entry; | 18 | use cortex_m_rt::entry; |
| 19 | use stm32f4::stm32f429 as pac; | 19 | //use stm32f4::stm32f429 as pac; |
| 20 | use stm32l4::stm32l4x5 as pac; | ||
| 20 | 21 | ||
| 21 | #[embassy::task] | 22 | #[embassy::task] |
| 22 | async fn main_task() { | 23 | async fn main_task() { |
| @@ -56,19 +57,20 @@ fn main() -> ! { | |||
| 56 | w.dbg_standby().set_bit(); | 57 | w.dbg_standby().set_bit(); |
| 57 | w.dbg_stop().set_bit() | 58 | w.dbg_stop().set_bit() |
| 58 | }); | 59 | }); |
| 59 | pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); | 60 | |
| 60 | 61 | pp.RCC.ahb1enr.modify(|_, w| w.dma1en().set_bit()); | |
| 61 | pp.RCC.ahb1enr.modify(|_, w| { | 62 | |
| 62 | w.gpioaen().enabled(); | 63 | pp.RCC.ahb2enr.modify(|_, w| { |
| 63 | w.gpioben().enabled(); | 64 | w.gpioaen().set_bit(); |
| 64 | w.gpiocen().enabled(); | 65 | w.gpioben().set_bit(); |
| 65 | w.gpioden().enabled(); | 66 | w.gpiocen().set_bit(); |
| 66 | w.gpioeen().enabled(); | 67 | w.gpioden().set_bit(); |
| 67 | w.gpiofen().enabled(); | 68 | w.gpioeen().set_bit(); |
| 69 | w.gpiofen().set_bit(); | ||
| 68 | w | 70 | w |
| 69 | }); | 71 | }); |
| 70 | pp.RCC.apb2enr.modify(|_, w| { | 72 | pp.RCC.apb2enr.modify(|_, w| { |
| 71 | w.syscfgen().enabled(); | 73 | w.syscfgen().set_bit(); |
| 72 | w | 74 | w |
| 73 | }); | 75 | }); |
| 74 | 76 | ||
