FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/ST_Code/Libraries/STM32L1xx_StdPeriph_Driver/src/stm32l1xx_tim.c
/**
  * @brief  Specifies the TIMx Counter Mode to be used.
  * @param  TIMx: where x can be 2, 3, 4 or 5 to select the TIM peripheral.
  * @param  TIM_CounterMode: specifies the Counter Mode to be used
  *   This parameter can be one of the following values:
  *     @arg TIM_CounterMode_Up: TIM Up Counting Mode.
  *     @arg TIM_CounterMode_Down: TIM Down Counting Mode.
  *     @arg TIM_CounterMode_CenterAligned1: TIM Center Aligned Mode1.
  *     @arg TIM_CounterMode_CenterAligned2: TIM Center Aligned Mode2.
  *     @arg TIM_CounterMode_CenterAligned3: TIM Center Aligned Mode3.
  * @retval None
  */
@brief  Specifies the TIMx Counter Mode to be used.
@param  TIMx: where x can be 2, 3, 4 or 5 to select the TIM peripheral.
@param  TIM_CounterMode: specifies the Counter Mode to be used
This parameter can be one of the following values:
@arg TIM_CounterMode_Up: TIM Up Counting Mode.
@arg TIM_CounterMode_Down: TIM Down Counting Mode.
@arg TIM_CounterMode_CenterAligned1: TIM Center Aligned Mode1.
@arg TIM_CounterMode_CenterAligned2: TIM Center Aligned Mode2.
@arg TIM_CounterMode_CenterAligned3: TIM Center Aligned Mode3.
@retval None
@brief Specifies the TIMx Counter Mode to be used . @param TIMx : where x can be 2 3 4 or 5 to select the TIM peripheral . @param TIM_CounterMode : specifies the Counter Mode to be used This parameter can be one of the following values : @arg TIM_CounterMode_Up : TIM Up Counting Mode . @arg TIM_CounterMode_Down : TIM Down Counting Mode . @arg TIM_CounterMode_CenterAligned1 : TIM Center Aligned Mode1 . @arg TIM_CounterMode_CenterAligned2 : TIM Center Aligned Mode2 . @arg TIM_CounterMode_CenterAligned3 : TIM Center Aligned Mode3 . @retval None
void TIM_CounterModeConfig(TIM_TypeDef* TIMx, uint16_t TIM_CounterMode)
{
  uint16_t tmpcr1 = 0;
  assert_param(IS_TIM_LIST3_PERIPH(TIMx));
  assert_param(IS_TIM_COUNTER_MODE(TIM_CounterMode));
  tmpcr1 = TIMx->CR1;
  tmpcr1 &= (uint16_t)(~((uint16_t)(TIM_CR1_DIR | TIM_CR1_CMS)));
  tmpcr1 |= TIM_CounterMode;
  TIMx->CR1 = tmpcr1;
}
void TIM_CounterModeConfig ( TIM_TypeDef * TIMx , uint16_t TIM_CounterMode ) { uint16_t tmpcr1 = 0 ; assert_param ( IS_TIM_LIST3_PERIPH ( TIMx ) ) ; assert_param ( IS_TIM_COUNTER_MODE ( TIM_CounterMode ) ) ; tmpcr1 = TIMx -> CR1 ; tmpcr1 &= ( uint16_t ) ( ~ ( ( uint16_t ) ( TIM_CR1_DIR | TIM_CR1_CMS ) ) ) ; tmpcr1 |= TIM_CounterMode ; TIMx -> CR1 = tmpcr1 ; }
@brief  Specifies the TIMx Counter Mode to be used.
@brief Specifies the TIMx Counter Mode to be used .
/* Check the parameters */ /* Reset the CMS and DIR Bits */ /* Set the Counter Mode */ /* Write to TIMx CR1 register */