Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32f1xx_hal_tim_ex.h Source File

stm32f1xx_hal_tim_ex.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f1xx_hal_tim_ex.h
00004   * @author  MCD Application Team
00005   * @version V1.0.4
00006   * @date    29-April-2016
00007   * @brief   Header file of TIM HAL Extension module.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00012   *
00013   * Redistribution and use in source and binary forms, with or without modification,
00014   * are permitted provided that the following conditions are met:
00015   *   1. Redistributions of source code must retain the above copyright notice,
00016   *      this list of conditions and the following disclaimer.
00017   *   2. Redistributions in binary form must reproduce the above copyright notice,
00018   *      this list of conditions and the following disclaimer in the documentation
00019   *      and/or other materials provided with the distribution.
00020   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00021   *      may be used to endorse or promote products derived from this software
00022   *      without specific prior written permission.
00023   *
00024   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00025   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00026   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00028   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00029   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00030   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00032   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034   *
00035   ******************************************************************************
00036   */ 
00037 
00038 /* Define to prevent recursive inclusion -------------------------------------*/
00039 #ifndef __STM32F1xx_HAL_TIM_EX_H
00040 #define __STM32F1xx_HAL_TIM_EX_H
00041 
00042 #ifdef __cplusplus
00043  extern "C" {
00044 #endif
00045 
00046 /* Includes ------------------------------------------------------------------*/
00047 #include "stm32f1xx_hal_def.h"
00048 
00049 /** @addtogroup STM32F1xx_HAL_Driver
00050   * @{
00051   */
00052 
00053 /** @addtogroup TIMEx
00054   * @{
00055   */ 
00056 
00057 /* Exported types ------------------------------------------------------------*/ 
00058 /** @defgroup TIMEx_Exported_Types TIMEx Exported Types
00059   * @{
00060   */
00061 
00062 
00063 /** 
00064   * @brief  TIM Hall sensor Configuration Structure definition  
00065   */
00066 
00067 typedef struct
00068 {
00069                                   
00070   uint32_t IC1Polarity;            /*!< Specifies the active edge of the input signal.
00071                                         This parameter can be a value of @ref TIM_Input_Capture_Polarity */
00072                                                                    
00073   uint32_t IC1Prescaler;        /*!< Specifies the Input Capture Prescaler.
00074                                      This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
00075                                   
00076   uint32_t IC1Filter;           /*!< Specifies the input capture filter.
00077                                      This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */  
00078   uint32_t Commutation_Delay;  /*!< Specifies the pulse value to be loaded into the Capture Compare Register. 
00079                                     This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */                              
00080 } TIM_HallSensor_InitTypeDef;
00081 
00082 
00083 #if defined (STM32F100xB) || defined (STM32F100xE) ||                                                   \
00084     defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
00085     defined (STM32F105xC) || defined (STM32F107xC)
00086 
00087 /** 
00088   * @brief  TIM Break and Dead time configuration Structure definition  
00089   */ 
00090 typedef struct
00091 {
00092   uint32_t OffStateRunMode;       /*!< TIM off state in run mode
00093                                      This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */
00094   uint32_t OffStateIDLEMode;      /*!< TIM off state in IDLE mode
00095                                      This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */
00096   uint32_t LockLevel;             /*!< TIM Lock level
00097                                      This parameter can be a value of @ref TIM_Lock_level */                             
00098   uint32_t DeadTime;              /*!< TIM dead Time 
00099                                      This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */
00100   uint32_t BreakState;            /*!< TIM Break State 
00101                                      This parameter can be a value of @ref TIM_Break_Input_enable_disable */
00102   uint32_t BreakPolarity;         /*!< TIM Break input polarity 
00103                                      This parameter can be a value of @ref TIM_Break_Polarity */
00104   uint32_t AutomaticOutput;       /*!< TIM Automatic Output Enable state 
00105                                      This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */           
00106 } TIM_BreakDeadTimeConfigTypeDef;
00107 
00108 #endif /* defined(STM32F100xB) || defined(STM32F100xE) ||                                                 */
00109        /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
00110        /* defined(STM32F105xC) || defined(STM32F107xC)                                                    */
00111 
00112 /** 
00113   * @brief  TIM Master configuration Structure definition  
00114   */ 
00115 typedef struct {
00116   uint32_t  MasterOutputTrigger;   /*!< Trigger output (TRGO) selection 
00117                                       This parameter can be a value of @ref TIM_Master_Mode_Selection */ 
00118   uint32_t  MasterSlaveMode;       /*!< Master/slave mode selection 
00119                                       This parameter can be a value of @ref TIM_Master_Slave_Mode */
00120 }TIM_MasterConfigTypeDef;
00121 
00122 /**
00123   * @}
00124   */ 
00125 
00126 /* Exported constants --------------------------------------------------------*/
00127 #if defined (STM32F100xB) || defined (STM32F100xE) ||                                                   \
00128     defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
00129     defined (STM32F105xC) || defined (STM32F107xC)
00130 /** @defgroup TIMEx_Exported_Constants TIMEx Exported Constants
00131   * @{
00132   */
00133     
00134 /** @defgroup TIMEx_Clock_Filter TIMEx Clock Filter
00135   * @{
00136   */
00137 #define IS_TIM_DEADTIME(DEADTIME)      ((DEADTIME) <= 0xFF)          /*!< BreakDead Time */
00138 /**
00139   * @}
00140   */
00141 
00142 /**
00143   * @}
00144   */
00145 #endif /* defined(STM32F100xB) || defined(STM32F100xE) ||                                                 */
00146        /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
00147        /* defined(STM32F105xC) || defined(STM32F107xC)                                                    */
00148 
00149 /* Exported macro ------------------------------------------------------------*/
00150 
00151 /* Exported functions --------------------------------------------------------*/
00152 /** @addtogroup TIMEx_Exported_Functions
00153   * @{
00154   */
00155 
00156 /** @addtogroup TIMEx_Exported_Functions_Group1
00157   * @{
00158  */
00159 /* Timer Hall Sensor functions  **********************************************/
00160 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef* sConfig);
00161 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
00162 
00163 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
00164 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
00165 
00166  /* Blocking mode: Polling */
00167 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
00168 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
00169 /* Non-Blocking mode: Interrupt */
00170 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
00171 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
00172 /* Non-Blocking mode: DMA */
00173 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
00174 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
00175 /**
00176   * @}
00177   */
00178 
00179 #if defined (STM32F100xB) || defined (STM32F100xE) ||                                                   \
00180     defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
00181     defined (STM32F105xC) || defined (STM32F107xC)
00182 
00183 /** @addtogroup TIMEx_Exported_Functions_Group2
00184  * @{
00185  */
00186 /* Timer Complementary Output Compare functions  *****************************/
00187 /* Blocking mode: Polling */
00188 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
00189 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
00190 
00191 /* Non-Blocking mode: Interrupt */
00192 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
00193 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
00194 
00195 /* Non-Blocking mode: DMA */
00196 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
00197 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
00198 /**
00199   * @}
00200   */
00201 
00202 /** @addtogroup TIMEx_Exported_Functions_Group3
00203  * @{
00204  */
00205 /* Timer Complementary PWM functions  ****************************************/
00206 /* Blocking mode: Polling */
00207 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
00208 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
00209 
00210 /* Non-Blocking mode: Interrupt */
00211 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
00212 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
00213 /* Non-Blocking mode: DMA */
00214 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
00215 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
00216 /**
00217   * @}
00218   */
00219 
00220 /** @addtogroup TIMEx_Exported_Functions_Group4
00221  * @{
00222  */
00223 /* Timer Complementary One Pulse functions  **********************************/
00224 /* Blocking mode: Polling */
00225 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
00226 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
00227 
00228 /* Non-Blocking mode: Interrupt */
00229 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
00230 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
00231 /**
00232   * @}
00233   */
00234 #endif /* defined(STM32F100xB) || defined(STM32F100xE) ||                                                 */
00235        /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
00236        /* defined(STM32F105xC) || defined(STM32F107xC)                                                    */
00237 
00238 /** @addtogroup TIMEx_Exported_Functions_Group5
00239  * @{
00240  */
00241 /* Extended Control functions  ************************************************/
00242 #if defined (STM32F100xB) || defined (STM32F100xE) ||                                                   \
00243     defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
00244     defined (STM32F105xC) || defined (STM32F107xC)
00245 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef *htim, uint32_t  InputTrigger, uint32_t  CommutationSource);
00246 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef *htim, uint32_t  InputTrigger, uint32_t  CommutationSource);
00247 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef *htim, uint32_t  InputTrigger, uint32_t  CommutationSource);
00248 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
00249 #endif /* defined(STM32F100xB) || defined(STM32F100xE) ||                                                 */
00250        /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
00251        /* defined(STM32F105xC) || defined(STM32F107xC)                                                    */
00252 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef * sMasterConfig);
00253 /**
00254   * @}
00255   */
00256 
00257 /** @addtogroup TIMEx_Exported_Functions_Group6
00258   * @{
00259   */
00260 /* Extension Callback *********************************************************/
00261 void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef *htim);
00262 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
00263 /**
00264   * @}
00265   */
00266 
00267 #if defined (STM32F100xB) || defined (STM32F100xE) ||                                                   \
00268     defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
00269     defined (STM32F105xC) || defined (STM32F107xC)
00270 /** @addtogroup TIMEx_Exported_Functions_Group7
00271   * @{
00272   */
00273 /* Extension Peripheral State functions  **************************************/
00274 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim);
00275 /**
00276   * @}
00277   */
00278 #endif /* defined(STM32F100xB) || defined(STM32F100xE) ||                                                 */
00279        /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
00280        /* defined(STM32F105xC) || defined(STM32F107xC)                                                    */
00281 
00282 /**
00283   * @}
00284   */ 
00285 /* End of exported functions -------------------------------------------------*/
00286 
00287 /* Private functions----------------------------------------------------------*/
00288 /** @defgroup TIMEx_Private_Functions TIMEx Private Functions
00289 * @{
00290 */
00291 void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
00292 /**
00293 * @}
00294 */ 
00295 /* End of private functions --------------------------------------------------*/
00296 
00297 /**
00298   * @}
00299   */ 
00300 
00301 /**
00302   * @}
00303   */
00304   
00305 #ifdef __cplusplus
00306 }
00307 #endif
00308 
00309 
00310 #endif /* __STM32F1xx_HAL_TIM_EX_H */
00311 
00312 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/