The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
Mikchel
Date:
Sun May 03 16:04:42 2015 +0000
Revision:
99:7f6c6de930c0
Parent:
86:04dd9b1680ae
12

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f4xx_hal_tim_ex.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 86:04dd9b1680ae 5 * @version V1.1.0
bogdanm 86:04dd9b1680ae 6 * @date 19-June-2014
bogdanm 86:04dd9b1680ae 7 * @brief Header file of TIM HAL Extension module.
bogdanm 86:04dd9b1680ae 8 ******************************************************************************
bogdanm 86:04dd9b1680ae 9 * @attention
bogdanm 86:04dd9b1680ae 10 *
bogdanm 86:04dd9b1680ae 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 12 *
bogdanm 86:04dd9b1680ae 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 14 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 16 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 19 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 21 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 22 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 23 *
bogdanm 86:04dd9b1680ae 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 34 *
bogdanm 86:04dd9b1680ae 35 ******************************************************************************
bogdanm 86:04dd9b1680ae 36 */
bogdanm 86:04dd9b1680ae 37
bogdanm 86:04dd9b1680ae 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 86:04dd9b1680ae 39 #ifndef __STM32F4xx_HAL_TIM_EX_H
bogdanm 86:04dd9b1680ae 40 #define __STM32F4xx_HAL_TIM_EX_H
bogdanm 86:04dd9b1680ae 41
bogdanm 86:04dd9b1680ae 42 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 43 extern "C" {
bogdanm 86:04dd9b1680ae 44 #endif
bogdanm 86:04dd9b1680ae 45
bogdanm 86:04dd9b1680ae 46 /* Includes ------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 47 #include "stm32f4xx_hal_def.h"
bogdanm 86:04dd9b1680ae 48
bogdanm 86:04dd9b1680ae 49 /** @addtogroup STM32F4xx_HAL
bogdanm 86:04dd9b1680ae 50 * @{
bogdanm 86:04dd9b1680ae 51 */
bogdanm 86:04dd9b1680ae 52
bogdanm 86:04dd9b1680ae 53 /** @addtogroup TIMEx
bogdanm 86:04dd9b1680ae 54 * @{
bogdanm 86:04dd9b1680ae 55 */
bogdanm 86:04dd9b1680ae 56
bogdanm 86:04dd9b1680ae 57 /* Exported types ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 58
bogdanm 86:04dd9b1680ae 59 /**
bogdanm 86:04dd9b1680ae 60 * @brief TIM Hall sensor Configuration Structure definition
bogdanm 86:04dd9b1680ae 61 */
bogdanm 86:04dd9b1680ae 62
bogdanm 86:04dd9b1680ae 63 typedef struct
bogdanm 86:04dd9b1680ae 64 {
bogdanm 86:04dd9b1680ae 65
bogdanm 86:04dd9b1680ae 66 uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal.
bogdanm 86:04dd9b1680ae 67 This parameter can be a value of @ref TIM_Input_Capture_Polarity */
bogdanm 86:04dd9b1680ae 68
bogdanm 86:04dd9b1680ae 69 uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler.
bogdanm 86:04dd9b1680ae 70 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
bogdanm 86:04dd9b1680ae 71
bogdanm 86:04dd9b1680ae 72 uint32_t IC1Filter; /*!< Specifies the input capture filter.
bogdanm 86:04dd9b1680ae 73 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
bogdanm 86:04dd9b1680ae 74 uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
bogdanm 86:04dd9b1680ae 75 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
bogdanm 86:04dd9b1680ae 76 } TIM_HallSensor_InitTypeDef;
bogdanm 86:04dd9b1680ae 77
bogdanm 86:04dd9b1680ae 78 /**
bogdanm 86:04dd9b1680ae 79 * @brief TIM Master configuration Structure definition
bogdanm 86:04dd9b1680ae 80 */
bogdanm 86:04dd9b1680ae 81 typedef struct {
bogdanm 86:04dd9b1680ae 82 uint32_t MasterOutputTrigger; /*!< Trigger output (TRGO) selection.
bogdanm 86:04dd9b1680ae 83 This parameter can be a value of @ref TIM_Master_Mode_Selection */
bogdanm 86:04dd9b1680ae 84 uint32_t MasterSlaveMode; /*!< Master/slave mode selection.
bogdanm 86:04dd9b1680ae 85 This parameter can be a value of @ref TIM_Master_Slave_Mode */
bogdanm 86:04dd9b1680ae 86 }TIM_MasterConfigTypeDef;
bogdanm 86:04dd9b1680ae 87
bogdanm 86:04dd9b1680ae 88 /**
bogdanm 86:04dd9b1680ae 89 * @brief TIM Break and Dead time configuration Structure definition
bogdanm 86:04dd9b1680ae 90 */
bogdanm 86:04dd9b1680ae 91 typedef struct
bogdanm 86:04dd9b1680ae 92 {
bogdanm 86:04dd9b1680ae 93 uint32_t OffStateRunMode; /*!< TIM off state in run mode.
bogdanm 86:04dd9b1680ae 94 This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */
bogdanm 86:04dd9b1680ae 95 uint32_t OffStateIDLEMode; /*!< TIM off state in IDLE mode.
bogdanm 86:04dd9b1680ae 96 This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */
bogdanm 86:04dd9b1680ae 97 uint32_t LockLevel; /*!< TIM Lock level.
bogdanm 86:04dd9b1680ae 98 This parameter can be a value of @ref TIM_Lock_level */
bogdanm 86:04dd9b1680ae 99 uint32_t DeadTime; /*!< TIM dead Time.
bogdanm 86:04dd9b1680ae 100 This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */
bogdanm 86:04dd9b1680ae 101 uint32_t BreakState; /*!< TIM Break State.
bogdanm 86:04dd9b1680ae 102 This parameter can be a value of @ref TIM_Break_Input_enable_disable */
bogdanm 86:04dd9b1680ae 103 uint32_t BreakPolarity; /*!< TIM Break input polarity.
bogdanm 86:04dd9b1680ae 104 This parameter can be a value of @ref TIM_Break_Polarity */
bogdanm 86:04dd9b1680ae 105 uint32_t AutomaticOutput; /*!< TIM Automatic Output Enable state.
bogdanm 86:04dd9b1680ae 106 This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */
bogdanm 86:04dd9b1680ae 107 }TIM_BreakDeadTimeConfigTypeDef;
bogdanm 86:04dd9b1680ae 108
bogdanm 86:04dd9b1680ae 109 /* Exported constants --------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 110 /** @defgroup TIMEx_Exported_Constants
bogdanm 86:04dd9b1680ae 111 * @{
bogdanm 86:04dd9b1680ae 112 */
bogdanm 86:04dd9b1680ae 113
bogdanm 86:04dd9b1680ae 114 /** @defgroup TIMEx_Remap
bogdanm 86:04dd9b1680ae 115 * @{
bogdanm 86:04dd9b1680ae 116 */
bogdanm 86:04dd9b1680ae 117
bogdanm 86:04dd9b1680ae 118 #define TIM_TIM2_TIM8_TRGO (0x00000000)
bogdanm 86:04dd9b1680ae 119 #define TIM_TIM2_ETH_PTP (0x00000400)
bogdanm 86:04dd9b1680ae 120 #define TIM_TIM2_USBFS_SOF (0x00000800)
bogdanm 86:04dd9b1680ae 121 #define TIM_TIM2_USBHS_SOF (0x00000C00)
bogdanm 86:04dd9b1680ae 122 #define TIM_TIM5_GPIO (0x00000000)
bogdanm 86:04dd9b1680ae 123 #define TIM_TIM5_LSI (0x00000040)
bogdanm 86:04dd9b1680ae 124 #define TIM_TIM5_LSE (0x00000080)
bogdanm 86:04dd9b1680ae 125 #define TIM_TIM5_RTC (0x000000C0)
bogdanm 86:04dd9b1680ae 126 #define TIM_TIM11_GPIO (0x00000000)
bogdanm 86:04dd9b1680ae 127 #define TIM_TIM11_HSE (0x00000002)
bogdanm 86:04dd9b1680ae 128
bogdanm 86:04dd9b1680ae 129 #define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\
bogdanm 86:04dd9b1680ae 130 ((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\
bogdanm 86:04dd9b1680ae 131 ((TIM_REMAP) == TIM_TIM2_USBFS_SOF)||\
bogdanm 86:04dd9b1680ae 132 ((TIM_REMAP) == TIM_TIM2_USBHS_SOF)||\
bogdanm 86:04dd9b1680ae 133 ((TIM_REMAP) == TIM_TIM5_GPIO)||\
bogdanm 86:04dd9b1680ae 134 ((TIM_REMAP) == TIM_TIM5_LSI)||\
bogdanm 86:04dd9b1680ae 135 ((TIM_REMAP) == TIM_TIM5_LSE)||\
bogdanm 86:04dd9b1680ae 136 ((TIM_REMAP) == TIM_TIM5_RTC)||\
bogdanm 86:04dd9b1680ae 137 ((TIM_REMAP) == TIM_TIM11_GPIO)||\
bogdanm 86:04dd9b1680ae 138 ((TIM_REMAP) == TIM_TIM11_HSE))
bogdanm 86:04dd9b1680ae 139
bogdanm 86:04dd9b1680ae 140 /**
bogdanm 86:04dd9b1680ae 141 * @}
bogdanm 86:04dd9b1680ae 142 */
bogdanm 86:04dd9b1680ae 143
bogdanm 86:04dd9b1680ae 144 /**
bogdanm 86:04dd9b1680ae 145 * @}
bogdanm 86:04dd9b1680ae 146 */
bogdanm 86:04dd9b1680ae 147
bogdanm 86:04dd9b1680ae 148 /* Exported macro ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 149
bogdanm 86:04dd9b1680ae 150 /* Exported functions --------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 151
bogdanm 86:04dd9b1680ae 152 /* Timer Hall Sensor functions **********************************************/
bogdanm 86:04dd9b1680ae 153 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef* htim, TIM_HallSensor_InitTypeDef* sConfig);
bogdanm 86:04dd9b1680ae 154 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 155
bogdanm 86:04dd9b1680ae 156 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 157 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 158
bogdanm 86:04dd9b1680ae 159 /* Blocking mode: Polling */
bogdanm 86:04dd9b1680ae 160 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 161 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 162 /* Non-Blocking mode: Interrupt */
bogdanm 86:04dd9b1680ae 163 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 164 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 165 /* Non-Blocking mode: DMA */
bogdanm 86:04dd9b1680ae 166 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef* htim, uint32_t *pData, uint16_t Length);
bogdanm 86:04dd9b1680ae 167 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 168
bogdanm 86:04dd9b1680ae 169 /* Timer Complementary Output Compare functions *****************************/
bogdanm 86:04dd9b1680ae 170 /* Blocking mode: Polling */
bogdanm 86:04dd9b1680ae 171 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 172 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 173
bogdanm 86:04dd9b1680ae 174 /* Non-Blocking mode: Interrupt */
bogdanm 86:04dd9b1680ae 175 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 176 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 177
bogdanm 86:04dd9b1680ae 178 /* Non-Blocking mode: DMA */
bogdanm 86:04dd9b1680ae 179 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
bogdanm 86:04dd9b1680ae 180 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 181
bogdanm 86:04dd9b1680ae 182 /* Timer Complementary PWM functions ****************************************/
bogdanm 86:04dd9b1680ae 183 /* Blocking mode: Polling */
bogdanm 86:04dd9b1680ae 184 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 185 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 186
bogdanm 86:04dd9b1680ae 187 /* Non-Blocking mode: Interrupt */
bogdanm 86:04dd9b1680ae 188 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 189 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 190 /* Non-Blocking mode: DMA */
bogdanm 86:04dd9b1680ae 191 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
bogdanm 86:04dd9b1680ae 192 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel);
bogdanm 86:04dd9b1680ae 193
bogdanm 86:04dd9b1680ae 194 /* Timer Complementary One Pulse functions **********************************/
bogdanm 86:04dd9b1680ae 195 /* Blocking mode: Polling */
bogdanm 86:04dd9b1680ae 196 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
bogdanm 86:04dd9b1680ae 197 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
bogdanm 86:04dd9b1680ae 198
bogdanm 86:04dd9b1680ae 199 /* Non-Blocking mode: Interrupt */
bogdanm 86:04dd9b1680ae 200 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
bogdanm 86:04dd9b1680ae 201 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
bogdanm 86:04dd9b1680ae 202
bogdanm 86:04dd9b1680ae 203 /* Extnsion Control functions ************************************************/
bogdanm 86:04dd9b1680ae 204 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource);
bogdanm 86:04dd9b1680ae 205 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource);
bogdanm 86:04dd9b1680ae 206 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource);
bogdanm 86:04dd9b1680ae 207 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef* htim, TIM_MasterConfigTypeDef * sMasterConfig);
bogdanm 86:04dd9b1680ae 208 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef* htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
bogdanm 86:04dd9b1680ae 209 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef* htim, uint32_t Remap);
bogdanm 86:04dd9b1680ae 210
bogdanm 86:04dd9b1680ae 211 /* Extension Callback *********************************************************/
bogdanm 86:04dd9b1680ae 212 void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 213 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 214 void HAL_TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
bogdanm 86:04dd9b1680ae 215
bogdanm 86:04dd9b1680ae 216 /* Extension Peripheral State functions **************************************/
bogdanm 86:04dd9b1680ae 217 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef* htim);
bogdanm 86:04dd9b1680ae 218
bogdanm 86:04dd9b1680ae 219 /**
bogdanm 86:04dd9b1680ae 220 * @}
bogdanm 86:04dd9b1680ae 221 */
bogdanm 86:04dd9b1680ae 222
bogdanm 86:04dd9b1680ae 223 /**
bogdanm 86:04dd9b1680ae 224 * @}
bogdanm 86:04dd9b1680ae 225 */
bogdanm 86:04dd9b1680ae 226
bogdanm 86:04dd9b1680ae 227 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 228 }
bogdanm 86:04dd9b1680ae 229 #endif
bogdanm 86:04dd9b1680ae 230
bogdanm 86:04dd9b1680ae 231 #endif /* __STM32F4xx_HAL_TIM_EX_H */
bogdanm 86:04dd9b1680ae 232
bogdanm 86:04dd9b1680ae 233 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/