Skip to content

Commit 2aa2340

Browse files
Update Code Example on adc.rs
The External Trigger example currently uses an old stm32f4 API and doesn’t compile. This PR updates the example according to the latest API.
1 parent 23ef248 commit 2aa2340

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/adc.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -560,25 +560,22 @@ pub mod config {
560560
/// unsafe {
561561
/// let tim = &(*TIM1::ptr());
562562
///
563-
/// //This is pwm mode 1, the default mode is "frozen" which won't work
564-
/// let mode = 0b0110;
565-
///
566563
/// //Channel 1
567564
/// //Disable the channel before configuring it
568565
/// tim.ccer.modify(|_, w| w.cc1e().clear_bit());
569566
///
570-
/// tim.ccmr1_output.modify(|_, w| w
567+
/// tim.ccmr1_output().modify(|_, w| w
571568
/// //Preload enable for channel
572569
/// .oc1pe().set_bit()
573570
///
574-
/// //Set mode for channel
575-
/// .oc1m().bits(mode)
571+
/// //Set mode for channel, the default mode is "frozen" which won't work
572+
/// .oc1m().pwm_mode1()
576573
/// );
577574
///
578575
/// //Set the duty cycle, 0 won't work in pwm mode but might be ok in
579576
/// //toggle mode or match mode
580577
/// let max_duty = tim.arr.read().arr().bits() as u16;
581-
/// tim.ccr1.modify(|_, w| w.ccr1().bits(max_duty / 2));
578+
/// tim.ccr1.modify(|_, w| w.ccr().bits(max_duty / 2));
582579
///
583580
/// //Enable the channel
584581
/// tim.ccer.modify(|_, w| w.cc1e().set_bit());

0 commit comments

Comments
 (0)