1 /** 2 ****************************************************************************** 3 * @file stm32f1xx_hal_tim_ex.h 4 * @author MCD Application Team 5 * @brief Header file of TIM HAL Extended module. 6 ****************************************************************************** 7 * @attention 8 * 9 * Copyright (c) 2016 STMicroelectronics. 10 * All rights reserved. 11 * 12 * This software is licensed under terms that can be found in the LICENSE file 13 * in the root directory of this software component. 14 * If no LICENSE file comes with this software, it is provided AS-IS. 15 * 16 ****************************************************************************** 17 */ 18 19 /* Define to prevent recursive inclusion -------------------------------------*/ 20 #ifndef STM32F1xx_HAL_TIM_EX_H 21 #define STM32F1xx_HAL_TIM_EX_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "stm32f1xx_hal_def.h" 29 30 /** @addtogroup STM32F1xx_HAL_Driver 31 * @{ 32 */ 33 34 /** @addtogroup TIMEx 35 * @{ 36 */ 37 38 /* Exported types ------------------------------------------------------------*/ 39 /** @defgroup TIMEx_Exported_Types TIM Extended Exported Types 40 * @{ 41 */ 42 43 /** 44 * @brief TIM Hall sensor Configuration Structure definition 45 */ 46 47 typedef struct 48 { 49 uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal. 50 This parameter can be a value of @ref TIM_Input_Capture_Polarity */ 51 52 uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler. 53 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ 54 55 uint32_t IC1Filter; /*!< Specifies the input capture filter. 56 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ 57 58 uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register. 59 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ 60 } TIM_HallSensor_InitTypeDef; 61 /** 62 * @} 63 */ 64 /* End of exported types -----------------------------------------------------*/ 65 66 /* Exported constants --------------------------------------------------------*/ 67 /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants 68 * @{ 69 */ 70 71 /** @defgroup TIMEx_Remap TIM Extended Remapping 72 * @{ 73 */ 74 /** 75 * @} 76 */ 77 78 /** 79 * @} 80 */ 81 /* End of exported constants -------------------------------------------------*/ 82 83 /* Exported macro ------------------------------------------------------------*/ 84 /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros 85 * @{ 86 */ 87 88 /** 89 * @} 90 */ 91 /* End of exported macro -----------------------------------------------------*/ 92 93 /* Private macro -------------------------------------------------------------*/ 94 /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros 95 * @{ 96 */ 97 98 /** 99 * @} 100 */ 101 /* End of private macro ------------------------------------------------------*/ 102 103 /* Exported functions --------------------------------------------------------*/ 104 /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions 105 * @{ 106 */ 107 108 /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions 109 * @brief Timer Hall Sensor functions 110 * @{ 111 */ 112 /* Timer Hall Sensor functions **********************************************/ 113 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, const TIM_HallSensor_InitTypeDef *sConfig); 114 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim); 115 116 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim); 117 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim); 118 119 /* Blocking mode: Polling */ 120 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim); 121 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim); 122 /* Non-Blocking mode: Interrupt */ 123 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim); 124 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim); 125 /* Non-Blocking mode: DMA */ 126 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length); 127 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim); 128 /** 129 * @} 130 */ 131 132 /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions 133 * @brief Timer Complementary Output Compare functions 134 * @{ 135 */ 136 /* Timer Complementary Output Compare functions *****************************/ 137 /* Blocking mode: Polling */ 138 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); 139 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); 140 141 /* Non-Blocking mode: Interrupt */ 142 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 143 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 144 145 /* Non-Blocking mode: DMA */ 146 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData, 147 uint16_t Length); 148 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); 149 /** 150 * @} 151 */ 152 153 /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions 154 * @brief Timer Complementary PWM functions 155 * @{ 156 */ 157 /* Timer Complementary PWM functions ****************************************/ 158 /* Blocking mode: Polling */ 159 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); 160 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); 161 162 /* Non-Blocking mode: Interrupt */ 163 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 164 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 165 /* Non-Blocking mode: DMA */ 166 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData, 167 uint16_t Length); 168 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); 169 /** 170 * @} 171 */ 172 173 /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions 174 * @brief Timer Complementary One Pulse functions 175 * @{ 176 */ 177 /* Timer Complementary One Pulse functions **********************************/ 178 /* Blocking mode: Polling */ 179 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 180 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 181 182 /* Non-Blocking mode: Interrupt */ 183 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 184 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 185 /** 186 * @} 187 */ 188 189 /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions 190 * @brief Peripheral Control functions 191 * @{ 192 */ 193 /* Extended Control functions ************************************************/ 194 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 195 uint32_t CommutationSource); 196 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 197 uint32_t CommutationSource); 198 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 199 uint32_t CommutationSource); 200 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, 201 const TIM_MasterConfigTypeDef *sMasterConfig); 202 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, 203 const TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig); 204 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap); 205 /** 206 * @} 207 */ 208 209 /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions 210 * @brief Extended Callbacks functions 211 * @{ 212 */ 213 /* Extended Callback **********************************************************/ 214 void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim); 215 void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim); 216 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim); 217 /** 218 * @} 219 */ 220 221 /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions 222 * @brief Extended Peripheral State functions 223 * @{ 224 */ 225 /* Extended Peripheral State functions ***************************************/ 226 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(const TIM_HandleTypeDef *htim); 227 HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(const TIM_HandleTypeDef *htim, uint32_t ChannelN); 228 /** 229 * @} 230 */ 231 232 /** 233 * @} 234 */ 235 /* End of exported functions -------------------------------------------------*/ 236 237 /* Private functions----------------------------------------------------------*/ 238 /** @addtogroup TIMEx_Private_Functions TIM Extended Private Functions 239 * @{ 240 */ 241 void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma); 242 void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma); 243 /** 244 * @} 245 */ 246 /* End of private functions --------------------------------------------------*/ 247 248 /** 249 * @} 250 */ 251 252 /** 253 * @} 254 */ 255 256 #ifdef __cplusplus 257 } 258 #endif 259 260 261 #endif /* STM32F1xx_HAL_TIM_EX_H */ 262