Mercurial > public > ostc4
comparison Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc/stm32f4xx_hal_tim_ex.h @ 38:5f11787b4f42
include in ostc4 repository
author | heinrichsweikamp |
---|---|
date | Sat, 28 Apr 2018 11:52:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
37:ccc45c0e1ea2 | 38:5f11787b4f42 |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32f4xx_hal_tim_ex.h | |
4 * @author MCD Application Team | |
5 * @version V1.2.0 | |
6 * @date 26-December-2014 | |
7 * @brief Header file of TIM HAL Extension module. | |
8 ****************************************************************************** | |
9 * @attention | |
10 * | |
11 * <h2><center>© COPYRIGHT(c) 2014 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 __STM32F4xx_HAL_TIM_EX_H | |
40 #define __STM32F4xx_HAL_TIM_EX_H | |
41 | |
42 #ifdef __cplusplus | |
43 extern "C" { | |
44 #endif | |
45 | |
46 /* Includes ------------------------------------------------------------------*/ | |
47 #include "stm32f4xx_hal_def.h" | |
48 | |
49 /** @addtogroup STM32F4xx_HAL_Driver | |
50 * @{ | |
51 */ | |
52 | |
53 /** @addtogroup TIMEx | |
54 * @{ | |
55 */ | |
56 | |
57 /* Exported types ------------------------------------------------------------*/ | |
58 /** @defgroup TIMEx_Exported_Types TIM Exported Types | |
59 * @{ | |
60 */ | |
61 | |
62 /** | |
63 * @brief TIM Hall sensor Configuration Structure definition | |
64 */ | |
65 | |
66 typedef struct | |
67 { | |
68 | |
69 uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal. | |
70 This parameter can be a value of @ref TIM_Input_Capture_Polarity */ | |
71 | |
72 uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler. | |
73 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ | |
74 | |
75 uint32_t IC1Filter; /*!< Specifies the input capture filter. | |
76 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ | |
77 uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register. | |
78 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ | |
79 } TIM_HallSensor_InitTypeDef; | |
80 | |
81 /** | |
82 * @brief TIM Master configuration Structure definition | |
83 */ | |
84 typedef struct { | |
85 uint32_t MasterOutputTrigger; /*!< Trigger output (TRGO) selection. | |
86 This parameter can be a value of @ref TIM_Master_Mode_Selection */ | |
87 uint32_t MasterSlaveMode; /*!< Master/slave mode selection. | |
88 This parameter can be a value of @ref TIM_Master_Slave_Mode */ | |
89 }TIM_MasterConfigTypeDef; | |
90 | |
91 /** | |
92 * @brief TIM Break and Dead time configuration Structure definition | |
93 */ | |
94 typedef struct | |
95 { | |
96 uint32_t OffStateRunMode; /*!< TIM off state in run mode. | |
97 This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */ | |
98 uint32_t OffStateIDLEMode; /*!< TIM off state in IDLE mode. | |
99 This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */ | |
100 uint32_t LockLevel; /*!< TIM Lock level. | |
101 This parameter can be a value of @ref TIM_Lock_level */ | |
102 uint32_t DeadTime; /*!< TIM dead Time. | |
103 This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */ | |
104 uint32_t BreakState; /*!< TIM Break State. | |
105 This parameter can be a value of @ref TIM_Break_Input_enable_disable */ | |
106 uint32_t BreakPolarity; /*!< TIM Break input polarity. | |
107 This parameter can be a value of @ref TIM_Break_Polarity */ | |
108 uint32_t AutomaticOutput; /*!< TIM Automatic Output Enable state. | |
109 This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */ | |
110 }TIM_BreakDeadTimeConfigTypeDef; | |
111 /** | |
112 * @} | |
113 */ | |
114 | |
115 /* Exported constants --------------------------------------------------------*/ | |
116 /** @defgroup TIMEx_Exported_Constants TIM Exported Constants | |
117 * @{ | |
118 */ | |
119 | |
120 /** @defgroup TIMEx_Remap TIM Remap | |
121 * @{ | |
122 */ | |
123 #define TIM_TIM2_TIM8_TRGO (0x00000000) | |
124 #define TIM_TIM2_ETH_PTP (0x00000400) | |
125 #define TIM_TIM2_USBFS_SOF (0x00000800) | |
126 #define TIM_TIM2_USBHS_SOF (0x00000C00) | |
127 #define TIM_TIM5_GPIO (0x00000000) | |
128 #define TIM_TIM5_LSI (0x00000040) | |
129 #define TIM_TIM5_LSE (0x00000080) | |
130 #define TIM_TIM5_RTC (0x000000C0) | |
131 #define TIM_TIM11_GPIO (0x00000000) | |
132 #define TIM_TIM11_HSE (0x00000002) | |
133 /** | |
134 * @} | |
135 */ | |
136 | |
137 /** | |
138 * @} | |
139 */ | |
140 | |
141 /* Exported macro ------------------------------------------------------------*/ | |
142 /* Exported functions --------------------------------------------------------*/ | |
143 /** @addtogroup TIMEx_Exported_Functions | |
144 * @{ | |
145 */ | |
146 | |
147 /** @addtogroup TIMEx_Exported_Functions_Group1 | |
148 * @{ | |
149 */ | |
150 /* Timer Hall Sensor functions **********************************************/ | |
151 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef* htim, TIM_HallSensor_InitTypeDef* sConfig); | |
152 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef* htim); | |
153 | |
154 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef* htim); | |
155 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef* htim); | |
156 | |
157 /* Blocking mode: Polling */ | |
158 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef* htim); | |
159 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef* htim); | |
160 /* Non-Blocking mode: Interrupt */ | |
161 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef* htim); | |
162 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef* htim); | |
163 /* Non-Blocking mode: DMA */ | |
164 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef* htim, uint32_t *pData, uint16_t Length); | |
165 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef* htim); | |
166 /** | |
167 * @} | |
168 */ | |
169 | |
170 /** @addtogroup TIMEx_Exported_Functions_Group2 | |
171 * @{ | |
172 */ | |
173 /* Timer Complementary Output Compare functions *****************************/ | |
174 /* Blocking mode: Polling */ | |
175 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef* htim, uint32_t Channel); | |
176 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel); | |
177 | |
178 /* Non-Blocking mode: Interrupt */ | |
179 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel); | |
180 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel); | |
181 | |
182 /* Non-Blocking mode: DMA */ | |
183 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length); | |
184 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel); | |
185 /** | |
186 * @} | |
187 */ | |
188 | |
189 /** @addtogroup TIMEx_Exported_Functions_Group3 | |
190 * @{ | |
191 */ | |
192 /* Timer Complementary PWM functions ****************************************/ | |
193 /* Blocking mode: Polling */ | |
194 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef* htim, uint32_t Channel); | |
195 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel); | |
196 | |
197 /* Non-Blocking mode: Interrupt */ | |
198 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel); | |
199 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel); | |
200 /* Non-Blocking mode: DMA */ | |
201 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length); | |
202 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel); | |
203 /** | |
204 * @} | |
205 */ | |
206 | |
207 /** @addtogroup TIMEx_Exported_Functions_Group4 | |
208 * @{ | |
209 */ | |
210 /* Timer Complementary One Pulse functions **********************************/ | |
211 /* Blocking mode: Polling */ | |
212 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef* htim, uint32_t OutputChannel); | |
213 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef* htim, uint32_t OutputChannel); | |
214 | |
215 /* Non-Blocking mode: Interrupt */ | |
216 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel); | |
217 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel); | |
218 /** | |
219 * @} | |
220 */ | |
221 | |
222 /** @addtogroup TIMEx_Exported_Functions_Group5 | |
223 * @{ | |
224 */ | |
225 /* Extension Control functions ************************************************/ | |
226 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource); | |
227 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource); | |
228 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource); | |
229 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef* htim, TIM_MasterConfigTypeDef * sMasterConfig); | |
230 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef* htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig); | |
231 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef* htim, uint32_t Remap); | |
232 /** | |
233 * @} | |
234 */ | |
235 | |
236 /** @addtogroup TIMEx_Exported_Functions_Group6 | |
237 * @{ | |
238 */ | |
239 /* Extension Callback *********************************************************/ | |
240 void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef* htim); | |
241 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef* htim); | |
242 void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma); | |
243 /** | |
244 * @} | |
245 */ | |
246 | |
247 /** @addtogroup TIMEx_Exported_Functions_Group7 | |
248 * @{ | |
249 */ | |
250 /* Extension Peripheral State functions **************************************/ | |
251 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef* htim); | |
252 /** | |
253 * @} | |
254 */ | |
255 | |
256 /** | |
257 * @} | |
258 */ | |
259 | |
260 /* Private types -------------------------------------------------------------*/ | |
261 /* Private variables ---------------------------------------------------------*/ | |
262 /* Private constants ---------------------------------------------------------*/ | |
263 /* Private macros ------------------------------------------------------------*/ | |
264 /** @defgroup TIMEx_Private_Macros TIM Private Macros | |
265 * @{ | |
266 */ | |
267 #define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\ | |
268 ((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\ | |
269 ((TIM_REMAP) == TIM_TIM2_USBFS_SOF)||\ | |
270 ((TIM_REMAP) == TIM_TIM2_USBHS_SOF)||\ | |
271 ((TIM_REMAP) == TIM_TIM5_GPIO)||\ | |
272 ((TIM_REMAP) == TIM_TIM5_LSI)||\ | |
273 ((TIM_REMAP) == TIM_TIM5_LSE)||\ | |
274 ((TIM_REMAP) == TIM_TIM5_RTC)||\ | |
275 ((TIM_REMAP) == TIM_TIM11_GPIO)||\ | |
276 ((TIM_REMAP) == TIM_TIM11_HSE)) | |
277 | |
278 #define IS_TIM_DEADTIME(DEADTIME) ((DEADTIME) <= 0xFF) | |
279 /** | |
280 * @} | |
281 */ | |
282 | |
283 /* Private functions ---------------------------------------------------------*/ | |
284 /** @defgroup TIMEx_Private_Functions TIM Private Functions | |
285 * @{ | |
286 */ | |
287 | |
288 /** | |
289 * @} | |
290 */ | |
291 | |
292 /** | |
293 * @} | |
294 */ | |
295 | |
296 /** | |
297 * @} | |
298 */ | |
299 | |
300 #ifdef __cplusplus | |
301 } | |
302 #endif | |
303 | |
304 #endif /* __STM32F4xx_HAL_TIM_EX_H */ | |
305 | |
306 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |