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.
This commit is contained in:
Adam Greig 2023-07-22 12:45:18 +01:00
parent 4db63677f6
commit c83552eadc
No known key found for this signature in database
GPG Key ID: 8B3FE5477B1DD9A0
3 changed files with 3 additions and 3 deletions

View File

@ -14,11 +14,11 @@ async fn main(_spawner: Spawner) -> ! {
info!("Hello World, dude!"); info!("Hello World, dude!");
let mut dac = DacCh1::new(p.DAC, NoDma, p.PA4); let mut dac = DacCh1::new(p.DAC, NoDma, p.PA4);
unwrap!(dac.set_trigger_enable(false));
loop { loop {
for v in 0..=255 { for v in 0..=255 {
unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); unwrap!(dac.set(Value::Bit8(to_sine_wave(v))));
dac.trigger();
} }
} }
} }

View File

@ -21,11 +21,11 @@ fn main() -> ! {
let p = embassy_stm32::init(config); let p = embassy_stm32::init(config);
let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4);
unwrap!(dac.set_trigger_enable(false));
loop { loop {
for v in 0..=255 { for v in 0..=255 {
unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); unwrap!(dac.set(Value::Bit8(to_sine_wave(v))));
dac.trigger();
} }
} }
} }

View File

@ -13,11 +13,11 @@ fn main() -> ! {
info!("Hello World!"); info!("Hello World!");
let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4); let mut dac = DacCh1::new(p.DAC1, NoDma, p.PA4);
unwrap!(dac.set_trigger_enable(false));
loop { loop {
for v in 0..=255 { for v in 0..=255 {
unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); unwrap!(dac.set(Value::Bit8(to_sine_wave(v))));
dac.trigger();
} }
} }
} }