]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_tim_ex.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F4 / stm32f4xx_hal_tim_ex.h
1 /**
2   ******************************************************************************
3   * @file    stm32f4xx_hal_tim_ex.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    19-June-2014
7   * @brief   Header file of TIM HAL Extension module.
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; 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
50   * @{
51   */
52
53 /** @addtogroup TIMEx
54   * @{
55   */ 
56
57 /* Exported types ------------------------------------------------------------*/ 
58
59 /** 
60   * @brief  TIM Hall sensor Configuration Structure definition  
61   */
62
63 typedef struct
64 {
65                                   
66   uint32_t IC1Polarity;            /*!< Specifies the active edge of the input signal.
67                                         This parameter can be a value of @ref TIM_Input_Capture_Polarity */
68                                                                    
69   uint32_t IC1Prescaler;        /*!< Specifies the Input Capture Prescaler.
70                                      This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
71                                   
72   uint32_t IC1Filter;           /*!< Specifies the input capture filter.
73                                      This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */  
74   uint32_t Commutation_Delay;  /*!< Specifies the pulse value to be loaded into the Capture Compare Register. 
75                                     This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */                              
76 } TIM_HallSensor_InitTypeDef;
77
78 /** 
79   * @brief  TIM Master configuration Structure definition  
80   */ 
81 typedef struct {
82   uint32_t  MasterOutputTrigger;   /*!< Trigger output (TRGO) selection. 
83                                       This parameter can be a value of @ref TIM_Master_Mode_Selection */ 
84   uint32_t  MasterSlaveMode;       /*!< Master/slave mode selection. 
85                                       This parameter can be a value of @ref TIM_Master_Slave_Mode */
86 }TIM_MasterConfigTypeDef;
87
88 /** 
89   * @brief  TIM Break and Dead time configuration Structure definition  
90   */ 
91 typedef struct
92 {
93   uint32_t OffStateRunMode;             /*!< TIM off state in run mode.
94                                          This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */
95   uint32_t OffStateIDLEMode;          /*!< TIM off state in IDLE mode.
96                                          This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */
97   uint32_t LockLevel;                       /*!< TIM Lock level.
98                                          This parameter can be a value of @ref TIM_Lock_level */                             
99   uint32_t DeadTime;                        /*!< TIM dead Time. 
100                                          This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */
101   uint32_t BreakState;                    /*!< TIM Break State. 
102                                          This parameter can be a value of @ref TIM_Break_Input_enable_disable */
103   uint32_t BreakPolarity;                       /*!< TIM Break input polarity. 
104                                          This parameter can be a value of @ref TIM_Break_Polarity */
105   uint32_t AutomaticOutput;                   /*!< TIM Automatic Output Enable state. 
106                                          This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */           
107 }TIM_BreakDeadTimeConfigTypeDef;
108
109 /* Exported constants --------------------------------------------------------*/
110 /** @defgroup TIMEx_Exported_Constants
111   * @{
112   */
113   
114 /** @defgroup TIMEx_Remap 
115   * @{
116   */
117
118 #define TIM_TIM2_TIM8_TRGO                     (0x00000000)
119 #define TIM_TIM2_ETH_PTP                       (0x00000400)
120 #define TIM_TIM2_USBFS_SOF                     (0x00000800)
121 #define TIM_TIM2_USBHS_SOF                     (0x00000C00)
122 #define TIM_TIM5_GPIO                          (0x00000000)
123 #define TIM_TIM5_LSI                           (0x00000040)
124 #define TIM_TIM5_LSE                           (0x00000080)
125 #define TIM_TIM5_RTC                           (0x000000C0)
126 #define TIM_TIM11_GPIO                         (0x00000000)
127 #define TIM_TIM11_HSE                          (0x00000002)
128
129 #define IS_TIM_REMAP(TIM_REMAP)  (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\
130                                   ((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\
131                                   ((TIM_REMAP) == TIM_TIM2_USBFS_SOF)||\
132                                   ((TIM_REMAP) == TIM_TIM2_USBHS_SOF)||\
133                                   ((TIM_REMAP) == TIM_TIM5_GPIO)||\
134                                   ((TIM_REMAP) == TIM_TIM5_LSI)||\
135                                   ((TIM_REMAP) == TIM_TIM5_LSE)||\
136                                   ((TIM_REMAP) == TIM_TIM5_RTC)||\
137                                   ((TIM_REMAP) == TIM_TIM11_GPIO)||\
138                                   ((TIM_REMAP) == TIM_TIM11_HSE))
139
140 /**
141   * @}
142   */ 
143
144 /**
145   * @}
146   */   
147   
148 /* Exported macro ------------------------------------------------------------*/
149
150 /* Exported functions --------------------------------------------------------*/
151
152 /*  Timer Hall Sensor functions  **********************************************/
153 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef* htim, TIM_HallSensor_InitTypeDef* sConfig);
154 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef* htim);
155
156 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef* htim);
157 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef* htim);
158
159  /* Blocking mode: Polling */
160 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef* htim);
161 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef* htim);
162 /* Non-Blocking mode: Interrupt */
163 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef* htim);
164 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef* htim);
165 /* Non-Blocking mode: DMA */
166 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef* htim, uint32_t *pData, uint16_t Length);
167 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef* htim);
168
169 /*  Timer Complementary Output Compare functions  *****************************/
170 /* Blocking mode: Polling */
171 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef* htim, uint32_t Channel);
172 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel);
173
174 /* Non-Blocking mode: Interrupt */
175 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
176 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
177
178 /* Non-Blocking mode: DMA */
179 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
180 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel);
181
182 /*  Timer Complementary PWM functions  ****************************************/
183 /* Blocking mode: Polling */
184 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef* htim, uint32_t Channel);
185 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel);
186
187 /* Non-Blocking mode: Interrupt */
188 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
189 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
190 /* Non-Blocking mode: DMA */
191 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
192 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel);
193
194 /*  Timer Complementary One Pulse functions  **********************************/
195 /* Blocking mode: Polling */
196 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
197 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
198
199 /* Non-Blocking mode: Interrupt */
200 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
201 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
202
203 /* Extnsion Control functions  ************************************************/
204 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef* htim, uint32_t  InputTrigger, uint32_t  CommutationSource);
205 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef* htim, uint32_t  InputTrigger, uint32_t  CommutationSource);
206 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef* htim, uint32_t  InputTrigger, uint32_t  CommutationSource);
207 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef* htim, TIM_MasterConfigTypeDef * sMasterConfig);
208 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef* htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
209 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef* htim, uint32_t Remap);
210
211 /* Extension Callback *********************************************************/
212 void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef* htim);
213 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef* htim);
214 void HAL_TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
215
216 /* Extension Peripheral State functions  **************************************/
217 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef* htim);
218
219 /**
220   * @}
221   */ 
222
223 /**
224   * @}
225   */ 
226   
227 #ifdef __cplusplus
228 }
229 #endif
230
231 #endif /* __STM32F4xx_HAL_TIM_EX_H */
232
233 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/