STM32: TIM: Initialize new TIM parameter

pull/3567/head
Laurent MEUNIER 2017-01-09 15:39:32 +01:00
parent cdcaf2a473
commit b15fc6a6b5
2 changed files with 6 additions and 0 deletions

View File

@ -118,6 +118,9 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 us tick
TimMasterHandle.Init.ClockDivision = 0;
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
#ifdef TARGET_STM32F0
TimMasterHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
#endif
HAL_TIM_Base_Init(&TimMasterHandle);
// Configure output compare channel 1 for mbed timeout (enabled later when used)

View File

@ -99,6 +99,9 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
#if !TARGET_STM32L1
TimMasterHandle.Init.RepetitionCounter = 0;
#endif
#ifdef TARGET_STM32F0
TimMasterHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
#endif
HAL_TIM_OC_Init(&TimMasterHandle);