Time Base functions.
More...
Time Base functions.
==============================================================================
##### Time Base functions #####
==============================================================================
[..]
This section provides functions allowing to:
(+) Initialize and configure the TIM base.
(+) De-initialize the TIM base.
(+) Start the Time Base.
(+) Stop the Time Base.
(+) Start the Time Base and enable interrupt.
(+) Stop the Time Base and disable interrupt.
(+) Start the Time Base and enable DMA transfer.
(+) Stop the Time Base and disable DMA transfer.
◆ HAL_TIM_Base_DeInit()
DeInitializes the TIM Base peripheral.
- Parameters
-
- Return values
-
Definition at line 320 of file stm32l4xx_hal_tim.c.
328 __HAL_TIM_DISABLE(htim);
330 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) 331 if (htim->Base_MspDeInitCallback == NULL)
336 htim->Base_MspDeInitCallback(htim);
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim)
DeInitializes TIM Base MSP.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_TIM_Base_Init()
Initializes the TIM Time base Unit according to the specified parameters in the TIM_HandleTypeDef and initialize the associated handle.
- Note
- Switching from Center Aligned counter mode to Edge counter mode (or reverse) requires a timer reset to avoid unexpected direction due to DIR bit readonly in center aligned mode. Ex: call HAL_TIM_Base_DeInit() before HAL_TIM_Base_Init()
- Parameters
-
- Return values
-
Definition at line 268 of file stm32l4xx_hal_tim.c.
278 assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode));
279 assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision));
280 assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload));
287 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) 291 if (htim->Base_MspInitCallback == NULL)
296 htim->Base_MspInitCallback(htim);
void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
Time Base configuration.
void TIM_ResetCallback(TIM_HandleTypeDef *htim)
Reset interrupt callbacks to the legacy weak callbacks.
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
Initializes the TIM Base MSP.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_TIM_Base_MspDeInit()
◆ HAL_TIM_Base_MspInit()
◆ HAL_TIM_Base_Start()
Starts the TIM Base generation.
- Parameters
-
- Return values
-
Definition at line 387 of file stm32l4xx_hal_tim.c.
398 tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
399 if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
401 __HAL_TIM_ENABLE(htim);
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_TIM_Base_Start_DMA()
| HAL_StatusTypeDef HAL_TIM_Base_Start_DMA |
( |
TIM_HandleTypeDef * |
htim, |
|
|
uint32_t * |
pData, |
|
|
uint16_t |
Length |
|
) |
| |
Starts the TIM Base generation in DMA mode.
- Parameters
-
| htim | TIM Base handle |
| pData | The source Buffer address. |
| Length | The length of data to be transferred from memory to peripheral. |
- Return values
-
Definition at line 486 of file stm32l4xx_hal_tim.c.
499 if ((pData == NULL) && (Length > 0U))
518 htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback =
TIM_DMAError ;
521 if (
HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)pData, (uint32_t)&htim->Instance->ARR, Length) !=
HAL_OK)
527 __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_UPDATE);
530 tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
531 if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
533 __HAL_TIM_ENABLE(htim);
static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma)
TIM DMA Period Elapse half complete callback.
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
Start the DMA Transfer with interrupt enabled.
void TIM_DMAError(DMA_HandleTypeDef *hdma)
TIM DMA error callback.
static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma)
TIM DMA Period Elapse complete callback.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_TIM_Base_Start_IT()
Starts the TIM Base generation in interrupt mode.
- Parameters
-
- Return values
-
Definition at line 439 of file stm32l4xx_hal_tim.c.
447 __HAL_TIM_ENABLE_IT(htim, TIM_IT_UPDATE);
450 tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
451 if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
453 __HAL_TIM_ENABLE(htim);
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_TIM_Base_Stop()
Stops the TIM Base generation.
- Parameters
-
- Return values
-
Definition at line 416 of file stm32l4xx_hal_tim.c.
425 __HAL_TIM_DISABLE(htim);
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_TIM_Base_Stop_DMA()
Stops the TIM Base generation in DMA mode.
- Parameters
-
- Return values
-
Definition at line 545 of file stm32l4xx_hal_tim.c.
551 __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_UPDATE);
556 __HAL_TIM_DISABLE(htim);
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma)
Aborts the DMA Transfer in Interrupt mode.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_TIM_Base_Stop_IT()
Stops the TIM Base generation in interrupt mode.
- Parameters
-
- Return values
-
Definition at line 465 of file stm32l4xx_hal_tim.c.
470 __HAL_TIM_DISABLE_IT(htim, TIM_IT_UPDATE);
473 __HAL_TIM_DISABLE(htim);
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))