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