comparison f103c8/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h @ 2:0c59e7a7782a

Working on GPIO and RCC
author cin
date Mon, 16 Jan 2017 11:04:47 +0300
parents
children
comparison
equal deleted inserted replaced
1:a0b14b11ad9f 2:0c59e7a7782a
1 /**
2 ******************************************************************************
3 * @file stm32f1xx_hal_tim_ex.h
4 * @author MCD Application Team
5 * @version V1.0.4
6 * @date 29-April-2016
7 * @brief Header file of TIM HAL Extension module.
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
12 *
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************
36 */
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F1xx_HAL_TIM_EX_H
40 #define __STM32F1xx_HAL_TIM_EX_H
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f1xx_hal_def.h"
48
49 /** @addtogroup STM32F1xx_HAL_Driver
50 * @{
51 */
52
53 /** @addtogroup TIMEx
54 * @{
55 */
56
57 /* Exported types ------------------------------------------------------------*/
58 /** @defgroup TIMEx_Exported_Types TIMEx Exported Types
59 * @{
60 */
61
62
63 /**
64 * @brief TIM Hall sensor Configuration Structure definition
65 */
66
67 typedef struct
68 {
69
70 uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal.
71 This parameter can be a value of @ref TIM_Input_Capture_Polarity */
72
73 uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler.
74 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
75
76 uint32_t IC1Filter; /*!< Specifies the input capture filter.
77 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
78 uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
79 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
80 } TIM_HallSensor_InitTypeDef;
81
82
83 #if defined (STM32F100xB) || defined (STM32F100xE) || \
84 defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
85 defined (STM32F105xC) || defined (STM32F107xC)
86
87 /**
88 * @brief TIM Break and Dead time configuration Structure definition
89 */
90 typedef struct
91 {
92 uint32_t OffStateRunMode; /*!< TIM off state in run mode
93 This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */
94 uint32_t OffStateIDLEMode; /*!< TIM off state in IDLE mode
95 This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */
96 uint32_t LockLevel; /*!< TIM Lock level
97 This parameter can be a value of @ref TIM_Lock_level */
98 uint32_t DeadTime; /*!< TIM dead Time
99 This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */
100 uint32_t BreakState; /*!< TIM Break State
101 This parameter can be a value of @ref TIM_Break_Input_enable_disable */
102 uint32_t BreakPolarity; /*!< TIM Break input polarity
103 This parameter can be a value of @ref TIM_Break_Polarity */
104 uint32_t AutomaticOutput; /*!< TIM Automatic Output Enable state
105 This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */
106 } TIM_BreakDeadTimeConfigTypeDef;
107
108 #endif /* defined(STM32F100xB) || defined(STM32F100xE) || */
109 /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
110 /* defined(STM32F105xC) || defined(STM32F107xC) */
111
112 /**
113 * @brief TIM Master configuration Structure definition
114 */
115 typedef struct {
116 uint32_t MasterOutputTrigger; /*!< Trigger output (TRGO) selection
117 This parameter can be a value of @ref TIM_Master_Mode_Selection */
118 uint32_t MasterSlaveMode; /*!< Master/slave mode selection
119 This parameter can be a value of @ref TIM_Master_Slave_Mode */
120 }TIM_MasterConfigTypeDef;
121
122 /**
123 * @}
124 */
125
126 /* Exported constants --------------------------------------------------------*/
127 #if defined (STM32F100xB) || defined (STM32F100xE) || \
128 defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
129 defined (STM32F105xC) || defined (STM32F107xC)
130 /** @defgroup TIMEx_Exported_Constants TIMEx Exported Constants
131 * @{
132 */
133
134 /** @defgroup TIMEx_Clock_Filter TIMEx Clock Filter
135 * @{
136 */
137 #define IS_TIM_DEADTIME(DEADTIME) ((DEADTIME) <= 0xFF) /*!< BreakDead Time */
138 /**
139 * @}
140 */
141
142 /**
143 * @}
144 */
145 #endif /* defined(STM32F100xB) || defined(STM32F100xE) || */
146 /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
147 /* defined(STM32F105xC) || defined(STM32F107xC) */
148
149 /* Exported macro ------------------------------------------------------------*/
150
151 /* Exported functions --------------------------------------------------------*/
152 /** @addtogroup TIMEx_Exported_Functions
153 * @{
154 */
155
156 /** @addtogroup TIMEx_Exported_Functions_Group1
157 * @{
158 */
159 /* Timer Hall Sensor functions **********************************************/
160 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef* sConfig);
161 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
162
163 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
164 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
165
166 /* Blocking mode: Polling */
167 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
168 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
169 /* Non-Blocking mode: Interrupt */
170 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
171 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
172 /* Non-Blocking mode: DMA */
173 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
174 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
175 /**
176 * @}
177 */
178
179 #if defined (STM32F100xB) || defined (STM32F100xE) || \
180 defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
181 defined (STM32F105xC) || defined (STM32F107xC)
182
183 /** @addtogroup TIMEx_Exported_Functions_Group2
184 * @{
185 */
186 /* Timer Complementary Output Compare functions *****************************/
187 /* Blocking mode: Polling */
188 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
189 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
190
191 /* Non-Blocking mode: Interrupt */
192 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
193 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
194
195 /* Non-Blocking mode: DMA */
196 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
197 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
198 /**
199 * @}
200 */
201
202 /** @addtogroup TIMEx_Exported_Functions_Group3
203 * @{
204 */
205 /* Timer Complementary PWM functions ****************************************/
206 /* Blocking mode: Polling */
207 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
208 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
209
210 /* Non-Blocking mode: Interrupt */
211 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
212 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
213 /* Non-Blocking mode: DMA */
214 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
215 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
216 /**
217 * @}
218 */
219
220 /** @addtogroup TIMEx_Exported_Functions_Group4
221 * @{
222 */
223 /* Timer Complementary One Pulse functions **********************************/
224 /* Blocking mode: Polling */
225 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
226 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
227
228 /* Non-Blocking mode: Interrupt */
229 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
230 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
231 /**
232 * @}
233 */
234 #endif /* defined(STM32F100xB) || defined(STM32F100xE) || */
235 /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
236 /* defined(STM32F105xC) || defined(STM32F107xC) */
237
238 /** @addtogroup TIMEx_Exported_Functions_Group5
239 * @{
240 */
241 /* Extended Control functions ************************************************/
242 #if defined (STM32F100xB) || defined (STM32F100xE) || \
243 defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
244 defined (STM32F105xC) || defined (STM32F107xC)
245 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
246 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
247 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
248 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
249 #endif /* defined(STM32F100xB) || defined(STM32F100xE) || */
250 /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
251 /* defined(STM32F105xC) || defined(STM32F107xC) */
252 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef * sMasterConfig);
253 /**
254 * @}
255 */
256
257 /** @addtogroup TIMEx_Exported_Functions_Group6
258 * @{
259 */
260 /* Extension Callback *********************************************************/
261 void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef *htim);
262 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
263 /**
264 * @}
265 */
266
267 #if defined (STM32F100xB) || defined (STM32F100xE) || \
268 defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || \
269 defined (STM32F105xC) || defined (STM32F107xC)
270 /** @addtogroup TIMEx_Exported_Functions_Group7
271 * @{
272 */
273 /* Extension Peripheral State functions **************************************/
274 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim);
275 /**
276 * @}
277 */
278 #endif /* defined(STM32F100xB) || defined(STM32F100xE) || */
279 /* defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || */
280 /* defined(STM32F105xC) || defined(STM32F107xC) */
281
282 /**
283 * @}
284 */
285 /* End of exported functions -------------------------------------------------*/
286
287 /* Private functions----------------------------------------------------------*/
288 /** @defgroup TIMEx_Private_Functions TIMEx Private Functions
289 * @{
290 */
291 void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
292 /**
293 * @}
294 */
295 /* End of private functions --------------------------------------------------*/
296
297 /**
298 * @}
299 */
300
301 /**
302 * @}
303 */
304
305 #ifdef __cplusplus
306 }
307 #endif
308
309
310 #endif /* __STM32F1xx_HAL_TIM_EX_H */
311
312 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/