``` // Set up the timer so the clocks are configured let mut latch_timer = hal::timer::Timer::tim2(p.TIM2, 250.khz(), clocks, &mut rcc.apb1); // Turn up the update interrupt latch_timer.listen(hal::timer::Event::TimeOut); // Get our raw timer back so we can configure PWM now that PSC (prescaler) // and ARR (auto-reload register) have been set for us. p.TIM2 = latch_timer.free(); // enable PWM output mode 1 (OC1M=7) with pre-load enabled on channel 1 p.TIM2 .ccmr1_output() .modify(|_r, w| unsafe { w.oc1m().bits(7).oc1pe().set_bit() }); // set up an output pulse of 5 clock cycles on channel 1 p.TIM2.ccr1.write(|w| unsafe { w.bits(5) }); // Enable the output p.TIM2.ccer.modify(|_, w| w.cc1e().set_bit()); // set auto-reload p.TIM2.cr1.modify(|_, w| w.arpe().set_bit()); // Initialise the registers p.TIM2.egr.write(|w| w.ug().set_bit()); // turn the timer back on p.TIM2.cr1.modify(|_, w| w.cen().set_bit()); ```