Skip to content

Commit 944985b

Browse files
committed
HRTIM: adc-trigger example set duty
1 parent 1626954 commit 944985b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/hrtim/adc-trigger.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,20 @@ fn main() -> ! {
8787
//out1 | | | |
8888
// | | | |
8989
// -------- ---------- --------
90+
// . ^ ^
91+
// . | |
92+
//AD samlp pa0 temp
9093
let period = 0xFFFF;
9194
let (hr_control, ..) = dp.HRTIM_COMMON.hr_control(&mut rcc).wait_for_calibration();
9295
let mut hr_control = hr_control.constrain();
93-
let (mut timer, (cr1, _cr2, mut cr3, mut cr4), (mut out1, mut out2)) = dp
96+
let (mut timer, (mut cr1, _cr2, mut cr3, mut cr4), (mut out1, mut out2)) = dp
9497
.HRTIM_TIMA
9598
.pwm_advanced((pin_a, pin_b), &mut rcc)
9699
.prescaler(prescaler)
97100
.period(period)
98101
.finalize(&mut hr_control);
99102

103+
cr1.set_duty(period / 2);
100104
cr3.set_duty(period / 3);
101105
cr4.set_duty((2 * u32::from(period) / 3) as u16);
102106

0 commit comments

Comments
 (0)