5.1.3.2.2. Functional Requirements for the Timer Module
The function must enable the timer clock. |
The function must configure the GPIO pin to its alternate function mode. |
The function must set the GPIO pin as an output to allow PWM generation. |
The function must clear the TIM_CCMR register bits. |
The function must enable the output compare mode. |
The function must enable preload mode. |
The function must calculate the timer period. |
The function must determine the prescaler value. |
The function must set the prescaler in the TIM_PSC register. |
The function must calculate the ARR value. |
The function must set the ARR value in the TIM_ARR register. |
The function must calculate the CCR value. |
The function must write the CCR value to the TIM_CCR register. |
The function must start the timer by setting the CEN bit in the TIM_CR1 register. |
The function must enable the output channel. |