0
|
1 /**
|
|
2 ******************************************************************************
|
|
3 * @file stm32l4xx_hal_tim_ex.h
|
|
4 * @author MCD Application Team
|
|
5 * @version V1.6.0
|
|
6 * @date 28-October-2016
|
|
7 * @brief Header file of TIM HAL Extended module.
|
|
8 ******************************************************************************
|
|
9 * @attention
|
|
10 *
|
|
11 * <h2><center>© 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 __STM32L4xx_HAL_TIM_EX_H
|
|
40 #define __STM32L4xx_HAL_TIM_EX_H
|
|
41
|
|
42 #ifdef __cplusplus
|
|
43 extern "C" {
|
|
44 #endif
|
|
45
|
|
46 /* Includes ------------------------------------------------------------------*/
|
|
47 #include "stm32l4xx_hal_def.h"
|
|
48
|
|
49 /** @addtogroup STM32L4xx_HAL_Driver
|
|
50 * @{
|
|
51 */
|
|
52
|
|
53 /** @addtogroup TIMEx
|
|
54 * @{
|
|
55 */
|
|
56
|
|
57 /* Exported types ------------------------------------------------------------*/
|
|
58 /** @defgroup TIMEx_Exported_Types TIM Extended 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
|
|
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 * @brief TIM Break/Break2 input configuration
|
|
84 */
|
|
85 typedef struct {
|
|
86 uint32_t Source; /*!< Specifies the source of the timer break input.
|
|
87 This parameter can be a value of @ref TIMEx_Break_Input_Source */
|
|
88 uint32_t Enable; /*!< Specifies whether or not the break input source is enabled.
|
|
89 This parameter can be a value of @ref TIMEx_Break_Input_Source_Enable */
|
|
90 uint32_t Polarity; /*!< Specifies the break input source polarity.
|
|
91 This parameter can be a value of @ref TIMEx_Break_Input_Source_Polarity
|
|
92 Not relevant when analog watchdog output of the DFSDM1 used as break input source */
|
|
93 } TIMEx_BreakInputConfigTypeDef;
|
|
94
|
|
95 /**
|
|
96 * @}
|
|
97 */
|
|
98 /* End of exported types -----------------------------------------------------*/
|
|
99
|
|
100 /* Exported constants --------------------------------------------------------*/
|
|
101 /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants
|
|
102 * @{
|
|
103 */
|
|
104
|
|
105 /** @defgroup TIMEx_Remap TIM Extended Remapping
|
|
106 * @{
|
|
107 */
|
|
108 #define TIM_TIM1_ETR_ADC1_NONE ((uint32_t)(0x00000000)) /* !< TIM1_ETR is not connected to any AWD (analog watchdog)*/
|
|
109 #define TIM_TIM1_ETR_ADC1_AWD1 (TIM1_OR1_ETR_ADC1_RMP_0) /* !< TIM1_ETR is connected to ADC1 AWD1 */
|
|
110 #define TIM_TIM1_ETR_ADC1_AWD2 (TIM1_OR1_ETR_ADC1_RMP_1) /* !< TIM1_ETR is connected to ADC1 AWD2 */
|
|
111 #define TIM_TIM1_ETR_ADC1_AWD3 (TIM1_OR1_ETR_ADC1_RMP_1 | TIM1_OR1_ETR_ADC1_RMP_0) /* !< TIM1_ETR is connected to ADC1 AWD3 */
|
|
112 #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
113 #define TIM_TIM1_ETR_ADC3_NONE ((uint32_t)(0x00000000)) /* !< TIM1_ETR is not connected to any AWD (analog watchdog)*/
|
|
114 #define TIM_TIM1_ETR_ADC3_AWD1 (TIM1_OR1_ETR_ADC3_RMP_0) /* !< TIM1_ETR is connected to ADC3 AWD1 */
|
|
115 #define TIM_TIM1_ETR_ADC3_AWD2 (TIM1_OR1_ETR_ADC3_RMP_1) /* !< TIM1_ETR is connected to ADC3 AWD2 */
|
|
116 #define TIM_TIM1_ETR_ADC3_AWD3 (TIM1_OR1_ETR_ADC3_RMP_1 | TIM1_OR1_ETR_ADC3_RMP_0) /* !< TIM1_ETR is connected to ADC3 AWD3 */
|
|
117 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
118 #define TIM_TIM1_TI1_GPIO ((uint32_t)(0x00000000)) /* !< TIM1 TI1 is connected to GPIO */
|
|
119 #define TIM_TIM1_TI1_COMP1 (TIM1_OR1_TI1_RMP) /* !< TIM1 TI1 is connected to COMP1 */
|
|
120 #define TIM_TIM1_ETR_COMP1 (TIM1_OR2_ETRSEL_0) /* !< TIM1_ETR is connected to COMP1 output */
|
|
121 #define TIM_TIM1_ETR_COMP2 (TIM1_OR2_ETRSEL_1) /* !< TIM1_ETR is connected to COMP2 output */
|
|
122
|
|
123 #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
124 #define TIM_TIM2_ITR1_TIM8_TRGO ((uint32_t)(0x00000000)) /* !< TIM2_ITR1 is connected to TIM8_TRGO */
|
|
125 #define TIM_TIM2_ITR1_OTG_FS_SOF (TIM2_OR1_ITR1_RMP) /* !< TIM2_ITR1 is connected to OTG_FS SOF */
|
|
126 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
127 #if defined (STM32L431xx) || defined (STM32L432xx) || defined (STM32L433xx) || defined (STM32L442xx) || defined (STM32L443xx) || \
|
|
128 defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx)
|
|
129 #define TIM_TIM2_ITR1_NONE ((uint32_t)(0x00000000)) /* !< No internal trigger on TIM2_ITR1 */
|
|
130 #define TIM_TIM2_ITR1_USB_SOF (TIM2_OR1_ITR1_RMP) /* !< TIM2_ITR1 is connected to USB SOF */
|
|
131 #endif /* STM32L431xx || STM32L432xx || STM32L442xx || STM32L433xx || STM32L443xx || */
|
|
132 /* STM32L451xx || STM32L452xx || STM32L462xx */
|
|
133 #define TIM_TIM2_ETR_GPIO ((uint32_t)(0x00000000)) /* !< TIM2_ETR is connected to GPIO */
|
|
134 #define TIM_TIM2_ETR_LSE (TIM2_OR1_ETR1_RMP) /* !< TIM2_ETR is connected to LSE */
|
|
135 #define TIM_TIM2_ETR_COMP1 (TIM2_OR2_ETRSEL_0) /* !< TIM2_ETR is connected to COMP1 output */
|
|
136 #define TIM_TIM2_ETR_COMP2 (TIM2_OR2_ETRSEL_1) /* !< TIM2_ETR is connected to COMP2 output */
|
|
137 #define TIM_TIM2_TI4_GPIO ((uint32_t)(0x00000000)) /* !< TIM2 TI4 is connected to GPIO */
|
|
138 #define TIM_TIM2_TI4_COMP1 (TIM2_OR1_TI4_RMP_0) /* !< TIM2 TI4 is connected to COMP1 output */
|
|
139 #define TIM_TIM2_TI4_COMP2 (TIM2_OR1_TI4_RMP_1) /* !< TIM2 TI4 is connected to COMP2 output */
|
|
140 #define TIM_TIM2_TI4_COMP1_COMP2 (TIM2_OR1_TI4_RMP_1| TIM2_OR1_TI4_RMP_0) /* !< TIM2 TI4 is connected to logical OR between COMP1 and COMP2 output2 */
|
|
141
|
|
142 #if defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx) || \
|
|
143 defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
144 #define TIM_TIM3_TI1_GPIO ((uint32_t)(0x00000000)) /* !< TIM3 TI1 is connected to GPIO */
|
|
145 #define TIM_TIM3_TI1_COMP1 (TIM3_OR1_TI1_RMP_0) /* !< TIM3 TI1 is connected to COMP1 output */
|
|
146 #define TIM_TIM3_TI1_COMP2 (TIM3_OR1_TI1_RMP_1) /* !< TIM3 TI1 is connected to COMP2 output */
|
|
147 #define TIM_TIM3_TI1_COMP1_COMP2 (TIM3_OR1_TI1_RMP_1 | TIM3_OR1_TI1_RMP_0) /* !< TIM3 TI1 is connected to logical OR between COMP1 and COMP2 output2 */
|
|
148 #define TIM_TIM3_ETR_GPIO ((uint32_t)(0x00000000)) /* !< TIM3_ETR is connected to GPIO */
|
|
149 #define TIM_TIM3_ETR_COMP1 (TIM3_OR2_ETRSEL_0) /* !< TIM3_ETR is connected to COMP1 output */
|
|
150 #endif /* STM32L451xx || STM32L452xx || STM32L462xx || */
|
|
151 /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
152
|
|
153 #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
154 #define TIM_TIM8_ETR_ADC2_NONE ((uint32_t)(0x00000000)) /* !< TIM8_ETR is not connected to any AWD (analog watchdog)*/
|
|
155 #define TIM_TIM8_ETR_ADC2_AWD1 (TIM8_OR1_ETR_ADC2_RMP_0) /* !< TIM8_ETR is connected to ADC2 AWD1 */
|
|
156 #define TIM_TIM8_ETR_ADC2_AWD2 (TIM8_OR1_ETR_ADC2_RMP_1) /* !< TIM8_ETR is connected to ADC2 AWD2 */
|
|
157 #define TIM_TIM8_ETR_ADC2_AWD3 (TIM8_OR1_ETR_ADC2_RMP_1 | TIM8_OR1_ETR_ADC2_RMP_0) /* !< TIM8_ETR is connected to ADC2 AWD3 */
|
|
158 #define TIM_TIM8_ETR_ADC3_NONE ((uint32_t)(0x00000000)) /* !< TIM8_ETR is not connected to any AWD (analog watchdog)*/
|
|
159 #define TIM_TIM8_ETR_ADC3_AWD1 (TIM8_OR1_ETR_ADC3_RMP_0) /* !< TIM8_ETR is connected to ADC3 AWD1 */
|
|
160 #define TIM_TIM8_ETR_ADC3_AWD2 (TIM8_OR1_ETR_ADC3_RMP_1) /* !< TIM8_ETR is connected to ADC3 AWD2 */
|
|
161 #define TIM_TIM8_ETR_ADC3_AWD3 (TIM8_OR1_ETR_ADC3_RMP_1 | TIM8_OR1_ETR_ADC3_RMP_0) /* !< TIM8_ETR is connected to ADC3 AWD3 */
|
|
162 #define TIM_TIM8_ETR_COMP1 (TIM8_OR2_ETRSEL_0) /* !< TIM8_ETR is connected to COMP1 output */
|
|
163 #define TIM_TIM8_ETR_COMP2 (TIM8_OR2_ETRSEL_1) /* !< TIM8_ETR is connected to COMP2 output */
|
|
164 #define TIM_TIM8_TI1_GPIO ((uint32_t)(0x00000000)) /* !< TIM8 TI1 is connected to GPIO */
|
|
165 #define TIM_TIM8_TI1_COMP2 (TIM8_OR1_TI1_RMP) /* !< TIM8 TI1 is connected to COMP1 */
|
|
166 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
167
|
|
168 #define TIM_TIM15_TI1_GPIO ((uint32_t)(0x00000000)) /* !< TIM15 TI1 is connected to GPIO */
|
|
169 #define TIM_TIM15_TI1_LSE (TIM15_OR1_TI1_RMP) /* !< TIM15 TI1 is connected to LSE */
|
|
170 #define TIM_TIM15_ENCODERMODE_NONE ((uint32_t)(0x00000000)) /* !< No redirection */
|
|
171 #define TIM_TIM15_ENCODERMODE_TIM2 (TIM15_OR1_ENCODER_MODE_0) /* !< TIM2 IC1 and TIM2 IC2 are connected to TIM15 IC1 and TIM15 IC2 respectively */
|
|
172 #if defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx) || \
|
|
173 defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
174 #define TIM_TIM15_ENCODERMODE_TIM3 (TIM15_OR1_ENCODER_MODE_1) /* !< TIM3 IC1 and TIM3 IC2 are connected to TIM15 IC1 and TIM15 IC2 respectively */
|
|
175 #endif /* STM32L451xx || STM32L452xx || STM32L462xx */
|
|
176 /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
177 #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
178 #define TIM_TIM15_ENCODERMODE_TIM4 (TIM15_OR1_ENCODER_MODE_1 | TIM15_OR1_ENCODER_MODE_0) /* !< TIM4 IC1 and TIM4 IC2 are connected to TIM15 IC1 and TIM15 IC2 respectively */
|
|
179 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
180
|
|
181 #define TIM_TIM16_TI1_GPIO ((uint32_t)(0x00000000)) /* !< TIM16 TI1 is connected to GPIO */
|
|
182 #define TIM_TIM16_TI1_LSI (TIM16_OR1_TI1_RMP_0) /* !< TIM16 TI1 is connected to LSI */
|
|
183 #define TIM_TIM16_TI1_LSE (TIM16_OR1_TI1_RMP_1) /* !< TIM16 TI1 is connected to LSE */
|
|
184 #define TIM_TIM16_TI1_RTC (TIM16_OR1_TI1_RMP_1 | TIM16_OR1_TI1_RMP_0) /* !< TIM16 TI1 is connected to RTC wakeup interrupt */
|
|
185 #if defined (STM32L431xx) || defined (STM32L432xx) || defined (STM32L433xx) || defined (STM32L442xx) || defined (STM32L443xx) || \
|
|
186 defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx)
|
|
187 #define TIM_TIM16_TI1_MSI (TIM16_OR1_TI1_RMP_2) /* !< TIM16 TI1 is connected to MSI */
|
|
188 #define TIM_TIM16_TI1_HSE_32 (TIM16_OR1_TI1_RMP_2 | TIM16_OR1_TI1_RMP_0) /* !< TIM16 TI1 is connected to HSE div 32 */
|
|
189 #define TIM_TIM16_TI1_MCO (TIM16_OR1_TI1_RMP_2 | TIM16_OR1_TI1_RMP_1) /* !< TIM16 TI1 is connected to MCO */
|
|
190 #endif /* STM32L431xx || STM32L432xx || STM32L442xx || STM32L433xx || STM32L443xx || */
|
|
191 /* STM32L451xx || STM32L452xx || STM32L462xx */
|
|
192
|
|
193 #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
194 #define TIM_TIM17_TI1_GPIO ((uint32_t)(0x00000000)) /* !< TIM17 TI1 is connected to GPIO */
|
|
195 #define TIM_TIM17_TI1_MSI (TIM17_OR1_TI1_RMP_0) /* !< TIM17 TI1 is connected to MSI */
|
|
196 #define TIM_TIM17_TI1_HSE_32 (TIM17_OR1_TI1_RMP_1) /* !< TIM17 TI1 is connected to HSE div 32 */
|
|
197 #define TIM_TIM17_TI1_MCO (TIM17_OR1_TI1_RMP_1 | TIM17_OR1_TI1_RMP_0) /* !< TIM17 TI1 is connected to MCO */
|
|
198 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
199 /**
|
|
200 * @}
|
|
201 */
|
|
202
|
|
203 /** @defgroup TIMEx_Break_Input TIM Extended Break input
|
|
204 * @{
|
|
205 */
|
|
206 #define TIM_BREAKINPUT_BRK ((uint32_t)(0x00000001)) /* !< Timer break input */
|
|
207 #define TIM_BREAKINPUT_BRK2 ((uint32_t)(0x00000002)) /* !< Timer break2 input */
|
|
208 /**
|
|
209 * @}
|
|
210 */
|
|
211
|
|
212 /** @defgroup TIMEx_Break_Input_Source TIM Extended Break input source
|
|
213 * @{
|
|
214 */
|
|
215 #define TIM_BREAKINPUTSOURCE_BKIN ((uint32_t)(0x00000001)) /* !< An external source (GPIO) is connected to the BKIN pin */
|
|
216 #define TIM_BREAKINPUTSOURCE_COMP1 ((uint32_t)(0x00000002)) /* !< The COMP1 output is connected to the break input */
|
|
217 #define TIM_BREAKINPUTSOURCE_COMP2 ((uint32_t)(0x00000004)) /* !< The COMP2 output is connected to the break input */
|
|
218 #if defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx) || \
|
|
219 defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
220 #define TIM_BREAKINPUTSOURCE_DFSDM1 ((uint32_t)(0x00000008)) /* !< The analog watchdog output of the DFSDM1 peripheral is connected to the break input */
|
|
221 #endif /* STM32L451xx || STM32L452xx || STM32L462xx || */
|
|
222 /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
223 /**
|
|
224 * @}
|
|
225 */
|
|
226
|
|
227 /** @defgroup TIMEx_Break_Input_Source_Enable TIM Extended Break input source enabling
|
|
228 * @{
|
|
229 */
|
|
230 #define TIM_BREAKINPUTSOURCE_DISABLE ((uint32_t)(0x00000000)) /* !< Break input source is disabled */
|
|
231 #define TIM_BREAKINPUTSOURCE_ENABLE ((uint32_t)(0x00000001)) /* !< Break input source is enabled */
|
|
232 /**
|
|
233 * @}
|
|
234 */
|
|
235
|
|
236 /** @defgroup TIMEx_Break_Input_Source_Polarity TIM Extended Break input polarity
|
|
237 * @{
|
|
238 */
|
|
239 #define TIM_BREAKINPUTSOURCE_POLARITY_LOW ((uint32_t)(0x00000001)) /* !< Break input source is active low */
|
|
240 #define TIM_BREAKINPUTSOURCE_POLARITY_HIGH ((uint32_t)(0x00000000)) /* !< Break input source is active_high */
|
|
241 /**
|
|
242 * @}
|
|
243 */
|
|
244
|
|
245 /**
|
|
246 * @}
|
|
247 */
|
|
248 /* End of exported constants -------------------------------------------------*/
|
|
249
|
|
250 /* Exported macro ------------------------------------------------------------*/
|
|
251 /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
|
|
252 * @{
|
|
253 */
|
|
254
|
|
255 /**
|
|
256 * @}
|
|
257 */
|
|
258 /* End of exported macro -----------------------------------------------------*/
|
|
259
|
|
260 /* Private macro -------------------------------------------------------------*/
|
|
261 /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
|
|
262 * @{
|
|
263 */
|
|
264 #define IS_TIM_REMAP(__REMAP__) (((__REMAP__) <= (uint32_t)0x0001C01F))
|
|
265
|
|
266 #define IS_TIM_BREAKINPUT(__BREAKINPUT__) (((__BREAKINPUT__) == TIM_BREAKINPUT_BRK) || \
|
|
267 ((__BREAKINPUT__) == TIM_BREAKINPUT_BRK2))
|
|
268
|
|
269 #if defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx) || \
|
|
270 defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
|
|
271 #define IS_TIM_BREAKINPUTSOURCE(__SOURCE__) (((__SOURCE__) == TIM_BREAKINPUTSOURCE_BKIN) || \
|
|
272 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP1) || \
|
|
273 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP2) || \
|
|
274 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_DFSDM1))
|
|
275 #else
|
|
276 #define IS_TIM_BREAKINPUTSOURCE(__SOURCE__) (((__SOURCE__) == TIM_BREAKINPUTSOURCE_BKIN) || \
|
|
277 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP1) || \
|
|
278 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP2))
|
|
279 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
280
|
|
281 #define IS_TIM_BREAKINPUTSOURCE_STATE(__STATE__) (((__STATE__) == TIM_BREAKINPUTSOURCE_DISABLE) || \
|
|
282 ((__STATE__) == TIM_BREAKINPUTSOURCE_ENABLE))
|
|
283
|
|
284 #define IS_TIM_BREAKINPUTSOURCE_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_LOW) || \
|
|
285 ((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_HIGH))
|
|
286 /**
|
|
287 * @}
|
|
288 */
|
|
289 /* End of private macro ------------------------------------------------------*/
|
|
290
|
|
291 /* Exported functions --------------------------------------------------------*/
|
|
292 /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
|
|
293 * @{
|
|
294 */
|
|
295
|
|
296 /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
|
|
297 * @brief Timer Hall Sensor functions
|
|
298 * @{
|
|
299 */
|
|
300 /* Timer Hall Sensor functions **********************************************/
|
|
301 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef* sConfig);
|
|
302 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
|
|
303
|
|
304 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
|
|
305 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
|
|
306
|
|
307 /* Blocking mode: Polling */
|
|
308 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
|
|
309 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
|
|
310 /* Non-Blocking mode: Interrupt */
|
|
311 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
|
|
312 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
|
|
313 /* Non-Blocking mode: DMA */
|
|
314 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
|
|
315 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
|
|
316 /**
|
|
317 * @}
|
|
318 */
|
|
319
|
|
320 /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
|
|
321 * @brief Timer Complementary Output Compare functions
|
|
322 * @{
|
|
323 */
|
|
324 /* Timer Complementary Output Compare functions *****************************/
|
|
325 /* Blocking mode: Polling */
|
|
326 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
327 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
328
|
|
329 /* Non-Blocking mode: Interrupt */
|
|
330 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
331 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
332
|
|
333 /* Non-Blocking mode: DMA */
|
|
334 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
|
|
335 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
336 /**
|
|
337 * @}
|
|
338 */
|
|
339
|
|
340 /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions
|
|
341 * @brief Timer Complementary PWM functions
|
|
342 * @{
|
|
343 */
|
|
344 /* Timer Complementary PWM functions ****************************************/
|
|
345 /* Blocking mode: Polling */
|
|
346 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
347 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
348
|
|
349 /* Non-Blocking mode: Interrupt */
|
|
350 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
351 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
352 /* Non-Blocking mode: DMA */
|
|
353 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
|
|
354 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
|
|
355 /**
|
|
356 * @}
|
|
357 */
|
|
358
|
|
359 /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
|
|
360 * @brief Timer Complementary One Pulse functions
|
|
361 * @{
|
|
362 */
|
|
363 /* Timer Complementary One Pulse functions **********************************/
|
|
364 /* Blocking mode: Polling */
|
|
365 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
|
|
366 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
|
|
367
|
|
368 /* Non-Blocking mode: Interrupt */
|
|
369 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
|
|
370 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
|
|
371 /**
|
|
372 * @}
|
|
373 */
|
|
374
|
|
375 /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
|
|
376 * @brief Peripheral Control functions
|
|
377 * @{
|
|
378 */
|
|
379 /* Extended Control functions ************************************************/
|
|
380 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
|
|
381 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
|
|
382 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
|
|
383 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef * sMasterConfig);
|
|
384 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
|
|
385 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput, TIMEx_BreakInputConfigTypeDef *sBreakInputConfig);
|
|
386 HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels);
|
|
387 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
|
|
388
|
|
389 /**
|
|
390 * @}
|
|
391 */
|
|
392
|
|
393 /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
|
|
394 * @brief Extended Callbacks functions
|
|
395 * @{
|
|
396 */
|
|
397 /* Extended Callback **********************************************************/
|
|
398 void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef *htim);
|
|
399 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
|
|
400 /**
|
|
401 * @}
|
|
402 */
|
|
403
|
|
404 /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
|
|
405 * @brief Extended Peripheral State functions
|
|
406 * @{
|
|
407 */
|
|
408 /* Extended Peripheral State functions ***************************************/
|
|
409 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim);
|
|
410 /**
|
|
411 * @}
|
|
412 */
|
|
413
|
|
414 /**
|
|
415 * @}
|
|
416 */
|
|
417 /* End of exported functions -------------------------------------------------*/
|
|
418
|
|
419 /* Private functions----------------------------------------------------------*/
|
|
420 /** @defgroup TIMEx_Private_Functions TIMEx Private Functions
|
|
421 * @{
|
|
422 */
|
|
423 void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
|
|
424 /**
|
|
425 * @}
|
|
426 */
|
|
427 /* End of private functions --------------------------------------------------*/
|
|
428
|
|
429 /**
|
|
430 * @}
|
|
431 */
|
|
432
|
|
433 /**
|
|
434 * @}
|
|
435 */
|
|
436
|
|
437 #ifdef __cplusplus
|
|
438 }
|
|
439 #endif
|
|
440
|
|
441
|
|
442 #endif /* __STM32L4xx_HAL_TIM_EX_H */
|
|
443
|
|
444 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|