// for channel 1 and 2, let CCxS stay 00 (output), set OCxM to 110 (PWM I)
// enabling preload causes the new pulse width in compare capture register only to come into effect when UG bit in SWEVGR is set (= initiate update) (auto-clears)
TIM2->CHCTLR1|=TIM_OC1M_2|TIM_OC1M_1|TIM_OC1PE;
TIM2->CHCTLR1|=TIM_OC2M_2|TIM_OC2M_1|TIM_OC2PE;
// CTLR1: default is up, events generated, edge align