92#ifdef HAL_TIM_MODULE_ENABLED
101static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState);
163#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
165 TIM_ResetCallback(htim);
167 if (htim->HallSensor_MspInitCallback == NULL)
172 htim->HallSensor_MspInitCallback(htim);
189 htim->
Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
194 htim->
Instance->CR2 |= TIM_CR2_TI1S;
197 htim->
Instance->SMCR &= ~TIM_SMCR_TS;
201 htim->
Instance->SMCR &= ~TIM_SMCR_SMS;
217 htim->
Instance->CR2 &= ~TIM_CR2_MMS;
250#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
251 if (htim->HallSensor_MspDeInitCallback == NULL)
256 htim->HallSensor_MspDeInitCallback(htim);
347 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
349 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
432 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
434 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
505 if ((pData == NULL) || (Length == 0U))
541 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
543 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
648 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
650 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
766 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
768 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
886 if ((pData == NULL) || (Length == 0U))
979 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
981 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
1121 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
1123 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
1237 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
1239 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
1357 if ((pData == NULL) || (Length == 0U))
1450 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
1452 tmpsmcr = htim->
Instance->SMCR & TIM_SMCR_SMS;
1793 uint32_t CommutationSource)
1805 htim->
Instance->SMCR &= ~TIM_SMCR_TS;
1806 htim->
Instance->SMCR |= InputTrigger;
1810 htim->
Instance->CR2 |= TIM_CR2_CCPC;
1812 htim->
Instance->CR2 &= ~TIM_CR2_CCUS;
1813 htim->
Instance->CR2 |= CommutationSource;
1849 uint32_t CommutationSource)
1861 htim->
Instance->SMCR &= ~TIM_SMCR_TS;
1862 htim->
Instance->SMCR |= InputTrigger;
1866 htim->
Instance->CR2 |= TIM_CR2_CCPC;
1868 htim->
Instance->CR2 &= ~TIM_CR2_CCUS;
1869 htim->
Instance->CR2 |= CommutationSource;
1906 uint32_t CommutationSource)
1918 htim->
Instance->SMCR &= ~TIM_SMCR_TS;
1919 htim->
Instance->SMCR |= InputTrigger;
1923 htim->
Instance->CR2 |= TIM_CR2_CCPC;
1925 htim->
Instance->CR2 &= ~TIM_CR2_CCUS;
1926 htim->
Instance->CR2 |= CommutationSource;
1978 tmpcr2 &= ~TIM_CR2_MMS;
1985 if (IS_TIM_SLAVE_INSTANCE(htim->
Instance))
1988 tmpsmcr &= ~TIM_SMCR_MSM;
2019 uint32_t tmpbdtr = 0U;
2038 MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, sBreakDeadTimeConfig->
DeadTime);
2039 MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, sBreakDeadTimeConfig->
LockLevel);
2040 MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, sBreakDeadTimeConfig->
OffStateIDLEMode);
2041 MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, sBreakDeadTimeConfig->
OffStateRunMode);
2042 MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, sBreakDeadTimeConfig->
BreakState);
2043 MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, sBreakDeadTimeConfig->
BreakPolarity);
2044 MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, sBreakDeadTimeConfig->
AutomaticOutput);
2098#if defined(LPTIM_OR_TIM1_ITR2_RMP) && defined(LPTIM_OR_TIM5_ITR1_RMP) && defined(LPTIM_OR_TIM9_ITR1_RMP)
2099 if ((Remap & LPTIM_REMAP_MASK) == LPTIM_REMAP_MASK)
2102 __HAL_RCC_LPTIM1_CLK_ENABLE();
2103 MODIFY_REG(LPTIM1->OR,
2104 (LPTIM_OR_TIM1_ITR2_RMP | LPTIM_OR_TIM5_ITR1_RMP | LPTIM_OR_TIM9_ITR1_RMP),
2105 Remap & ~(LPTIM_REMAP_MASK));
2110 WRITE_REG(htim->
Instance->OR, Remap);
2114 WRITE_REG(htim->
Instance->OR, Remap);
2233 return channel_state;
2260#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2261 htim->CommutationCallback(htim);
2279#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2280 htim->CommutationHalfCpltCallback(htim);
2328#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2329 htim->PWM_PulseFinishedCallback(htim);
2366#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2367 htim->ErrorCallback(htim);
2391 tmp = TIM_CCER_CC1NE << (Channel & 0xFU);
2397 TIMx->CCER |= (uint32_t)(ChannelNState << (Channel & 0xFU));
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma)
Aborts the DMA Transfer in Interrupt mode.
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.
#define TIM_DMA_ID_COMMUTATION
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
Starts the TIM Hall Sensor Interface in DMA mode.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim)
DeInitializes the TIM Hall Sensor interface.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, const TIM_HallSensor_InitTypeDef *sConfig)
Initializes the TIM Hall Sensor Interface and initialize the associated handle.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim)
Stops the TIM Hall sensor Interface.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim)
Starts the TIM Hall Sensor Interface.
void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim)
Initializes the TIM Hall Sensor MSP.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim)
Stops the TIM Hall Sensor Interface in DMA mode.
void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim)
DeInitializes TIM Hall Sensor MSP.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim)
Stops the TIM Hall Sensor Interface in interrupt mode.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim)
Starts the TIM Hall Sensor Interface in interrupt mode.
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM Output Compare signal generation in DMA mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the TIM Output Compare signal generation in interrupt mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData, uint16_t Length)
Starts the TIM Output Compare signal generation in DMA mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the TIM Output Compare signal generation on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM Output Compare signal generation on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM Output Compare signal generation in interrupt mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the PWM signal generation on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM PWM signal generation in DMA mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the PWM signal generation in interrupt mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData, uint16_t Length)
Starts the TIM PWM signal generation in DMA mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the PWM signal generation on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the PWM signal generation in interrupt mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Starts the TIM One Pulse signal generation in interrupt mode on the complementary channel.
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Starts the TIM One Pulse signal generation on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Stops the TIM One Pulse signal generation in interrupt mode on the complementary channel.
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Stops the TIM One Pulse signal generation on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, const TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig)
Configures the Break feature, dead time, Lock level, OSSI/OSSR State and the AOE(automatic output ena...
HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap)
Configures the TIMx Remapping input capabilities.
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
Configure the TIM commutation event sequence with DMA.
HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, const TIM_MasterConfigTypeDef *sMasterConfig)
Configures the TIM in master mode.
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
Configure the TIM commutation event sequence.
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
Configure the TIM commutation event sequence with interrupt.
void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim)
Break detection callback in non-blocking mode.
void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim)
Commutation callback in non-blocking mode.
void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim)
Commutation half complete callback in non-blocking mode.
HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(const TIM_HandleTypeDef *htim, uint32_t ChannelN)
Return actual state of the TIM complementary channel.
HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(const TIM_HandleTypeDef *htim)
Return the TIM Hall Sensor interface handle state.
void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma)
TIM DMA Commutation half complete callback.
void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma)
TIM DMA Commutation callback.
#define IS_TIM_REMAP(INSTANCE, TIM_REMAP)
static void TIM_DMADelayPulseNCplt(DMA_HandleTypeDef *hdma)
TIM DMA Delay Pulse complete callback (complementary channel).
static void TIM_DMAErrorCCxN(DMA_HandleTypeDef *hdma)
TIM DMA error callback (complementary channel)
static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState)
Enables or disables the TIM Capture Compare Channel xN.
void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
Timer error callback in non-blocking mode.
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
PWM Pulse finished callback in non-blocking mode.
#define __HAL_TIM_MOE_ENABLE(__HANDLE__)
Enable the TIM main Output.
#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__)
Disable the specified DMA request.
#define __HAL_TIM_ENABLE(__HANDLE__)
Enable the TIM peripheral.
#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the specified TIM interrupt.
#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the specified TIM interrupt.
#define __HAL_TIM_MOE_DISABLE(__HANDLE__)
Disable the TIM main Output.
#define __HAL_TIM_DISABLE(__HANDLE__)
Disable the TIM peripheral.
#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__)
Enable the specified DMA request.
HAL_TIM_ChannelStateTypeDef
TIM Channel States definition.
HAL_TIM_StateTypeDef
HAL State structures definition.
@ HAL_TIM_CHANNEL_STATE_READY
@ HAL_TIM_CHANNEL_STATE_RESET
@ HAL_TIM_CHANNEL_STATE_BUSY
@ HAL_DMA_BURST_STATE_READY
@ HAL_DMA_BURST_STATE_RESET
@ HAL_TIM_ACTIVE_CHANNEL_1
@ HAL_TIM_ACTIVE_CHANNEL_CLEARED
@ HAL_TIM_ACTIVE_CHANNEL_3
@ HAL_TIM_ACTIVE_CHANNEL_2
#define TIM_OCIDLESTATE_RESET
#define TIM_OCNIDLESTATE_RESET
#define TIM_OCNPOLARITY_HIGH
#define TIM_OCPOLARITY_HIGH
#define TIM_OCFAST_DISABLE
#define TIM_CCER_CCxNE_MASK
void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma)
TIM DMA Capture half complete callback.
void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, const TIM_OC_InitTypeDef *OC_Config)
Timer Output Compare 2 configuration.
void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma)
TIM DMA Capture complete callback.
void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
Enables or disables the TIM Capture Compare Channel x.
void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
Configure the TI1 as Input.
void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma)
TIM DMA Delay Pulse half complete callback.
void TIM_DMAError(DMA_HandleTypeDef *hdma)
TIM DMA error callback.
void TIM_Base_SetConfig(TIM_TypeDef *TIMx, const TIM_Base_InitTypeDef *Structure)
Time Base configuration.
#define IS_TIM_DEADTIME(__DEADTIME__)
#define IS_TIM_IC_POLARITY(__POLARITY__)
#define IS_TIM_IC_FILTER(__ICFILTER__)
#define TIM_CHANNEL_N_STATE_GET(__HANDLE__, __CHANNEL__)
#define IS_TIM_BREAK_POLARITY(__POLARITY__)
#define IS_TIM_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__)
#define IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(__SELECTION__)
#define IS_TIM_COUNTER_MODE(__MODE__)
#define IS_TIM_BREAK_STATE(__STATE__)
#define IS_TIM_IC_PRESCALER(__PRESCALER__)
#define IS_TIM_OSSR_STATE(__STATE__)
#define TIM_CHANNEL_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__)
#define IS_TIM_TRGO_SOURCE(__SOURCE__)
#define IS_TIM_AUTOMATIC_OUTPUT_STATE(__STATE__)
#define IS_TIM_AUTORELOAD_PRELOAD(PRELOAD)
#define TIM_CHANNEL_N_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__)
#define IS_TIM_CLOCKDIVISION_DIV(__DIV__)
#define IS_TIM_LOCK_LEVEL(__LEVEL__)
#define TIM_CHANNEL_STATE_GET(__HANDLE__, __CHANNEL__)
#define IS_TIM_OSSI_STATE(__STATE__)
#define IS_TIM_PERIOD(__HANDLE__, __PERIOD__)
#define IS_TIM_MSM_STATE(__STATE__)
#define TIM_SLAVEMODE_RESET
#define assert_param(expr)
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef
HAL Status structures definition
#define __HAL_UNLOCK(__HANDLE__)
#define __HAL_LOCK(__HANDLE__)
uint32_t AutoReloadPreload
TIM Break input(s) and Dead time configuration Structure definition.
uint32_t OffStateIDLEMode
TIM Hall sensor Configuration Structure definition.
uint32_t Commutation_Delay
TIM Time Base Handle Structure definition.
DMA_HandleTypeDef * hdma[7]
__IO HAL_TIM_StateTypeDef State
TIM_Base_InitTypeDef Init
__IO HAL_TIM_DMABurstStateTypeDef DMABurstState
HAL_TIM_ActiveChannel Channel
TIM Master configuration Structure definition.
uint32_t MasterOutputTrigger
TIM Output Compare Configuration Structure definition.
DMA handle Structure definition.
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)