diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-08-04 12:05:22 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-08-05 19:14:09 +0200 |
| commit | b1d631d63941e0bca49ec349147c041f04f3eafb (patch) | |
| tree | 73b763c20546b9c2b10ef45ec32ecf164855485b /examples | |
| parent | 0ea6a2d8905a146c8899239fe52e739404f13e7e (diff) | |
stm32/time: add Cargo features to choose tim2/tim3
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32f0/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32f4/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32h7/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32l0/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32l4/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32wb55/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32wb55/src/bin/blinky.rs | 16 |
7 files changed, 15 insertions, 13 deletions
diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml index cc2c3f2b7..c5730de80 100644 --- a/examples/stm32f0/Cargo.toml +++ b/examples/stm32f0/Cargo.toml | |||
| @@ -15,7 +15,7 @@ defmt-rtt = "0.2.0" | |||
| 15 | panic-probe = { version = "0.2.0" } | 15 | panic-probe = { version = "0.2.0" } |
| 16 | rtt-target = { version = "0.3", features = ["cortex-m"] } | 16 | rtt-target = { version = "0.3", features = ["cortex-m"] } |
| 17 | embassy = { path = "../../embassy", features = ["defmt"] } | 17 | embassy = { path = "../../embassy", features = ["defmt"] } |
| 18 | embassy-stm32 = { path = "../../embassy-stm32", features = ["defmt", "stm32f030f4"] } | 18 | embassy-stm32 = { path = "../../embassy-stm32", features = ["defmt", "stm32f030f4", "time-driver-tim3"] } |
| 19 | 19 | ||
| 20 | [features] | 20 | [features] |
| 21 | default = [ | 21 | default = [ |
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml index 84b1e30ee..c254573f8 100644 --- a/examples/stm32f4/Cargo.toml +++ b/examples/stm32f4/Cargo.toml | |||
| @@ -19,7 +19,7 @@ defmt-error = [] | |||
| 19 | [dependencies] | 19 | [dependencies] |
| 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } | 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } |
| 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } | 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } |
| 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi", "unstable-pac", "memory-x"] } | 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-tim2"] } |
| 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } | 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } |
| 24 | 24 | ||
| 25 | defmt = "0.2.0" | 25 | defmt = "0.2.0" |
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index 0868be75d..c7761ee85 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml | |||
| @@ -19,7 +19,7 @@ defmt-error = [] | |||
| 19 | [dependencies] | 19 | [dependencies] |
| 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } | 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } |
| 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } | 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } |
| 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32h743zi", "net", "memory-x"] } | 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32h743zi", "net", "memory-x", "time-driver-tim2"] } |
| 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } | 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } |
| 24 | embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt-debug", "defmt", "tcp", "medium-ethernet", "pool-16"] } | 24 | embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt-debug", "defmt", "tcp", "medium-ethernet", "pool-16"] } |
| 25 | stm32-metapac = { path = "../../stm32-metapac", features = ["stm32h743zi"] } | 25 | stm32-metapac = { path = "../../stm32-metapac", features = ["stm32h743zi"] } |
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml index 47d23d08f..6c594df66 100644 --- a/examples/stm32l0/Cargo.toml +++ b/examples/stm32l0/Cargo.toml | |||
| @@ -19,7 +19,7 @@ defmt-error = [] | |||
| 19 | [dependencies] | 19 | [dependencies] |
| 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } | 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } |
| 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } | 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } |
| 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32l072cz"] } | 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32l072cz", "time-driver-tim3"] } |
| 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } | 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } |
| 24 | 24 | ||
| 25 | defmt = "0.2.0" | 25 | defmt = "0.2.0" |
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index 8c6207676..3f6b34679 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml | |||
| @@ -19,7 +19,7 @@ defmt-error = [] | |||
| 19 | [dependencies] | 19 | [dependencies] |
| 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } | 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } |
| 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } | 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } |
| 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "unstable-pac", "stm32l4s5vi"] } | 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "unstable-pac", "stm32l4s5vi", "time-driver-tim2"] } |
| 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } | 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } |
| 24 | 24 | ||
| 25 | defmt = "0.2.0" | 25 | defmt = "0.2.0" |
diff --git a/examples/stm32wb55/Cargo.toml b/examples/stm32wb55/Cargo.toml index 4d6f7789c..ee2432cb2 100644 --- a/examples/stm32wb55/Cargo.toml +++ b/examples/stm32wb55/Cargo.toml | |||
| @@ -19,7 +19,7 @@ defmt-error = [] | |||
| 19 | [dependencies] | 19 | [dependencies] |
| 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } | 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } |
| 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } | 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } |
| 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32wb55cc"] } | 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32wb55cc", "time-driver-tim2"] } |
| 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } | 23 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } |
| 24 | 24 | ||
| 25 | defmt = "0.2.0" | 25 | defmt = "0.2.0" |
diff --git a/examples/stm32wb55/src/bin/blinky.rs b/examples/stm32wb55/src/bin/blinky.rs index 2eba361ae..5ffef9b38 100644 --- a/examples/stm32wb55/src/bin/blinky.rs +++ b/examples/stm32wb55/src/bin/blinky.rs | |||
| @@ -6,27 +6,29 @@ | |||
| 6 | 6 | ||
| 7 | #[path = "../example_common.rs"] | 7 | #[path = "../example_common.rs"] |
| 8 | mod example_common; | 8 | mod example_common; |
| 9 | use embassy::executor::Spawner; | ||
| 10 | use embassy::time::{Duration, Timer}; | ||
| 11 | use embassy_stm32::dbgmcu::Dbgmcu; | ||
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 13 | use embassy_stm32::Peripherals; | ||
| 10 | use embedded_hal::digital::v2::OutputPin; | 14 | use embedded_hal::digital::v2::OutputPin; |
| 11 | use example_common::*; | 15 | use example_common::*; |
| 12 | 16 | ||
| 13 | use cortex_m_rt::entry; | 17 | #[embassy::main] |
| 14 | 18 | async fn main(_spawner: Spawner, p: Peripherals) { | |
| 15 | #[entry] | ||
| 16 | fn main() -> ! { | ||
| 17 | info!("Hello World!"); | 19 | info!("Hello World!"); |
| 18 | 20 | ||
| 19 | let p = embassy_stm32::init(Default::default()); | 21 | unsafe { Dbgmcu::enable_all() }; |
| 20 | 22 | ||
| 21 | let mut led = Output::new(p.PB0, Level::High, Speed::Low); | 23 | let mut led = Output::new(p.PB0, Level::High, Speed::Low); |
| 22 | 24 | ||
| 23 | loop { | 25 | loop { |
| 24 | info!("high"); | 26 | info!("high"); |
| 25 | led.set_high().unwrap(); | 27 | led.set_high().unwrap(); |
| 26 | cortex_m::asm::delay(10_000_000); | 28 | Timer::after(Duration::from_millis(500)).await; |
| 27 | 29 | ||
| 28 | info!("low"); | 30 | info!("low"); |
| 29 | led.set_low().unwrap(); | 31 | led.set_low().unwrap(); |
| 30 | cortex_m::asm::delay(10_000_000); | 32 | Timer::after(Duration::from_millis(500)).await; |
| 31 | } | 33 | } |
| 32 | } | 34 | } |
