aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l4/src/bin/dac.rs
diff options
context:
space:
mode:
authorAdam Greig <[email protected]>2023-07-22 12:45:18 +0100
committerAdam Greig <[email protected]>2023-07-22 12:57:49 +0100
commitc83552eadcf7546acf8bf4de47d7d9243ffe56d0 (patch)
tree4a989b44c79ea49081c9c83f34e915f3d24576be /examples/stm32l4/src/bin/dac.rs
parent4db63677f6e56c52ea3d432542513967f5d93c69 (diff)
stm32: fix DAC examples
The DAC driver defaults to enabling the channel trigger, but leaves it at the default value of TIM6 TRGO, then performs a software trigger after writing the new output value. We could change the trigger selection to software trigger, but for this example it's simpler to just disable the trigger.
Diffstat (limited to 'examples/stm32l4/src/bin/dac.rs')
-rw-r--r--examples/stm32l4/src/bin/dac.rs2
1 files changed, 1 insertions, 1 deletions
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}