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