diff options
| author | Adam Greig <[email protected]> | 2023-07-22 12:45:18 +0100 |
|---|---|---|
| committer | Adam Greig <[email protected]> | 2023-07-22 12:57:49 +0100 |
| commit | c83552eadcf7546acf8bf4de47d7d9243ffe56d0 (patch) | |
| tree | 4a989b44c79ea49081c9c83f34e915f3d24576be /examples/stm32h7/src/bin | |
| parent | 4db63677f6e56c52ea3d432542513967f5d93c69 (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/stm32h7/src/bin')
| -rw-r--r-- | examples/stm32h7/src/bin/dac.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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 | } |
