aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/dac/mod.rs12
-rw-r--r--examples/stm32f4/Cargo.toml2
-rw-r--r--examples/stm32f4/src/bin/dac.rs2
-rw-r--r--examples/stm32h7/src/bin/dac.rs2
-rw-r--r--examples/stm32l4/src/bin/dac.rs2
5 files changed, 12 insertions, 8 deletions
diff --git a/embassy-stm32/src/dac/mod.rs b/embassy-stm32/src/dac/mod.rs
index 3d58914b3..0f3c5f630 100644
--- a/embassy-stm32/src/dac/mod.rs
+++ b/embassy-stm32/src/dac/mod.rs
@@ -216,8 +216,9 @@ impl<'d, T: Instance, Tx> DacCh1<'d, T, Tx> {
216 pub fn new( 216 pub fn new(
217 peri: impl Peripheral<P = T> + 'd, 217 peri: impl Peripheral<P = T> + 'd,
218 dma: impl Peripheral<P = Tx> + 'd, 218 dma: impl Peripheral<P = Tx> + 'd,
219 _pin: impl Peripheral<P = impl DacPin<T, 1>> + 'd, 219 pin: impl Peripheral<P = impl DacPin<T, 1>> + crate::gpio::sealed::Pin + 'd,
220 ) -> Self { 220 ) -> Self {
221 pin.set_as_analog();
221 into_ref!(peri, dma); 222 into_ref!(peri, dma);
222 T::enable(); 223 T::enable();
223 T::reset(); 224 T::reset();
@@ -327,8 +328,9 @@ impl<'d, T: Instance, Tx> DacCh2<'d, T, Tx> {
327 pub fn new( 328 pub fn new(
328 _peri: impl Peripheral<P = T> + 'd, 329 _peri: impl Peripheral<P = T> + 'd,
329 dma: impl Peripheral<P = Tx> + 'd, 330 dma: impl Peripheral<P = Tx> + 'd,
330 _pin: impl Peripheral<P = impl DacPin<T, 2>> + 'd, 331 pin: impl Peripheral<P = impl DacPin<T, 2>> + crate::gpio::sealed::Pin + 'd,
331 ) -> Self { 332 ) -> Self {
333 pin.set_as_analog();
332 into_ref!(_peri, dma); 334 into_ref!(_peri, dma);
333 T::enable(); 335 T::enable();
334 T::reset(); 336 T::reset();
@@ -442,9 +444,11 @@ impl<'d, T: Instance, TxCh1, TxCh2> Dac<'d, T, TxCh1, TxCh2> {
442 peri: impl Peripheral<P = T> + 'd, 444 peri: impl Peripheral<P = T> + 'd,
443 dma_ch1: impl Peripheral<P = TxCh1> + 'd, 445 dma_ch1: impl Peripheral<P = TxCh1> + 'd,
444 dma_ch2: impl Peripheral<P = TxCh2> + 'd, 446 dma_ch2: impl Peripheral<P = TxCh2> + 'd,
445 _pin_ch1: impl Peripheral<P = impl DacPin<T, 1>> + 'd, 447 pin_ch1: impl Peripheral<P = impl DacPin<T, 1>> + crate::gpio::sealed::Pin + 'd,
446 _pin_ch2: impl Peripheral<P = impl DacPin<T, 2>> + 'd, 448 pin_ch2: impl Peripheral<P = impl DacPin<T, 2>> + crate::gpio::sealed::Pin + 'd,
447 ) -> Self { 449 ) -> Self {
450 pin_ch1.set_as_analog();
451 pin_ch2.set_as_analog();
448 into_ref!(peri, dma_ch1, dma_ch2); 452 into_ref!(peri, dma_ch1, dma_ch2);
449 T::enable(); 453 T::enable();
450 T::reset(); 454 T::reset();
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.
9embassy-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"] } 9embassy-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"] }
10embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-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"] } 11embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] } 12embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] }
13embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } 13embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
14embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] } 14embassy-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}