diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-07-24 14:18:37 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-24 14:18:37 +0000 |
| commit | 7fc138c91e0db51dc4afb3cd2610dcb72cd92d71 (patch) | |
| tree | 08fa8375f8588c8dc46dec78486cfc5900316954 /examples | |
| parent | 18b9b6c780b46165ead1de59ce258bd78786bdcb (diff) | |
| parent | 224fbc8125de73e08c0fe03df6d3980001f77c7f (diff) | |
Merge pull request #1676 from adamgreig/fix-dac-example
stm32: Fix DAC examples
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32f4/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/dac.rs | 2 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/dac.rs | 2 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/dac.rs | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml index e1ef40f92..fdd3b7d4f 100644 --- a/examples/stm32f4/Cargo.toml +++ b/examples/stm32f4/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | # Change stm32f429zi to your chip name, if necessary. | 8 | # Change stm32f429zi to your chip name, if necessary. |
| 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "unstable-traits", "defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti", "embedded-sdmmc", "chrono"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "unstable-traits", "defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti", "embedded-sdmmc", "chrono"] } |
| 10 | embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers", "arch-cortex-m", "executor-thread", "executor-interrupt"] } | 11 | embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } |
| 12 | embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] } | 12 | embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] } |
| 13 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 13 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 14 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] } | 14 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] } |
diff --git a/examples/stm32f4/src/bin/dac.rs b/examples/stm32f4/src/bin/dac.rs index 3a6216712..aaedcfecc 100644 --- a/examples/stm32f4/src/bin/dac.rs +++ b/examples/stm32f4/src/bin/dac.rs | |||
| @@ -14,11 +14,11 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 14 | info!("Hello World, dude!"); | 14 | info!("Hello World, dude!"); |
| 15 | 15 | ||
| 16 | let mut dac = DacCh1::new(p.DAC, NoDma, p.PA4); | 16 | let mut dac = DacCh1::new(p.DAC, NoDma, p.PA4); |
| 17 | unwrap!(dac.set_trigger_enable(false)); | ||
| 17 | 18 | ||
| 18 | loop { | 19 | loop { |
| 19 | for v in 0..=255 { | 20 | for v in 0..=255 { |
| 20 | unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); | 21 | unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); |
| 21 | dac.trigger(); | ||
| 22 | } | 22 | } |
| 23 | } | 23 | } |
| 24 | } | 24 | } |
diff --git a/examples/stm32h7/src/bin/dac.rs b/examples/stm32h7/src/bin/dac.rs index 586b4154b..ee078286b 100644 --- a/examples/stm32h7/src/bin/dac.rs +++ b/examples/stm32h7/src/bin/dac.rs | |||
| @@ -21,11 +21,11 @@ fn main() -> ! { | |||
| 21 | let p = embassy_stm32::init(config); | 21 | let p = embassy_stm32::init(config); |
| 22 | 22 | ||
| 23 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); | 23 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); |
| 24 | unwrap!(dac.set_trigger_enable(false)); | ||
| 24 | 25 | ||
| 25 | loop { | 26 | loop { |
| 26 | for v in 0..=255 { | 27 | for v in 0..=255 { |
| 27 | unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); | 28 | unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); |
| 28 | dac.trigger(); | ||
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | } | 31 | } |
diff --git a/examples/stm32l4/src/bin/dac.rs b/examples/stm32l4/src/bin/dac.rs index ade43eb35..0193a248e 100644 --- a/examples/stm32l4/src/bin/dac.rs +++ b/examples/stm32l4/src/bin/dac.rs | |||
| @@ -13,11 +13,11 @@ fn main() -> ! { | |||
| 13 | info!("Hello World!"); | 13 | info!("Hello World!"); |
| 14 | 14 | ||
| 15 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); | 15 | let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); |
| 16 | unwrap!(dac.set_trigger_enable(false)); | ||
| 16 | 17 | ||
| 17 | loop { | 18 | loop { |
| 18 | for v in 0..=255 { | 19 | for v in 0..=255 { |
| 19 | unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); | 20 | unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); |
| 20 | dac.trigger(); | ||
| 21 | } | 21 | } |
| 22 | } | 22 | } |
| 23 | } | 23 | } |
