/* Initializes the tim Channel3 according to the specified parameters in the init_struct.  */
void TIM_OC3Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct)
/* Initializes the tim Channel3 according to the specified parameters in the init_struct.  */
void TIM_OC3Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct)
{
    MODIFY_REG(tim->CCMR2, TIM_CCMR2_OC3M, init_struct->TIM_OCMode);
    MODIFY_REG(tim->CCER, TIM_CCER_CC3EN | TIM_CCER_CC3P, \
               (init_struct->TIM_OCPolarity << 8) | (init_struct->TIM_OutputState << 8));
    WRITE_REG(tim->CCR3, init_struct->TIM_Pulse);
    if ((tim == TIM1) || (tim == TIM8)) {
        MODIFY_REG(tim->CCER, TIM_CCER_CC3NP | TIM_CCER_CC3NEN, \
                   (init_struct->TIM_OCNPolarity << 8) | (init_struct->TIM_OutputNState << 8));
        MODIFY_REG(tim->CR2, TIM_CR2_OIS3 | TIM_CR2_OIS3N, \
                   (init_struct->TIM_OCIdleState << 4) | (init_struct->TIM_OCNIdleState << 4));
    }
}