aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f4/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/stm32f4/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/stm32f4/src/bin/dac.rs')
-rw-r--r--examples/stm32f4/src/bin/dac.rs2
1 files changed, 1 insertions, 1 deletions
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}