Go to the documentation of this file.
79 #include "stm32h7xx_hal.h"
90 #ifdef HAL_TIM_MODULE_ENABLED
99 static void TIM_CCxNChannelCmd(
TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState);
160 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
162 TIM_ResetCallback(htim);
164 if (htim->HallSensor_MspInitCallback ==
NULL)
169 htim->HallSensor_MspInitCallback(htim);
247 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
248 if (htim->HallSensor_MspDeInitCallback ==
NULL)
253 htim->HallSensor_MspDeInitCallback(htim);
498 if ((pData ==
NULL) && (Length > 0U))
864 if ((pData ==
NULL) && (Length > 0U))
1321 if ((pData ==
NULL) && (Length > 0U))
1748 uint32_t CommutationSource)
1807 uint32_t CommutationSource)
1870 uint32_t CommutationSource)
1996 uint32_t tmpbdtr = 0U;
2045 #if defined(TIM_BREAK_INPUT_SUPPORT)
2058 uint32_t BreakInput,
2059 TIMEx_BreakInputConfigTypeDef *sBreakInputConfig)
2063 uint32_t bkin_enable_mask;
2064 uint32_t bkin_polarity_mask;
2065 uint32_t bkin_enable_bitpos;
2066 uint32_t bkin_polarity_bitpos;
2073 if (sBreakInputConfig->Source != TIM_BREAKINPUTSOURCE_DFSDM1)
2081 switch (sBreakInputConfig->Source)
2083 case TIM_BREAKINPUTSOURCE_BKIN:
2091 case TIM_BREAKINPUTSOURCE_COMP1:
2099 case TIM_BREAKINPUTSOURCE_COMP2:
2107 case TIM_BREAKINPUTSOURCE_DFSDM1:
2110 bkin_enable_bitpos = 8U;
2111 bkin_polarity_mask = 0U;
2112 bkin_polarity_bitpos = 0U;
2118 bkin_enable_mask = 0U;
2119 bkin_polarity_mask = 0U;
2120 bkin_enable_bitpos = 0U;
2121 bkin_polarity_bitpos = 0U;
2128 case TIM_BREAKINPUT_BRK:
2134 tmporx &= ~bkin_enable_mask;
2135 tmporx |= (sBreakInputConfig->Enable << bkin_enable_bitpos) & bkin_enable_mask;
2138 if (sBreakInputConfig->Source != TIM_BREAKINPUTSOURCE_DFSDM1)
2140 tmporx &= ~bkin_polarity_mask;
2141 tmporx |= (sBreakInputConfig->Polarity << bkin_polarity_bitpos) & bkin_polarity_mask;
2148 case TIM_BREAKINPUT_BRK2:
2154 tmporx &= ~bkin_enable_mask;
2155 tmporx |= (sBreakInputConfig->Enable << bkin_enable_bitpos) & bkin_enable_mask;
2158 if (sBreakInputConfig->Source != TIM_BREAKINPUTSOURCE_DFSDM1)
2160 tmporx &= ~bkin_polarity_mask;
2161 tmporx |= (sBreakInputConfig->Polarity << bkin_polarity_bitpos) & bkin_polarity_mask;
2529 return channel_state;
2556 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2557 htim->CommutationCallback(htim);
2575 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2576 htim->CommutationHalfCpltCallback(htim);
2633 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2634 htim->PWM_PulseFinishedCallback(htim);
2671 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2672 htim->ErrorCallback(htim);
2692 static void TIM_CCxNChannelCmd(
TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState)
2702 TIMx->
CCER |= (uint32_t)(ChannelNState << (Channel & 0x1FU));
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
#define IS_TIM_IC_FILTER(__ICFILTER__)
#define TIM_BDTR_BK2F_Pos
#define assert_param(expr)
Include module's header file.
#define IS_TIM_INSTANCE(INSTANCE)
HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap)
#define TIM_OCPOLARITY_HIGH
uint32_t MasterOutputTrigger
void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma)
HAL_StatusTypeDef
HAL Status structures definition
#define TIM_CHANNEL_N_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__)
void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim)
#define IS_TIM_BREAK_STATE(__STATE__)
#define IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(__SELECTION__)
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
#define IS_TIM_DEADTIME(__DEADTIME__)
#define IS_TIM_OSSI_STATE(__STATE__)
void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim)
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)
DMA handle Structure definition.
void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim)
#define __HAL_TIM_DISABLE(__HANDLE__)
Disable the TIM peripheral.
void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim)
#define IS_TIM_IC_POLARITY(__POLARITY__)
#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__)
Enable the specified DMA request.
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
__IO HAL_TIM_DMABurstStateTypeDef DMABurstState
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma)
#define __HAL_TIM_MOE_ENABLE(__HANDLE__)
Enable the TIM main Output.
@ HAL_TIM_CHANNEL_STATE_READY
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim)
#define TIM_OCNPOLARITY_HIGH
void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma)
#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__)
Disable the specified DMA request.
#define IS_TIM_TRGO2_SOURCE(__SOURCE__)
uint32_t MasterOutputTrigger2
#define IS_TIM_COUNTER_MODE(__MODE__)
#define TIM1_AF1_BKCMP1E_Pos
@ HAL_TIM_ACTIVE_CHANNEL_3
#define IS_TIM_BKIN2_INSTANCE(INSTANCE)
#define IS_TIM_TRGO_SOURCE(__SOURCE__)
#define IS_TIM_COMBINED3PHASEPWM_INSTANCE(__INSTANCE__)
void TIM_DMAError(DMA_HandleTypeDef *hdma)
#define IS_TIM_REMAP_INSTANCE(INSTANCE)
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
@ HAL_TIM_CHANNEL_STATE_BUSY
#define TIM_OCIDLESTATE_RESET
#define IS_TIM_BREAK_POLARITY(__POLARITY__)
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
#define IS_TIM_LOCK_LEVEL(__LEVEL__)
@ HAL_DMA_BURST_STATE_RESET
void HAL_TIMEx_Break2Callback(TIM_HandleTypeDef *htim)
void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
#define IS_TIM_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__)
#define IS_TIM_SLAVE_INSTANCE(INSTANCE)
#define TIM_DMA_ID_COMMUTATION
#define IS_TIM_BREAK_FILTER(__BRKFILTER__)
#define TIM1_AF1_BKCMP1P_Pos
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
#define TIM_OCFAST_DISABLE
TIM Hall sensor Configuration Structure definition.
#define IS_TIM_AUTOMATIC_OUTPUT_STATE(__STATE__)
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
#define __HAL_TIM_ENABLE(__HANDLE__)
Enable the TIM peripheral.
#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the specified TIM interrupt.
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
#define TIM1_AF1_BKCMP2P_Pos
#define TIM1_AF1_ETRSEL_Msk
@ HAL_TIM_ACTIVE_CHANNEL_2
#define TIM1_AF1_BKDF1BK0E
#define __HAL_LOCK(__HANDLE__)
HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
#define TIM1_AF1_BKINP_Pos
#define TIM_CHANNEL_N_STATE_GET(__HANDLE__, __CHANNEL__)
TIM Output Compare Configuration Structure definition.
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
#define IS_TIM_TRGO2_INSTANCE(__INSTANCE__)
TIM Time Base Handle Structure definition.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim)
uint32_t OffStateIDLEMode
HAL_TIM_ActiveChannel Channel
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
#define IS_TIM_TISEL(__TISEL__)
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
HAL_StatusTypeDef HAL_TIMEx_TISelection(TIM_HandleTypeDef *htim, uint32_t TISelection, uint32_t Channel)
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig)
#define __HAL_UNLOCK(__HANDLE__)
uint32_t AutoReloadPreload
HAL_TIM_StateTypeDef
HAL State structures definition.
HAL_TIM_ChannelStateTypeDef
TIM Channel States definition.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim)
@ HAL_DMA_BURST_STATE_READY
#define TIM1_AF1_BKINE_Pos
void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim)
@ HAL_TIM_ACTIVE_CHANNEL_CLEARED
#define IS_TIM_BREAK2_STATE(__STATE__)
#define TIM_CHANNEL_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__)
#define IS_TIM_MASTER_INSTANCE(INSTANCE)
void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma)
#define IS_TIM_TISEL_INSTANCE(INSTANCE)
#define IS_TIM_BREAKINPUT(__BREAKINPUT__)
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
#define IS_TIM_AUTORELOAD_PRELOAD(PRELOAD)
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim)
TIM Master configuration Structure definition.
HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef *sMasterConfig)
#define IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(INSTANCE)
#define IS_TIM_BREAKINPUTSOURCE(__SOURCE__)
#define IS_TIM_OSSR_STATE(__STATE__)
#define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL)
@ HAL_TIM_CHANNEL_STATE_RESET
#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the specified TIM interrupt.
TIM_Base_InitTypeDef Init
void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma)
#define IS_TIM_COMMUTATION_EVENT_INSTANCE(INSTANCE)
HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(TIM_HandleTypeDef *htim, uint32_t ChannelN)
#define TIM_CHANNEL_STATE_GET(__HANDLE__, __CHANNEL__)
HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim)
#define IS_TIM_MSM_STATE(__STATE__)
#define TIM_SLAVEMODE_RESET
#define IS_TIM_BREAK2_POLARITY(__POLARITY__)
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
#define __HAL_TIM_MOE_DISABLE(__HANDLE__)
Disable the TIM main Output.
#define IS_TIM_BREAK_INSTANCE(INSTANCE)
#define IS_TIM_CLOCKDIVISION_DIV(__DIV__)
HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels)
#define IS_TIM_REMAP(INSTANCE, TIM_REMAP)
#define TIM_OCNIDLESTATE_RESET
void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma)
#define TIM1_AF1_BKCMP2E_Pos
DMA_HandleTypeDef * hdma[7]
#define IS_TIM_BREAKINPUTSOURCE_STATE(__STATE__)
HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim)
uint32_t Commutation_Delay
#define IS_TIM_BREAKINPUTSOURCE_POLARITY(__POLARITY__)
__IO HAL_TIM_StateTypeDef State
#define IS_TIM_IC_PRESCALER(__PRESCALER__)
TIM Break input(s) and Dead time configuration Structure definition.
#define IS_TIM_GROUPCH5(__OCREF__)
HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig)
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
@ HAL_TIM_ACTIVE_CHANNEL_4
void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
@ HAL_TIM_ACTIVE_CHANNEL_1
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim)