Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
116:c0f6e94411f5
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 115:87f2f5183dfb 1 /**
Kojto 115:87f2f5183dfb 2 ******************************************************************************
Kojto 115:87f2f5183dfb 3 * @file stm32f7xx_hal_tim.h
Kojto 115:87f2f5183dfb 4 * @author MCD Application Team
Kojto 116:c0f6e94411f5 5 * @version V1.0.4
Kojto 116:c0f6e94411f5 6 * @date 09-December-2015
Kojto 115:87f2f5183dfb 7 * @brief Header file of TIM HAL module.
Kojto 115:87f2f5183dfb 8 ******************************************************************************
Kojto 115:87f2f5183dfb 9 * @attention
Kojto 115:87f2f5183dfb 10 *
Kojto 115:87f2f5183dfb 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 115:87f2f5183dfb 12 *
Kojto 115:87f2f5183dfb 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 115:87f2f5183dfb 14 * are permitted provided that the following conditions are met:
Kojto 115:87f2f5183dfb 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 115:87f2f5183dfb 16 * this list of conditions and the following disclaimer.
Kojto 115:87f2f5183dfb 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 115:87f2f5183dfb 18 * this list of conditions and the following disclaimer in the documentation
Kojto 115:87f2f5183dfb 19 * and/or other materials provided with the distribution.
Kojto 115:87f2f5183dfb 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 115:87f2f5183dfb 21 * may be used to endorse or promote products derived from this software
Kojto 115:87f2f5183dfb 22 * without specific prior written permission.
Kojto 115:87f2f5183dfb 23 *
Kojto 115:87f2f5183dfb 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 115:87f2f5183dfb 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 115:87f2f5183dfb 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 115:87f2f5183dfb 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 115:87f2f5183dfb 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 115:87f2f5183dfb 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 115:87f2f5183dfb 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 115:87f2f5183dfb 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 115:87f2f5183dfb 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 115:87f2f5183dfb 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 115:87f2f5183dfb 34 *
Kojto 115:87f2f5183dfb 35 ******************************************************************************
Kojto 115:87f2f5183dfb 36 */
Kojto 115:87f2f5183dfb 37
Kojto 115:87f2f5183dfb 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 115:87f2f5183dfb 39 #ifndef __STM32F7xx_HAL_TIM_H
Kojto 115:87f2f5183dfb 40 #define __STM32F7xx_HAL_TIM_H
Kojto 115:87f2f5183dfb 41
Kojto 115:87f2f5183dfb 42 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 43 extern "C" {
Kojto 115:87f2f5183dfb 44 #endif
Kojto 115:87f2f5183dfb 45
Kojto 115:87f2f5183dfb 46 /* Includes ------------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 47 #include "stm32f7xx_hal_def.h"
Kojto 115:87f2f5183dfb 48
Kojto 115:87f2f5183dfb 49 /** @addtogroup STM32F7xx_HAL_Driver
Kojto 115:87f2f5183dfb 50 * @{
Kojto 115:87f2f5183dfb 51 */
Kojto 115:87f2f5183dfb 52
Kojto 115:87f2f5183dfb 53 /** @addtogroup TIM
Kojto 115:87f2f5183dfb 54 * @{
Kojto 115:87f2f5183dfb 55 */
Kojto 115:87f2f5183dfb 56
Kojto 115:87f2f5183dfb 57 /* Exported types ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 58 /** @defgroup TIM_Exported_Types TIM Exported Types
Kojto 115:87f2f5183dfb 59 * @{
Kojto 115:87f2f5183dfb 60 */
Kojto 115:87f2f5183dfb 61
Kojto 115:87f2f5183dfb 62 /**
Kojto 115:87f2f5183dfb 63 * @brief TIM Time base Configuration Structure definition
Kojto 115:87f2f5183dfb 64 */
Kojto 115:87f2f5183dfb 65 typedef struct
Kojto 115:87f2f5183dfb 66 {
Kojto 115:87f2f5183dfb 67 uint32_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock.
Kojto 115:87f2f5183dfb 68 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
Kojto 115:87f2f5183dfb 69
Kojto 115:87f2f5183dfb 70 uint32_t CounterMode; /*!< Specifies the counter mode.
Kojto 115:87f2f5183dfb 71 This parameter can be a value of @ref TIM_Counter_Mode */
Kojto 115:87f2f5183dfb 72
Kojto 115:87f2f5183dfb 73 uint32_t Period; /*!< Specifies the period value to be loaded into the active
Kojto 115:87f2f5183dfb 74 Auto-Reload Register at the next update event.
Kojto 115:87f2f5183dfb 75 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */
Kojto 115:87f2f5183dfb 76
Kojto 115:87f2f5183dfb 77 uint32_t ClockDivision; /*!< Specifies the clock division.
Kojto 115:87f2f5183dfb 78 This parameter can be a value of @ref TIM_ClockDivision */
Kojto 115:87f2f5183dfb 79
Kojto 115:87f2f5183dfb 80 uint32_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter
Kojto 115:87f2f5183dfb 81 reaches zero, an update event is generated and counting restarts
Kojto 115:87f2f5183dfb 82 from the RCR value (N).
Kojto 115:87f2f5183dfb 83 This means in PWM mode that (N+1) corresponds to:
Kojto 115:87f2f5183dfb 84 - the number of PWM periods in edge-aligned mode
Kojto 115:87f2f5183dfb 85 - the number of half PWM period in center-aligned mode
Kojto 115:87f2f5183dfb 86 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.
Kojto 115:87f2f5183dfb 87 @note This parameter is valid only for TIM1 and TIM8. */
Kojto 115:87f2f5183dfb 88 } TIM_Base_InitTypeDef;
Kojto 115:87f2f5183dfb 89
Kojto 115:87f2f5183dfb 90 /**
Kojto 115:87f2f5183dfb 91 * @brief TIM Output Compare Configuration Structure definition
Kojto 115:87f2f5183dfb 92 */
Kojto 115:87f2f5183dfb 93
Kojto 115:87f2f5183dfb 94 typedef struct
Kojto 115:87f2f5183dfb 95 {
Kojto 115:87f2f5183dfb 96 uint32_t OCMode; /*!< Specifies the TIM mode.
Kojto 115:87f2f5183dfb 97 This parameter can be a value of @ref TIMEx_Output_Compare_and_PWM_modes */
Kojto 115:87f2f5183dfb 98
Kojto 115:87f2f5183dfb 99 uint32_t Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
Kojto 115:87f2f5183dfb 100 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
Kojto 115:87f2f5183dfb 101
Kojto 115:87f2f5183dfb 102 uint32_t OCPolarity; /*!< Specifies the output polarity.
Kojto 115:87f2f5183dfb 103 This parameter can be a value of @ref TIM_Output_Compare_Polarity */
Kojto 115:87f2f5183dfb 104
Kojto 115:87f2f5183dfb 105 uint32_t OCNPolarity; /*!< Specifies the complementary output polarity.
Kojto 115:87f2f5183dfb 106 This parameter can be a value of @ref TIM_Output_Compare_N_Polarity
Kojto 115:87f2f5183dfb 107 @note This parameter is valid only for TIM1 and TIM8. */
Kojto 115:87f2f5183dfb 108
Kojto 115:87f2f5183dfb 109 uint32_t OCFastMode; /*!< Specifies the Fast mode state.
Kojto 115:87f2f5183dfb 110 This parameter can be a value of @ref TIM_Output_Fast_State
Kojto 115:87f2f5183dfb 111 @note This parameter is valid only in PWM1 and PWM2 mode. */
Kojto 115:87f2f5183dfb 112
Kojto 115:87f2f5183dfb 113
Kojto 115:87f2f5183dfb 114 uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
Kojto 115:87f2f5183dfb 115 This parameter can be a value of @ref TIM_Output_Compare_Idle_State
Kojto 115:87f2f5183dfb 116 @note This parameter is valid only for TIM1 and TIM8. */
Kojto 115:87f2f5183dfb 117
Kojto 115:87f2f5183dfb 118 uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
Kojto 115:87f2f5183dfb 119 This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State
Kojto 115:87f2f5183dfb 120 @note This parameter is valid only for TIM1 and TIM8. */
Kojto 115:87f2f5183dfb 121 } TIM_OC_InitTypeDef;
Kojto 115:87f2f5183dfb 122
Kojto 115:87f2f5183dfb 123 /**
Kojto 115:87f2f5183dfb 124 * @brief TIM One Pulse Mode Configuration Structure definition
Kojto 115:87f2f5183dfb 125 */
Kojto 115:87f2f5183dfb 126 typedef struct
Kojto 115:87f2f5183dfb 127 {
Kojto 115:87f2f5183dfb 128 uint32_t OCMode; /*!< Specifies the TIM mode.
Kojto 115:87f2f5183dfb 129 This parameter can be a value of @ref TIMEx_Output_Compare_and_PWM_modes */
Kojto 115:87f2f5183dfb 130
Kojto 115:87f2f5183dfb 131 uint32_t Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
Kojto 115:87f2f5183dfb 132 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
Kojto 115:87f2f5183dfb 133
Kojto 115:87f2f5183dfb 134 uint32_t OCPolarity; /*!< Specifies the output polarity.
Kojto 115:87f2f5183dfb 135 This parameter can be a value of @ref TIM_Output_Compare_Polarity */
Kojto 115:87f2f5183dfb 136
Kojto 115:87f2f5183dfb 137 uint32_t OCNPolarity; /*!< Specifies the complementary output polarity.
Kojto 115:87f2f5183dfb 138 This parameter can be a value of @ref TIM_Output_Compare_N_Polarity
Kojto 115:87f2f5183dfb 139 @note This parameter is valid only for TIM1 and TIM8. */
Kojto 115:87f2f5183dfb 140
Kojto 115:87f2f5183dfb 141 uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
Kojto 115:87f2f5183dfb 142 This parameter can be a value of @ref TIM_Output_Compare_Idle_State
Kojto 115:87f2f5183dfb 143 @note This parameter is valid only for TIM1 and TIM8. */
Kojto 115:87f2f5183dfb 144
Kojto 115:87f2f5183dfb 145 uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
Kojto 115:87f2f5183dfb 146 This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State
Kojto 115:87f2f5183dfb 147 @note This parameter is valid only for TIM1 and TIM8. */
Kojto 115:87f2f5183dfb 148
Kojto 115:87f2f5183dfb 149 uint32_t ICPolarity; /*!< Specifies the active edge of the input signal.
Kojto 115:87f2f5183dfb 150 This parameter can be a value of @ref TIM_Input_Capture_Polarity */
Kojto 115:87f2f5183dfb 151
Kojto 115:87f2f5183dfb 152 uint32_t ICSelection; /*!< Specifies the input.
Kojto 115:87f2f5183dfb 153 This parameter can be a value of @ref TIM_Input_Capture_Selection */
Kojto 115:87f2f5183dfb 154
Kojto 115:87f2f5183dfb 155 uint32_t ICFilter; /*!< Specifies the input capture filter.
Kojto 115:87f2f5183dfb 156 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
Kojto 115:87f2f5183dfb 157 } TIM_OnePulse_InitTypeDef;
Kojto 115:87f2f5183dfb 158
Kojto 115:87f2f5183dfb 159
Kojto 115:87f2f5183dfb 160 /**
Kojto 115:87f2f5183dfb 161 * @brief TIM Input Capture Configuration Structure definition
Kojto 115:87f2f5183dfb 162 */
Kojto 115:87f2f5183dfb 163
Kojto 115:87f2f5183dfb 164 typedef struct
Kojto 115:87f2f5183dfb 165 {
Kojto 115:87f2f5183dfb 166 uint32_t ICPolarity; /*!< Specifies the active edge of the input signal.
Kojto 115:87f2f5183dfb 167 This parameter can be a value of @ref TIM_Input_Capture_Polarity */
Kojto 115:87f2f5183dfb 168
Kojto 115:87f2f5183dfb 169 uint32_t ICSelection; /*!< Specifies the input.
Kojto 115:87f2f5183dfb 170 This parameter can be a value of @ref TIM_Input_Capture_Selection */
Kojto 115:87f2f5183dfb 171
Kojto 115:87f2f5183dfb 172 uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler.
Kojto 115:87f2f5183dfb 173 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
Kojto 115:87f2f5183dfb 174
Kojto 115:87f2f5183dfb 175 uint32_t ICFilter; /*!< Specifies the input capture filter.
Kojto 115:87f2f5183dfb 176 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
Kojto 115:87f2f5183dfb 177 } TIM_IC_InitTypeDef;
Kojto 115:87f2f5183dfb 178
Kojto 115:87f2f5183dfb 179 /**
Kojto 115:87f2f5183dfb 180 * @brief TIM Encoder Configuration Structure definition
Kojto 115:87f2f5183dfb 181 */
Kojto 115:87f2f5183dfb 182
Kojto 115:87f2f5183dfb 183 typedef struct
Kojto 115:87f2f5183dfb 184 {
Kojto 115:87f2f5183dfb 185 uint32_t EncoderMode; /*!< Specifies the active edge of the input signal.
Kojto 115:87f2f5183dfb 186 This parameter can be a value of @ref TIM_Encoder_Mode */
Kojto 115:87f2f5183dfb 187
Kojto 115:87f2f5183dfb 188 uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal.
Kojto 115:87f2f5183dfb 189 This parameter can be a value of @ref TIM_Input_Capture_Polarity */
Kojto 115:87f2f5183dfb 190
Kojto 115:87f2f5183dfb 191 uint32_t IC1Selection; /*!< Specifies the input.
Kojto 115:87f2f5183dfb 192 This parameter can be a value of @ref TIM_Input_Capture_Selection */
Kojto 115:87f2f5183dfb 193
Kojto 115:87f2f5183dfb 194 uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler.
Kojto 115:87f2f5183dfb 195 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
Kojto 115:87f2f5183dfb 196
Kojto 115:87f2f5183dfb 197 uint32_t IC1Filter; /*!< Specifies the input capture filter.
Kojto 115:87f2f5183dfb 198 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
Kojto 115:87f2f5183dfb 199
Kojto 115:87f2f5183dfb 200 uint32_t IC2Polarity; /*!< Specifies the active edge of the input signal.
Kojto 115:87f2f5183dfb 201 This parameter can be a value of @ref TIM_Input_Capture_Polarity */
Kojto 115:87f2f5183dfb 202
Kojto 115:87f2f5183dfb 203 uint32_t IC2Selection; /*!< Specifies the input.
Kojto 115:87f2f5183dfb 204 This parameter can be a value of @ref TIM_Input_Capture_Selection */
Kojto 115:87f2f5183dfb 205
Kojto 115:87f2f5183dfb 206 uint32_t IC2Prescaler; /*!< Specifies the Input Capture Prescaler.
Kojto 115:87f2f5183dfb 207 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
Kojto 115:87f2f5183dfb 208
Kojto 115:87f2f5183dfb 209 uint32_t IC2Filter; /*!< Specifies the input capture filter.
Kojto 115:87f2f5183dfb 210 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
Kojto 115:87f2f5183dfb 211 } TIM_Encoder_InitTypeDef;
Kojto 115:87f2f5183dfb 212
Kojto 115:87f2f5183dfb 213 /**
Kojto 115:87f2f5183dfb 214 * @brief Clock Configuration Handle Structure definition
Kojto 115:87f2f5183dfb 215 */
Kojto 115:87f2f5183dfb 216 typedef struct
Kojto 115:87f2f5183dfb 217 {
Kojto 115:87f2f5183dfb 218 uint32_t ClockSource; /*!< TIM clock sources.
Kojto 115:87f2f5183dfb 219 This parameter can be a value of @ref TIM_Clock_Source */
Kojto 115:87f2f5183dfb 220 uint32_t ClockPolarity; /*!< TIM clock polarity.
Kojto 115:87f2f5183dfb 221 This parameter can be a value of @ref TIM_Clock_Polarity */
Kojto 115:87f2f5183dfb 222 uint32_t ClockPrescaler; /*!< TIM clock prescaler.
Kojto 115:87f2f5183dfb 223 This parameter can be a value of @ref TIM_Clock_Prescaler */
Kojto 115:87f2f5183dfb 224 uint32_t ClockFilter; /*!< TIM clock filter.
Kojto 115:87f2f5183dfb 225 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
Kojto 115:87f2f5183dfb 226 }TIM_ClockConfigTypeDef;
Kojto 115:87f2f5183dfb 227
Kojto 115:87f2f5183dfb 228 /**
Kojto 115:87f2f5183dfb 229 * @brief Clear Input Configuration Handle Structure definition
Kojto 115:87f2f5183dfb 230 */
Kojto 115:87f2f5183dfb 231 typedef struct
Kojto 115:87f2f5183dfb 232 {
Kojto 115:87f2f5183dfb 233 uint32_t ClearInputState; /*!< TIM clear Input state.
Kojto 115:87f2f5183dfb 234 This parameter can be ENABLE or DISABLE */
Kojto 115:87f2f5183dfb 235 uint32_t ClearInputSource; /*!< TIM clear Input sources.
Kojto 115:87f2f5183dfb 236 This parameter can be a value of @ref TIMEx_ClearInput_Source */
Kojto 115:87f2f5183dfb 237 uint32_t ClearInputPolarity; /*!< TIM Clear Input polarity.
Kojto 115:87f2f5183dfb 238 This parameter can be a value of @ref TIM_ClearInput_Polarity */
Kojto 115:87f2f5183dfb 239 uint32_t ClearInputPrescaler; /*!< TIM Clear Input prescaler.
Kojto 115:87f2f5183dfb 240 This parameter can be a value of @ref TIM_ClearInput_Prescaler */
Kojto 115:87f2f5183dfb 241 uint32_t ClearInputFilter; /*!< TIM Clear Input filter.
Kojto 115:87f2f5183dfb 242 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
Kojto 115:87f2f5183dfb 243 }TIM_ClearInputConfigTypeDef;
Kojto 115:87f2f5183dfb 244
Kojto 115:87f2f5183dfb 245 /**
Kojto 115:87f2f5183dfb 246 * @brief TIM Slave configuration Structure definition
Kojto 115:87f2f5183dfb 247 */
Kojto 115:87f2f5183dfb 248 typedef struct {
Kojto 115:87f2f5183dfb 249 uint32_t SlaveMode; /*!< Slave mode selection
Kojto 115:87f2f5183dfb 250 This parameter can be a value of @ref TIMEx_Slave_Mode */
Kojto 115:87f2f5183dfb 251 uint32_t InputTrigger; /*!< Input Trigger source
Kojto 115:87f2f5183dfb 252 This parameter can be a value of @ref TIM_Trigger_Selection */
Kojto 115:87f2f5183dfb 253 uint32_t TriggerPolarity; /*!< Input Trigger polarity
Kojto 115:87f2f5183dfb 254 This parameter can be a value of @ref TIM_Trigger_Polarity */
Kojto 115:87f2f5183dfb 255 uint32_t TriggerPrescaler; /*!< Input trigger prescaler
Kojto 115:87f2f5183dfb 256 This parameter can be a value of @ref TIM_Trigger_Prescaler */
Kojto 115:87f2f5183dfb 257 uint32_t TriggerFilter; /*!< Input trigger filter
Kojto 115:87f2f5183dfb 258 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
Kojto 115:87f2f5183dfb 259
Kojto 115:87f2f5183dfb 260 }TIM_SlaveConfigTypeDef;
Kojto 115:87f2f5183dfb 261
Kojto 115:87f2f5183dfb 262 /**
Kojto 115:87f2f5183dfb 263 * @brief HAL State structures definition
Kojto 115:87f2f5183dfb 264 */
Kojto 115:87f2f5183dfb 265 typedef enum
Kojto 115:87f2f5183dfb 266 {
Kojto 115:87f2f5183dfb 267 HAL_TIM_STATE_RESET = 0x00, /*!< Peripheral not yet initialized or disabled */
Kojto 115:87f2f5183dfb 268 HAL_TIM_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
Kojto 115:87f2f5183dfb 269 HAL_TIM_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
Kojto 115:87f2f5183dfb 270 HAL_TIM_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 115:87f2f5183dfb 271 HAL_TIM_STATE_ERROR = 0x04 /*!< Reception process is ongoing */
Kojto 115:87f2f5183dfb 272 }HAL_TIM_StateTypeDef;
Kojto 115:87f2f5183dfb 273
Kojto 115:87f2f5183dfb 274 /**
Kojto 115:87f2f5183dfb 275 * @brief HAL Active channel structures definition
Kojto 115:87f2f5183dfb 276 */
Kojto 115:87f2f5183dfb 277 typedef enum
Kojto 115:87f2f5183dfb 278 {
Kojto 115:87f2f5183dfb 279 HAL_TIM_ACTIVE_CHANNEL_1 = 0x01, /*!< The active channel is 1 */
Kojto 115:87f2f5183dfb 280 HAL_TIM_ACTIVE_CHANNEL_2 = 0x02, /*!< The active channel is 2 */
Kojto 115:87f2f5183dfb 281 HAL_TIM_ACTIVE_CHANNEL_3 = 0x04, /*!< The active channel is 3 */
Kojto 115:87f2f5183dfb 282 HAL_TIM_ACTIVE_CHANNEL_4 = 0x08, /*!< The active channel is 4 */
Kojto 115:87f2f5183dfb 283 HAL_TIM_ACTIVE_CHANNEL_CLEARED = 0x00 /*!< All active channels cleared */
Kojto 115:87f2f5183dfb 284 }HAL_TIM_ActiveChannel;
Kojto 115:87f2f5183dfb 285
Kojto 115:87f2f5183dfb 286 /**
Kojto 115:87f2f5183dfb 287 * @brief TIM Time Base Handle Structure definition
Kojto 115:87f2f5183dfb 288 */
Kojto 115:87f2f5183dfb 289 typedef struct
Kojto 115:87f2f5183dfb 290 {
Kojto 115:87f2f5183dfb 291 TIM_TypeDef *Instance; /*!< Register base address */
Kojto 115:87f2f5183dfb 292 TIM_Base_InitTypeDef Init; /*!< TIM Time Base required parameters */
Kojto 115:87f2f5183dfb 293 HAL_TIM_ActiveChannel Channel; /*!< Active channel */
Kojto 115:87f2f5183dfb 294 DMA_HandleTypeDef *hdma[7]; /*!< DMA Handlers array
Kojto 115:87f2f5183dfb 295 This array is accessed by a @ref DMA_Handle_index */
Kojto 115:87f2f5183dfb 296 HAL_LockTypeDef Lock; /*!< Locking object */
Kojto 115:87f2f5183dfb 297 __IO HAL_TIM_StateTypeDef State; /*!< TIM operation state */
Kojto 115:87f2f5183dfb 298 }TIM_HandleTypeDef;
Kojto 115:87f2f5183dfb 299 /**
Kojto 115:87f2f5183dfb 300 * @}
Kojto 115:87f2f5183dfb 301 */
Kojto 115:87f2f5183dfb 302
Kojto 115:87f2f5183dfb 303 /* Exported constants --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 304 /** @defgroup TIM_Exported_Constants TIM Exported Constants
Kojto 115:87f2f5183dfb 305 * @{
Kojto 115:87f2f5183dfb 306 */
Kojto 115:87f2f5183dfb 307
Kojto 115:87f2f5183dfb 308 /** @defgroup TIM_Input_Channel_Polarity TIM Input Channel Polarity
Kojto 115:87f2f5183dfb 309 * @{
Kojto 115:87f2f5183dfb 310 */
Kojto 115:87f2f5183dfb 311 #define TIM_INPUTCHANNELPOLARITY_RISING ((uint32_t)0x00000000) /*!< Polarity for TIx source */
Kojto 115:87f2f5183dfb 312 #define TIM_INPUTCHANNELPOLARITY_FALLING (TIM_CCER_CC1P) /*!< Polarity for TIx source */
Kojto 115:87f2f5183dfb 313 #define TIM_INPUTCHANNELPOLARITY_BOTHEDGE (TIM_CCER_CC1P | TIM_CCER_CC1NP) /*!< Polarity for TIx source */
Kojto 115:87f2f5183dfb 314 /**
Kojto 115:87f2f5183dfb 315 * @}
Kojto 115:87f2f5183dfb 316 */
Kojto 115:87f2f5183dfb 317
Kojto 115:87f2f5183dfb 318 /** @defgroup TIM_ETR_Polarity TIM ETR Polarity
Kojto 115:87f2f5183dfb 319 * @{
Kojto 115:87f2f5183dfb 320 */
Kojto 115:87f2f5183dfb 321 #define TIM_ETRPOLARITY_INVERTED (TIM_SMCR_ETP) /*!< Polarity for ETR source */
Kojto 115:87f2f5183dfb 322 #define TIM_ETRPOLARITY_NONINVERTED ((uint32_t)0x0000) /*!< Polarity for ETR source */
Kojto 115:87f2f5183dfb 323 /**
Kojto 115:87f2f5183dfb 324 * @}
Kojto 115:87f2f5183dfb 325 */
Kojto 115:87f2f5183dfb 326
Kojto 115:87f2f5183dfb 327 /** @defgroup TIM_ETR_Prescaler TIM ETR Prescaler
Kojto 115:87f2f5183dfb 328 * @{
Kojto 115:87f2f5183dfb 329 */
Kojto 115:87f2f5183dfb 330 #define TIM_ETRPRESCALER_DIV1 ((uint32_t)0x0000) /*!< No prescaler is used */
Kojto 115:87f2f5183dfb 331 #define TIM_ETRPRESCALER_DIV2 (TIM_SMCR_ETPS_0) /*!< ETR input source is divided by 2 */
Kojto 115:87f2f5183dfb 332 #define TIM_ETRPRESCALER_DIV4 (TIM_SMCR_ETPS_1) /*!< ETR input source is divided by 4 */
Kojto 115:87f2f5183dfb 333 #define TIM_ETRPRESCALER_DIV8 (TIM_SMCR_ETPS) /*!< ETR input source is divided by 8 */
Kojto 115:87f2f5183dfb 334 /**
Kojto 115:87f2f5183dfb 335 * @}
Kojto 115:87f2f5183dfb 336 */
Kojto 115:87f2f5183dfb 337
Kojto 115:87f2f5183dfb 338 /** @defgroup TIM_Counter_Mode TIM Counter Mode
Kojto 115:87f2f5183dfb 339 * @{
Kojto 115:87f2f5183dfb 340 */
Kojto 115:87f2f5183dfb 341 #define TIM_COUNTERMODE_UP ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 342 #define TIM_COUNTERMODE_DOWN TIM_CR1_DIR
Kojto 115:87f2f5183dfb 343 #define TIM_COUNTERMODE_CENTERALIGNED1 TIM_CR1_CMS_0
Kojto 115:87f2f5183dfb 344 #define TIM_COUNTERMODE_CENTERALIGNED2 TIM_CR1_CMS_1
Kojto 115:87f2f5183dfb 345 #define TIM_COUNTERMODE_CENTERALIGNED3 TIM_CR1_CMS
Kojto 115:87f2f5183dfb 346 /**
Kojto 115:87f2f5183dfb 347 * @}
Kojto 115:87f2f5183dfb 348 */
Kojto 115:87f2f5183dfb 349
Kojto 115:87f2f5183dfb 350 /** @defgroup TIM_ClockDivision TIM Clock Division
Kojto 115:87f2f5183dfb 351 * @{
Kojto 115:87f2f5183dfb 352 */
Kojto 115:87f2f5183dfb 353 #define TIM_CLOCKDIVISION_DIV1 ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 354 #define TIM_CLOCKDIVISION_DIV2 (TIM_CR1_CKD_0)
Kojto 115:87f2f5183dfb 355 #define TIM_CLOCKDIVISION_DIV4 (TIM_CR1_CKD_1)
Kojto 115:87f2f5183dfb 356 /**
Kojto 115:87f2f5183dfb 357 * @}
Kojto 115:87f2f5183dfb 358 */
Kojto 115:87f2f5183dfb 359
Kojto 115:87f2f5183dfb 360 /** @defgroup TIM_Output_Compare_State TIM Output Compare State
Kojto 115:87f2f5183dfb 361 * @{
Kojto 115:87f2f5183dfb 362 */
Kojto 115:87f2f5183dfb 363 #define TIM_OUTPUTSTATE_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 364 #define TIM_OUTPUTSTATE_ENABLE (TIM_CCER_CC1E)
Kojto 115:87f2f5183dfb 365
Kojto 115:87f2f5183dfb 366 /**
Kojto 115:87f2f5183dfb 367 * @}
Kojto 115:87f2f5183dfb 368 */
Kojto 115:87f2f5183dfb 369
Kojto 115:87f2f5183dfb 370 /** @defgroup TIM_Output_Fast_State TIM Output Fast State
Kojto 115:87f2f5183dfb 371 * @{
Kojto 115:87f2f5183dfb 372 */
Kojto 115:87f2f5183dfb 373 #define TIM_OCFAST_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 374 #define TIM_OCFAST_ENABLE (TIM_CCMR1_OC1FE)
Kojto 115:87f2f5183dfb 375 /**
Kojto 115:87f2f5183dfb 376 * @}
Kojto 115:87f2f5183dfb 377 */
Kojto 115:87f2f5183dfb 378
Kojto 115:87f2f5183dfb 379 /** @defgroup TIM_Output_Compare_N_State TIM Complementary Output Compare State
Kojto 115:87f2f5183dfb 380 * @{
Kojto 115:87f2f5183dfb 381 */
Kojto 115:87f2f5183dfb 382 #define TIM_OUTPUTNSTATE_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 383 #define TIM_OUTPUTNSTATE_ENABLE (TIM_CCER_CC1NE)
Kojto 115:87f2f5183dfb 384 /**
Kojto 115:87f2f5183dfb 385 * @}
Kojto 115:87f2f5183dfb 386 */
Kojto 115:87f2f5183dfb 387
Kojto 115:87f2f5183dfb 388 /** @defgroup TIM_Output_Compare_Polarity TIM Output Compare Polarity
Kojto 115:87f2f5183dfb 389 * @{
Kojto 115:87f2f5183dfb 390 */
Kojto 115:87f2f5183dfb 391 #define TIM_OCPOLARITY_HIGH ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 392 #define TIM_OCPOLARITY_LOW (TIM_CCER_CC1P)
Kojto 115:87f2f5183dfb 393 /**
Kojto 115:87f2f5183dfb 394 * @}
Kojto 115:87f2f5183dfb 395 */
Kojto 115:87f2f5183dfb 396
Kojto 115:87f2f5183dfb 397 /** @defgroup TIM_Output_Compare_N_Polarity TIM Complementary Output Compare Polarity
Kojto 115:87f2f5183dfb 398 * @{
Kojto 115:87f2f5183dfb 399 */
Kojto 115:87f2f5183dfb 400 #define TIM_OCNPOLARITY_HIGH ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 401 #define TIM_OCNPOLARITY_LOW (TIM_CCER_CC1NP)
Kojto 115:87f2f5183dfb 402 /**
Kojto 115:87f2f5183dfb 403 * @}
Kojto 115:87f2f5183dfb 404 */
Kojto 115:87f2f5183dfb 405
Kojto 115:87f2f5183dfb 406 /** @defgroup TIM_Output_Compare_Idle_State TIM Output Compare Idle State
Kojto 115:87f2f5183dfb 407 * @{
Kojto 115:87f2f5183dfb 408 */
Kojto 115:87f2f5183dfb 409 #define TIM_OCIDLESTATE_SET (TIM_CR2_OIS1)
Kojto 115:87f2f5183dfb 410 #define TIM_OCIDLESTATE_RESET ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 411 /**
Kojto 115:87f2f5183dfb 412 * @}
Kojto 115:87f2f5183dfb 413 */
Kojto 115:87f2f5183dfb 414
Kojto 115:87f2f5183dfb 415 /** @defgroup TIM_Output_Compare_N_Idle_State TIM Output Compare N Idle State
Kojto 115:87f2f5183dfb 416 * @{
Kojto 115:87f2f5183dfb 417 */
Kojto 115:87f2f5183dfb 418 #define TIM_OCNIDLESTATE_SET (TIM_CR2_OIS1N)
Kojto 115:87f2f5183dfb 419 #define TIM_OCNIDLESTATE_RESET ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 420 /**
Kojto 115:87f2f5183dfb 421 * @}
Kojto 115:87f2f5183dfb 422 */
Kojto 115:87f2f5183dfb 423
Kojto 115:87f2f5183dfb 424 /** @defgroup TIM_Input_Capture_Polarity TIM Input Capture Polarity
Kojto 115:87f2f5183dfb 425 * @{
Kojto 115:87f2f5183dfb 426 */
Kojto 115:87f2f5183dfb 427 #define TIM_ICPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
Kojto 115:87f2f5183dfb 428 #define TIM_ICPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
Kojto 115:87f2f5183dfb 429 #define TIM_ICPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE
Kojto 115:87f2f5183dfb 430 /**
Kojto 115:87f2f5183dfb 431 * @}
Kojto 115:87f2f5183dfb 432 */
Kojto 115:87f2f5183dfb 433
Kojto 115:87f2f5183dfb 434 /** @defgroup TIM_Input_Capture_Selection TIM Input Capture Selection
Kojto 115:87f2f5183dfb 435 * @{
Kojto 115:87f2f5183dfb 436 */
Kojto 115:87f2f5183dfb 437 #define TIM_ICSELECTION_DIRECTTI (TIM_CCMR1_CC1S_0) /*!< TIM Input 1, 2, 3 or 4 is selected to be
Kojto 115:87f2f5183dfb 438 connected to IC1, IC2, IC3 or IC4, respectively */
Kojto 115:87f2f5183dfb 439 #define TIM_ICSELECTION_INDIRECTTI (TIM_CCMR1_CC1S_1) /*!< TIM Input 1, 2, 3 or 4 is selected to be
Kojto 115:87f2f5183dfb 440 connected to IC2, IC1, IC4 or IC3, respectively */
Kojto 115:87f2f5183dfb 441 #define TIM_ICSELECTION_TRC (TIM_CCMR1_CC1S) /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to TRC */
Kojto 115:87f2f5183dfb 442
Kojto 115:87f2f5183dfb 443 /**
Kojto 115:87f2f5183dfb 444 * @}
Kojto 115:87f2f5183dfb 445 */
Kojto 115:87f2f5183dfb 446
Kojto 115:87f2f5183dfb 447 /** @defgroup TIM_Input_Capture_Prescaler TIM Input Capture Prescaler
Kojto 115:87f2f5183dfb 448 * @{
Kojto 115:87f2f5183dfb 449 */
Kojto 115:87f2f5183dfb 450 #define TIM_ICPSC_DIV1 ((uint32_t)0x0000) /*!< Capture performed each time an edge is detected on the capture input */
Kojto 115:87f2f5183dfb 451 #define TIM_ICPSC_DIV2 (TIM_CCMR1_IC1PSC_0) /*!< Capture performed once every 2 events */
Kojto 115:87f2f5183dfb 452 #define TIM_ICPSC_DIV4 (TIM_CCMR1_IC1PSC_1) /*!< Capture performed once every 4 events */
Kojto 115:87f2f5183dfb 453 #define TIM_ICPSC_DIV8 (TIM_CCMR1_IC1PSC) /*!< Capture performed once every 8 events */
Kojto 115:87f2f5183dfb 454 /**
Kojto 115:87f2f5183dfb 455 * @}
Kojto 115:87f2f5183dfb 456 */
Kojto 115:87f2f5183dfb 457
Kojto 115:87f2f5183dfb 458 /** @defgroup TIM_One_Pulse_Mode TIM One Pulse Mode
Kojto 115:87f2f5183dfb 459 * @{
Kojto 115:87f2f5183dfb 460 */
Kojto 115:87f2f5183dfb 461 #define TIM_OPMODE_SINGLE (TIM_CR1_OPM)
Kojto 115:87f2f5183dfb 462 #define TIM_OPMODE_REPETITIVE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 463 /**
Kojto 115:87f2f5183dfb 464 * @}
Kojto 115:87f2f5183dfb 465 */
Kojto 115:87f2f5183dfb 466
Kojto 115:87f2f5183dfb 467 /** @defgroup TIM_Encoder_Mode TIM Encoder Mode
Kojto 115:87f2f5183dfb 468 * @{
Kojto 115:87f2f5183dfb 469 */
Kojto 115:87f2f5183dfb 470 #define TIM_ENCODERMODE_TI1 (TIM_SMCR_SMS_0)
Kojto 115:87f2f5183dfb 471 #define TIM_ENCODERMODE_TI2 (TIM_SMCR_SMS_1)
Kojto 115:87f2f5183dfb 472 #define TIM_ENCODERMODE_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0)
Kojto 115:87f2f5183dfb 473
Kojto 115:87f2f5183dfb 474 /**
Kojto 115:87f2f5183dfb 475 * @}
Kojto 115:87f2f5183dfb 476 */
Kojto 115:87f2f5183dfb 477
Kojto 115:87f2f5183dfb 478 /** @defgroup TIM_Interrupt_definition TIM Interrupt definition
Kojto 115:87f2f5183dfb 479 * @{
Kojto 115:87f2f5183dfb 480 */
Kojto 115:87f2f5183dfb 481 #define TIM_IT_UPDATE (TIM_DIER_UIE)
Kojto 115:87f2f5183dfb 482 #define TIM_IT_CC1 (TIM_DIER_CC1IE)
Kojto 115:87f2f5183dfb 483 #define TIM_IT_CC2 (TIM_DIER_CC2IE)
Kojto 115:87f2f5183dfb 484 #define TIM_IT_CC3 (TIM_DIER_CC3IE)
Kojto 115:87f2f5183dfb 485 #define TIM_IT_CC4 (TIM_DIER_CC4IE)
Kojto 115:87f2f5183dfb 486 #define TIM_IT_COM (TIM_DIER_COMIE)
Kojto 115:87f2f5183dfb 487 #define TIM_IT_TRIGGER (TIM_DIER_TIE)
Kojto 115:87f2f5183dfb 488 #define TIM_IT_BREAK (TIM_DIER_BIE)
Kojto 115:87f2f5183dfb 489 /**
Kojto 115:87f2f5183dfb 490 * @}
Kojto 115:87f2f5183dfb 491 */
Kojto 115:87f2f5183dfb 492
Kojto 115:87f2f5183dfb 493 /** @defgroup TIM_Commutation_Source TIM Commutation Source
Kojto 115:87f2f5183dfb 494 * @{
Kojto 115:87f2f5183dfb 495 */
Kojto 115:87f2f5183dfb 496 #define TIM_COMMUTATION_TRGI (TIM_CR2_CCUS)
Kojto 115:87f2f5183dfb 497 #define TIM_COMMUTATION_SOFTWARE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 498 /**
Kojto 115:87f2f5183dfb 499 * @}
Kojto 115:87f2f5183dfb 500 */
Kojto 115:87f2f5183dfb 501
Kojto 115:87f2f5183dfb 502 /** @defgroup TIM_DMA_sources TIM DMA sources
Kojto 115:87f2f5183dfb 503 * @{
Kojto 115:87f2f5183dfb 504 */
Kojto 115:87f2f5183dfb 505 #define TIM_DMA_UPDATE (TIM_DIER_UDE)
Kojto 115:87f2f5183dfb 506 #define TIM_DMA_CC1 (TIM_DIER_CC1DE)
Kojto 115:87f2f5183dfb 507 #define TIM_DMA_CC2 (TIM_DIER_CC2DE)
Kojto 115:87f2f5183dfb 508 #define TIM_DMA_CC3 (TIM_DIER_CC3DE)
Kojto 115:87f2f5183dfb 509 #define TIM_DMA_CC4 (TIM_DIER_CC4DE)
Kojto 115:87f2f5183dfb 510 #define TIM_DMA_COM (TIM_DIER_COMDE)
Kojto 115:87f2f5183dfb 511 #define TIM_DMA_TRIGGER (TIM_DIER_TDE)
Kojto 115:87f2f5183dfb 512 /**
Kojto 115:87f2f5183dfb 513 * @}
Kojto 115:87f2f5183dfb 514 */
Kojto 115:87f2f5183dfb 515
Kojto 115:87f2f5183dfb 516 /** @defgroup TIM_Event_Source TIM Event Source
Kojto 115:87f2f5183dfb 517 * @{
Kojto 115:87f2f5183dfb 518 */
Kojto 115:87f2f5183dfb 519 #define TIM_EVENTSOURCE_UPDATE TIM_EGR_UG
Kojto 115:87f2f5183dfb 520 #define TIM_EVENTSOURCE_CC1 TIM_EGR_CC1G
Kojto 115:87f2f5183dfb 521 #define TIM_EVENTSOURCE_CC2 TIM_EGR_CC2G
Kojto 115:87f2f5183dfb 522 #define TIM_EVENTSOURCE_CC3 TIM_EGR_CC3G
Kojto 115:87f2f5183dfb 523 #define TIM_EVENTSOURCE_CC4 TIM_EGR_CC4G
Kojto 115:87f2f5183dfb 524 #define TIM_EVENTSOURCE_COM TIM_EGR_COMG
Kojto 115:87f2f5183dfb 525 #define TIM_EVENTSOURCE_TRIGGER TIM_EGR_TG
Kojto 115:87f2f5183dfb 526 #define TIM_EVENTSOURCE_BREAK TIM_EGR_BG
Kojto 115:87f2f5183dfb 527 #define TIM_EVENTSOURCE_BREAK2 TIM_EGR_B2G
Kojto 115:87f2f5183dfb 528 /**
Kojto 115:87f2f5183dfb 529 * @}
Kojto 115:87f2f5183dfb 530 */
Kojto 115:87f2f5183dfb 531
Kojto 115:87f2f5183dfb 532 /** @defgroup TIM_Flag_definition TIM Flag definition
Kojto 115:87f2f5183dfb 533 * @{
Kojto 115:87f2f5183dfb 534 */
Kojto 115:87f2f5183dfb 535 #define TIM_FLAG_UPDATE (TIM_SR_UIF)
Kojto 115:87f2f5183dfb 536 #define TIM_FLAG_CC1 (TIM_SR_CC1IF)
Kojto 115:87f2f5183dfb 537 #define TIM_FLAG_CC2 (TIM_SR_CC2IF)
Kojto 115:87f2f5183dfb 538 #define TIM_FLAG_CC3 (TIM_SR_CC3IF)
Kojto 115:87f2f5183dfb 539 #define TIM_FLAG_CC4 (TIM_SR_CC4IF)
Kojto 115:87f2f5183dfb 540 #define TIM_FLAG_COM (TIM_SR_COMIF)
Kojto 115:87f2f5183dfb 541 #define TIM_FLAG_TRIGGER (TIM_SR_TIF)
Kojto 115:87f2f5183dfb 542 #define TIM_FLAG_BREAK (TIM_SR_BIF)
Kojto 115:87f2f5183dfb 543 #define TIM_FLAG_BREAK2 (TIM_SR_B2IF)
Kojto 115:87f2f5183dfb 544 #define TIM_FLAG_CC1OF (TIM_SR_CC1OF)
Kojto 115:87f2f5183dfb 545 #define TIM_FLAG_CC2OF (TIM_SR_CC2OF)
Kojto 115:87f2f5183dfb 546 #define TIM_FLAG_CC3OF (TIM_SR_CC3OF)
Kojto 115:87f2f5183dfb 547 #define TIM_FLAG_CC4OF (TIM_SR_CC4OF)
Kojto 115:87f2f5183dfb 548 /**
Kojto 115:87f2f5183dfb 549 * @}
Kojto 115:87f2f5183dfb 550 */
Kojto 115:87f2f5183dfb 551
Kojto 115:87f2f5183dfb 552 /** @defgroup TIM_Clock_Source TIM Clock Source
Kojto 115:87f2f5183dfb 553 * @{
Kojto 115:87f2f5183dfb 554 */
Kojto 115:87f2f5183dfb 555 #define TIM_CLOCKSOURCE_ETRMODE2 (TIM_SMCR_ETPS_1)
Kojto 115:87f2f5183dfb 556 #define TIM_CLOCKSOURCE_INTERNAL (TIM_SMCR_ETPS_0)
Kojto 115:87f2f5183dfb 557 #define TIM_CLOCKSOURCE_ITR0 ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 558 #define TIM_CLOCKSOURCE_ITR1 (TIM_SMCR_TS_0)
Kojto 115:87f2f5183dfb 559 #define TIM_CLOCKSOURCE_ITR2 (TIM_SMCR_TS_1)
Kojto 115:87f2f5183dfb 560 #define TIM_CLOCKSOURCE_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1)
Kojto 115:87f2f5183dfb 561 #define TIM_CLOCKSOURCE_TI1ED (TIM_SMCR_TS_2)
Kojto 115:87f2f5183dfb 562 #define TIM_CLOCKSOURCE_TI1 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2)
Kojto 115:87f2f5183dfb 563 #define TIM_CLOCKSOURCE_TI2 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2)
Kojto 115:87f2f5183dfb 564 #define TIM_CLOCKSOURCE_ETRMODE1 (TIM_SMCR_TS)
Kojto 115:87f2f5183dfb 565 /**
Kojto 115:87f2f5183dfb 566 * @}
Kojto 115:87f2f5183dfb 567 */
Kojto 115:87f2f5183dfb 568
Kojto 115:87f2f5183dfb 569 /** @defgroup TIM_Clock_Polarity TIM Clock Polarity
Kojto 115:87f2f5183dfb 570 * @{
Kojto 115:87f2f5183dfb 571 */
Kojto 115:87f2f5183dfb 572 #define TIM_CLOCKPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx clock sources */
Kojto 115:87f2f5183dfb 573 #define TIM_CLOCKPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx clock sources */
Kojto 115:87f2f5183dfb 574 #define TIM_CLOCKPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Polarity for TIx clock sources */
Kojto 115:87f2f5183dfb 575 #define TIM_CLOCKPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Polarity for TIx clock sources */
Kojto 115:87f2f5183dfb 576 #define TIM_CLOCKPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Polarity for TIx clock sources */
Kojto 115:87f2f5183dfb 577 /**
Kojto 115:87f2f5183dfb 578 * @}
Kojto 115:87f2f5183dfb 579 */
Kojto 115:87f2f5183dfb 580
Kojto 115:87f2f5183dfb 581 /** @defgroup TIM_Clock_Prescaler TIM Clock Prescaler
Kojto 115:87f2f5183dfb 582 * @{
Kojto 115:87f2f5183dfb 583 */
Kojto 115:87f2f5183dfb 584 #define TIM_CLOCKPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */
Kojto 115:87f2f5183dfb 585 #define TIM_CLOCKPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR Clock: Capture performed once every 2 events. */
Kojto 115:87f2f5183dfb 586 #define TIM_CLOCKPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR Clock: Capture performed once every 4 events. */
Kojto 115:87f2f5183dfb 587 #define TIM_CLOCKPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR Clock: Capture performed once every 8 events. */
Kojto 115:87f2f5183dfb 588 /**
Kojto 115:87f2f5183dfb 589 * @}
Kojto 115:87f2f5183dfb 590 */
Kojto 115:87f2f5183dfb 591
Kojto 115:87f2f5183dfb 592 /** @defgroup TIM_ClearInput_Polarity TIM Clear Input Polarity
Kojto 115:87f2f5183dfb 593 * @{
Kojto 115:87f2f5183dfb 594 */
Kojto 115:87f2f5183dfb 595 #define TIM_CLEARINPUTPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx pin */
Kojto 115:87f2f5183dfb 596 #define TIM_CLEARINPUTPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx pin */
Kojto 115:87f2f5183dfb 597 /**
Kojto 115:87f2f5183dfb 598 * @}
Kojto 115:87f2f5183dfb 599 */
Kojto 115:87f2f5183dfb 600
Kojto 115:87f2f5183dfb 601 /** @defgroup TIM_ClearInput_Prescaler TIM Clear Input Prescaler
Kojto 115:87f2f5183dfb 602 * @{
Kojto 115:87f2f5183dfb 603 */
Kojto 115:87f2f5183dfb 604 #define TIM_CLEARINPUTPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */
Kojto 115:87f2f5183dfb 605 #define TIM_CLEARINPUTPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR pin: Capture performed once every 2 events. */
Kojto 115:87f2f5183dfb 606 #define TIM_CLEARINPUTPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR pin: Capture performed once every 4 events. */
Kojto 115:87f2f5183dfb 607 #define TIM_CLEARINPUTPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR pin: Capture performed once every 8 events. */
Kojto 115:87f2f5183dfb 608 /**
Kojto 115:87f2f5183dfb 609 * @}
Kojto 115:87f2f5183dfb 610 */
Kojto 115:87f2f5183dfb 611
Kojto 115:87f2f5183dfb 612 /** @defgroup TIM_OSSR_Off_State_Selection_for_Run_mode_state TIM OSSR OffState Selection for Run mode state
Kojto 115:87f2f5183dfb 613 * @{
Kojto 115:87f2f5183dfb 614 */
Kojto 115:87f2f5183dfb 615 #define TIM_OSSR_ENABLE (TIM_BDTR_OSSR)
Kojto 115:87f2f5183dfb 616 #define TIM_OSSR_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 617 /**
Kojto 115:87f2f5183dfb 618 * @}
Kojto 115:87f2f5183dfb 619 */
Kojto 115:87f2f5183dfb 620
Kojto 115:87f2f5183dfb 621 /** @defgroup TIM_OSSI_Off_State_Selection_for_Idle_mode_state TIM OSSI OffState Selection for Idle mode state
Kojto 115:87f2f5183dfb 622 * @{
Kojto 115:87f2f5183dfb 623 */
Kojto 115:87f2f5183dfb 624 #define TIM_OSSI_ENABLE (TIM_BDTR_OSSI)
Kojto 115:87f2f5183dfb 625 #define TIM_OSSI_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 626 /**
Kojto 115:87f2f5183dfb 627 * @}
Kojto 115:87f2f5183dfb 628 */
Kojto 115:87f2f5183dfb 629
Kojto 115:87f2f5183dfb 630 /** @defgroup TIM_Lock_level TIM Lock level
Kojto 115:87f2f5183dfb 631 * @{
Kojto 115:87f2f5183dfb 632 */
Kojto 115:87f2f5183dfb 633 #define TIM_LOCKLEVEL_OFF ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 634 #define TIM_LOCKLEVEL_1 (TIM_BDTR_LOCK_0)
Kojto 115:87f2f5183dfb 635 #define TIM_LOCKLEVEL_2 (TIM_BDTR_LOCK_1)
Kojto 115:87f2f5183dfb 636 #define TIM_LOCKLEVEL_3 (TIM_BDTR_LOCK)
Kojto 115:87f2f5183dfb 637 /**
Kojto 115:87f2f5183dfb 638 * @}
Kojto 115:87f2f5183dfb 639 */
Kojto 115:87f2f5183dfb 640 /** @defgroup TIM_Break_Input_enable_disable TIM Break Input State
Kojto 115:87f2f5183dfb 641 * @{
Kojto 115:87f2f5183dfb 642 */
Kojto 115:87f2f5183dfb 643 #define TIM_BREAK_ENABLE (TIM_BDTR_BKE)
Kojto 115:87f2f5183dfb 644 #define TIM_BREAK_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 645 /**
Kojto 115:87f2f5183dfb 646 * @}
Kojto 115:87f2f5183dfb 647 */
Kojto 115:87f2f5183dfb 648
Kojto 115:87f2f5183dfb 649 /** @defgroup TIM_Break_Polarity TIM Break Polarity
Kojto 115:87f2f5183dfb 650 * @{
Kojto 115:87f2f5183dfb 651 */
Kojto 115:87f2f5183dfb 652 #define TIM_BREAKPOLARITY_LOW ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 653 #define TIM_BREAKPOLARITY_HIGH (TIM_BDTR_BKP)
Kojto 115:87f2f5183dfb 654 /**
Kojto 115:87f2f5183dfb 655 * @}
Kojto 115:87f2f5183dfb 656 */
Kojto 115:87f2f5183dfb 657
Kojto 115:87f2f5183dfb 658 /** @defgroup TIM_AOE_Bit_Set_Reset TIM AOE Bit State
Kojto 115:87f2f5183dfb 659 * @{
Kojto 115:87f2f5183dfb 660 */
Kojto 115:87f2f5183dfb 661 #define TIM_AUTOMATICOUTPUT_ENABLE (TIM_BDTR_AOE)
Kojto 115:87f2f5183dfb 662 #define TIM_AUTOMATICOUTPUT_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 663 /**
Kojto 115:87f2f5183dfb 664 * @}
Kojto 115:87f2f5183dfb 665 */
Kojto 115:87f2f5183dfb 666
Kojto 115:87f2f5183dfb 667 /** @defgroup TIM_Master_Mode_Selection TIM Master Mode Selection
Kojto 115:87f2f5183dfb 668 * @{
Kojto 115:87f2f5183dfb 669 */
Kojto 115:87f2f5183dfb 670 #define TIM_TRGO_RESET ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 671 #define TIM_TRGO_ENABLE (TIM_CR2_MMS_0)
Kojto 115:87f2f5183dfb 672 #define TIM_TRGO_UPDATE (TIM_CR2_MMS_1)
Kojto 115:87f2f5183dfb 673 #define TIM_TRGO_OC1 ((TIM_CR2_MMS_1 | TIM_CR2_MMS_0))
Kojto 115:87f2f5183dfb 674 #define TIM_TRGO_OC1REF (TIM_CR2_MMS_2)
Kojto 115:87f2f5183dfb 675 #define TIM_TRGO_OC2REF ((TIM_CR2_MMS_2 | TIM_CR2_MMS_0))
Kojto 115:87f2f5183dfb 676 #define TIM_TRGO_OC3REF ((TIM_CR2_MMS_2 | TIM_CR2_MMS_1))
Kojto 115:87f2f5183dfb 677 #define TIM_TRGO_OC4REF ((TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0))
Kojto 115:87f2f5183dfb 678 /**
Kojto 115:87f2f5183dfb 679 * @}
Kojto 115:87f2f5183dfb 680 */
Kojto 115:87f2f5183dfb 681
Kojto 115:87f2f5183dfb 682 /** @defgroup TIM_Master_Slave_Mode TIM Master Slave Mode
Kojto 115:87f2f5183dfb 683 * @{
Kojto 115:87f2f5183dfb 684 */
Kojto 115:87f2f5183dfb 685 #define TIM_MASTERSLAVEMODE_ENABLE ((uint32_t)0x0080)
Kojto 115:87f2f5183dfb 686 #define TIM_MASTERSLAVEMODE_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 687 /**
Kojto 115:87f2f5183dfb 688 * @}
Kojto 115:87f2f5183dfb 689 */
Kojto 115:87f2f5183dfb 690
Kojto 115:87f2f5183dfb 691 /** @defgroup TIM_Trigger_Selection TIM Trigger Selection
Kojto 115:87f2f5183dfb 692 * @{
Kojto 115:87f2f5183dfb 693 */
Kojto 115:87f2f5183dfb 694 #define TIM_TS_ITR0 ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 695 #define TIM_TS_ITR1 ((uint32_t)0x0010)
Kojto 115:87f2f5183dfb 696 #define TIM_TS_ITR2 ((uint32_t)0x0020)
Kojto 115:87f2f5183dfb 697 #define TIM_TS_ITR3 ((uint32_t)0x0030)
Kojto 115:87f2f5183dfb 698 #define TIM_TS_TI1F_ED ((uint32_t)0x0040)
Kojto 115:87f2f5183dfb 699 #define TIM_TS_TI1FP1 ((uint32_t)0x0050)
Kojto 115:87f2f5183dfb 700 #define TIM_TS_TI2FP2 ((uint32_t)0x0060)
Kojto 115:87f2f5183dfb 701 #define TIM_TS_ETRF ((uint32_t)0x0070)
Kojto 115:87f2f5183dfb 702 #define TIM_TS_NONE ((uint32_t)0xFFFF)
Kojto 115:87f2f5183dfb 703 /**
Kojto 115:87f2f5183dfb 704 * @}
Kojto 115:87f2f5183dfb 705 */
Kojto 115:87f2f5183dfb 706
Kojto 115:87f2f5183dfb 707 /** @defgroup TIM_Trigger_Polarity TIM Trigger Polarity
Kojto 115:87f2f5183dfb 708 * @{
Kojto 115:87f2f5183dfb 709 */
Kojto 115:87f2f5183dfb 710 #define TIM_TRIGGERPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx trigger sources */
Kojto 115:87f2f5183dfb 711 #define TIM_TRIGGERPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx trigger sources */
Kojto 115:87f2f5183dfb 712 #define TIM_TRIGGERPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Polarity for TIxFPx or TI1_ED trigger sources */
Kojto 115:87f2f5183dfb 713 #define TIM_TRIGGERPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Polarity for TIxFPx or TI1_ED trigger sources */
Kojto 115:87f2f5183dfb 714 #define TIM_TRIGGERPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Polarity for TIxFPx or TI1_ED trigger sources */
Kojto 115:87f2f5183dfb 715 /**
Kojto 115:87f2f5183dfb 716 * @}
Kojto 115:87f2f5183dfb 717 */
Kojto 115:87f2f5183dfb 718
Kojto 115:87f2f5183dfb 719 /** @defgroup TIM_Trigger_Prescaler TIM Trigger Prescaler
Kojto 115:87f2f5183dfb 720 * @{
Kojto 115:87f2f5183dfb 721 */
Kojto 115:87f2f5183dfb 722 #define TIM_TRIGGERPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */
Kojto 115:87f2f5183dfb 723 #define TIM_TRIGGERPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR Trigger: Capture performed once every 2 events. */
Kojto 115:87f2f5183dfb 724 #define TIM_TRIGGERPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR Trigger: Capture performed once every 4 events. */
Kojto 115:87f2f5183dfb 725 #define TIM_TRIGGERPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR Trigger: Capture performed once every 8 events. */
Kojto 115:87f2f5183dfb 726 /**
Kojto 115:87f2f5183dfb 727 * @}
Kojto 115:87f2f5183dfb 728 */
Kojto 115:87f2f5183dfb 729
Kojto 115:87f2f5183dfb 730
Kojto 115:87f2f5183dfb 731 /** @defgroup TIM_TI1_Selection TIM TI1 Selection
Kojto 115:87f2f5183dfb 732 * @{
Kojto 115:87f2f5183dfb 733 */
Kojto 115:87f2f5183dfb 734 #define TIM_TI1SELECTION_CH1 ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 735 #define TIM_TI1SELECTION_XORCOMBINATION (TIM_CR2_TI1S)
Kojto 115:87f2f5183dfb 736 /**
Kojto 115:87f2f5183dfb 737 * @}
Kojto 115:87f2f5183dfb 738 */
Kojto 115:87f2f5183dfb 739
Kojto 115:87f2f5183dfb 740 /** @defgroup TIM_DMA_Base_address TIM DMA Base address
Kojto 115:87f2f5183dfb 741 * @{
Kojto 115:87f2f5183dfb 742 */
Kojto 115:87f2f5183dfb 743 #define TIM_DMABASE_CR1 (0x00000000)
Kojto 115:87f2f5183dfb 744 #define TIM_DMABASE_CR2 (0x00000001)
Kojto 115:87f2f5183dfb 745 #define TIM_DMABASE_SMCR (0x00000002)
Kojto 115:87f2f5183dfb 746 #define TIM_DMABASE_DIER (0x00000003)
Kojto 115:87f2f5183dfb 747 #define TIM_DMABASE_SR (0x00000004)
Kojto 115:87f2f5183dfb 748 #define TIM_DMABASE_EGR (0x00000005)
Kojto 115:87f2f5183dfb 749 #define TIM_DMABASE_CCMR1 (0x00000006)
Kojto 115:87f2f5183dfb 750 #define TIM_DMABASE_CCMR2 (0x00000007)
Kojto 115:87f2f5183dfb 751 #define TIM_DMABASE_CCER (0x00000008)
Kojto 115:87f2f5183dfb 752 #define TIM_DMABASE_CNT (0x00000009)
Kojto 115:87f2f5183dfb 753 #define TIM_DMABASE_PSC (0x0000000A)
Kojto 115:87f2f5183dfb 754 #define TIM_DMABASE_ARR (0x0000000B)
Kojto 115:87f2f5183dfb 755 #define TIM_DMABASE_RCR (0x0000000C)
Kojto 115:87f2f5183dfb 756 #define TIM_DMABASE_CCR1 (0x0000000D)
Kojto 115:87f2f5183dfb 757 #define TIM_DMABASE_CCR2 (0x0000000E)
Kojto 115:87f2f5183dfb 758 #define TIM_DMABASE_CCR3 (0x0000000F)
Kojto 115:87f2f5183dfb 759 #define TIM_DMABASE_CCR4 (0x00000010)
Kojto 115:87f2f5183dfb 760 #define TIM_DMABASE_BDTR (0x00000011)
Kojto 115:87f2f5183dfb 761 #define TIM_DMABASE_DCR (0x00000012)
Kojto 115:87f2f5183dfb 762 #define TIM_DMABASE_OR (0x00000013)
Kojto 115:87f2f5183dfb 763 /**
Kojto 115:87f2f5183dfb 764 * @}
Kojto 115:87f2f5183dfb 765 */
Kojto 115:87f2f5183dfb 766
Kojto 115:87f2f5183dfb 767 /** @defgroup TIM_DMA_Burst_Length TIM DMA Burst Length
Kojto 115:87f2f5183dfb 768 * @{
Kojto 115:87f2f5183dfb 769 */
Kojto 115:87f2f5183dfb 770 #define TIM_DMABURSTLENGTH_1TRANSFER (0x00000000)
Kojto 115:87f2f5183dfb 771 #define TIM_DMABURSTLENGTH_2TRANSFERS (0x00000100)
Kojto 115:87f2f5183dfb 772 #define TIM_DMABURSTLENGTH_3TRANSFERS (0x00000200)
Kojto 115:87f2f5183dfb 773 #define TIM_DMABURSTLENGTH_4TRANSFERS (0x00000300)
Kojto 115:87f2f5183dfb 774 #define TIM_DMABURSTLENGTH_5TRANSFERS (0x00000400)
Kojto 115:87f2f5183dfb 775 #define TIM_DMABURSTLENGTH_6TRANSFERS (0x00000500)
Kojto 115:87f2f5183dfb 776 #define TIM_DMABURSTLENGTH_7TRANSFERS (0x00000600)
Kojto 115:87f2f5183dfb 777 #define TIM_DMABURSTLENGTH_8TRANSFERS (0x00000700)
Kojto 115:87f2f5183dfb 778 #define TIM_DMABURSTLENGTH_9TRANSFERS (0x00000800)
Kojto 115:87f2f5183dfb 779 #define TIM_DMABURSTLENGTH_10TRANSFERS (0x00000900)
Kojto 115:87f2f5183dfb 780 #define TIM_DMABURSTLENGTH_11TRANSFERS (0x00000A00)
Kojto 115:87f2f5183dfb 781 #define TIM_DMABURSTLENGTH_12TRANSFERS (0x00000B00)
Kojto 115:87f2f5183dfb 782 #define TIM_DMABURSTLENGTH_13TRANSFERS (0x00000C00)
Kojto 115:87f2f5183dfb 783 #define TIM_DMABURSTLENGTH_14TRANSFERS (0x00000D00)
Kojto 115:87f2f5183dfb 784 #define TIM_DMABURSTLENGTH_15TRANSFERS (0x00000E00)
Kojto 115:87f2f5183dfb 785 #define TIM_DMABURSTLENGTH_16TRANSFERS (0x00000F00)
Kojto 115:87f2f5183dfb 786 #define TIM_DMABURSTLENGTH_17TRANSFERS (0x00001000)
Kojto 115:87f2f5183dfb 787 #define TIM_DMABURSTLENGTH_18TRANSFERS (0x00001100)
Kojto 115:87f2f5183dfb 788 /**
Kojto 115:87f2f5183dfb 789 * @}
Kojto 115:87f2f5183dfb 790 */
Kojto 115:87f2f5183dfb 791
Kojto 115:87f2f5183dfb 792 /** @defgroup DMA_Handle_index DMA Handle index
Kojto 115:87f2f5183dfb 793 * @{
Kojto 115:87f2f5183dfb 794 */
Kojto 115:87f2f5183dfb 795 #define TIM_DMA_ID_UPDATE ((uint16_t) 0x0) /*!< Index of the DMA handle used for Update DMA requests */
Kojto 115:87f2f5183dfb 796 #define TIM_DMA_ID_CC1 ((uint16_t) 0x1) /*!< Index of the DMA handle used for Capture/Compare 1 DMA requests */
Kojto 115:87f2f5183dfb 797 #define TIM_DMA_ID_CC2 ((uint16_t) 0x2) /*!< Index of the DMA handle used for Capture/Compare 2 DMA requests */
Kojto 115:87f2f5183dfb 798 #define TIM_DMA_ID_CC3 ((uint16_t) 0x3) /*!< Index of the DMA handle used for Capture/Compare 3 DMA requests */
Kojto 115:87f2f5183dfb 799 #define TIM_DMA_ID_CC4 ((uint16_t) 0x4) /*!< Index of the DMA handle used for Capture/Compare 4 DMA requests */
Kojto 115:87f2f5183dfb 800 #define TIM_DMA_ID_COMMUTATION ((uint16_t) 0x5) /*!< Index of the DMA handle used for Commutation DMA requests */
Kojto 115:87f2f5183dfb 801 #define TIM_DMA_ID_TRIGGER ((uint16_t) 0x6) /*!< Index of the DMA handle used for Trigger DMA requests */
Kojto 115:87f2f5183dfb 802 /**
Kojto 115:87f2f5183dfb 803 * @}
Kojto 115:87f2f5183dfb 804 */
Kojto 115:87f2f5183dfb 805
Kojto 115:87f2f5183dfb 806 /** @defgroup Channel_CC_State Channel CC State
Kojto 115:87f2f5183dfb 807 * @{
Kojto 115:87f2f5183dfb 808 */
Kojto 115:87f2f5183dfb 809 #define TIM_CCx_ENABLE ((uint32_t)0x0001)
Kojto 115:87f2f5183dfb 810 #define TIM_CCx_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 811 #define TIM_CCxN_ENABLE ((uint32_t)0x0004)
Kojto 115:87f2f5183dfb 812 #define TIM_CCxN_DISABLE ((uint32_t)0x0000)
Kojto 115:87f2f5183dfb 813 /**
Kojto 115:87f2f5183dfb 814 * @}
Kojto 115:87f2f5183dfb 815 */
Kojto 115:87f2f5183dfb 816
Kojto 115:87f2f5183dfb 817 /**
Kojto 115:87f2f5183dfb 818 * @}
Kojto 115:87f2f5183dfb 819 */
Kojto 115:87f2f5183dfb 820
Kojto 115:87f2f5183dfb 821 /* Exported macro ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 822 /** @defgroup TIM_Exported_Macros TIM Exported Macros
Kojto 115:87f2f5183dfb 823 * @{
Kojto 115:87f2f5183dfb 824 */
Kojto 115:87f2f5183dfb 825 /** @brief Reset TIM handle state
Kojto 115:87f2f5183dfb 826 * @param __HANDLE__: TIM handle
Kojto 115:87f2f5183dfb 827 * @retval None
Kojto 115:87f2f5183dfb 828 */
Kojto 115:87f2f5183dfb 829 #define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_TIM_STATE_RESET)
Kojto 115:87f2f5183dfb 830
Kojto 115:87f2f5183dfb 831 /**
Kojto 115:87f2f5183dfb 832 * @brief Enable the TIM peripheral.
Kojto 115:87f2f5183dfb 833 * @param __HANDLE__: TIM handle
Kojto 115:87f2f5183dfb 834 * @retval None
Kojto 115:87f2f5183dfb 835 */
Kojto 115:87f2f5183dfb 836 #define __HAL_TIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|=(TIM_CR1_CEN))
Kojto 115:87f2f5183dfb 837
Kojto 115:87f2f5183dfb 838 /**
Kojto 115:87f2f5183dfb 839 * @brief Enable the TIM update source request.
Kojto 115:87f2f5183dfb 840 * @param __HANDLE__: TIM handle
Kojto 115:87f2f5183dfb 841 * @retval None
Kojto 115:87f2f5183dfb 842 */
Kojto 115:87f2f5183dfb 843 #define __HAL_TIM_URS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|=(TIM_CR1_URS))
Kojto 115:87f2f5183dfb 844
Kojto 115:87f2f5183dfb 845 /**
Kojto 115:87f2f5183dfb 846 * @brief Enable the TIM main Output.
Kojto 115:87f2f5183dfb 847 * @param __HANDLE__: TIM handle
Kojto 115:87f2f5183dfb 848 * @retval None
Kojto 115:87f2f5183dfb 849 */
Kojto 115:87f2f5183dfb 850 #define __HAL_TIM_MOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->BDTR|=(TIM_BDTR_MOE))
Kojto 115:87f2f5183dfb 851
Kojto 115:87f2f5183dfb 852
Kojto 115:87f2f5183dfb 853 /* The counter of a timer instance is disabled only if all the CCx and CCxN
Kojto 115:87f2f5183dfb 854 channels have been disabled */
Kojto 115:87f2f5183dfb 855 #define TIM_CCER_CCxE_MASK ((uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E))
Kojto 115:87f2f5183dfb 856 #define TIM_CCER_CCxNE_MASK ((uint32_t)(TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE))
Kojto 115:87f2f5183dfb 857
Kojto 115:87f2f5183dfb 858 /**
Kojto 115:87f2f5183dfb 859 * @brief Disable the TIM peripheral.
Kojto 115:87f2f5183dfb 860 * @param __HANDLE__: TIM handle
Kojto 115:87f2f5183dfb 861 * @retval None
Kojto 115:87f2f5183dfb 862 */
Kojto 115:87f2f5183dfb 863 #define __HAL_TIM_DISABLE(__HANDLE__) \
Kojto 115:87f2f5183dfb 864 do { \
Kojto 115:87f2f5183dfb 865 if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0) \
Kojto 115:87f2f5183dfb 866 { \
Kojto 115:87f2f5183dfb 867 if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0) \
Kojto 115:87f2f5183dfb 868 { \
Kojto 115:87f2f5183dfb 869 (__HANDLE__)->Instance->CR1 &= ~(TIM_CR1_CEN); \
Kojto 115:87f2f5183dfb 870 } \
Kojto 115:87f2f5183dfb 871 } \
Kojto 115:87f2f5183dfb 872 } while(0)
Kojto 115:87f2f5183dfb 873
Kojto 115:87f2f5183dfb 874 /**
Kojto 115:87f2f5183dfb 875 * @brief Disable the TIM update source request.
Kojto 115:87f2f5183dfb 876 * @param __HANDLE__: TIM handle
Kojto 115:87f2f5183dfb 877 * @retval None
Kojto 115:87f2f5183dfb 878 */
Kojto 115:87f2f5183dfb 879 #define __HAL_TIM_URS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1&=~(TIM_CR1_URS))
Kojto 115:87f2f5183dfb 880
Kojto 115:87f2f5183dfb 881
Kojto 115:87f2f5183dfb 882 /* The Main Output of a timer instance is disabled only if all the CCx and CCxN
Kojto 115:87f2f5183dfb 883 channels have been disabled */
Kojto 115:87f2f5183dfb 884 /**
Kojto 115:87f2f5183dfb 885 * @brief Disable the TIM main Output.
Kojto 115:87f2f5183dfb 886 * @param __HANDLE__: TIM handle
Kojto 115:87f2f5183dfb 887 * @retval None
Kojto 115:87f2f5183dfb 888 */
Kojto 115:87f2f5183dfb 889 #define __HAL_TIM_MOE_DISABLE(__HANDLE__) \
Kojto 115:87f2f5183dfb 890 do { \
Kojto 115:87f2f5183dfb 891 if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0) \
Kojto 115:87f2f5183dfb 892 { \
Kojto 115:87f2f5183dfb 893 if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0) \
Kojto 115:87f2f5183dfb 894 { \
Kojto 115:87f2f5183dfb 895 (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE); \
Kojto 115:87f2f5183dfb 896 } \
Kojto 115:87f2f5183dfb 897 } \
Kojto 115:87f2f5183dfb 898 } while(0)
Kojto 115:87f2f5183dfb 899
Kojto 115:87f2f5183dfb 900 #define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__))
Kojto 115:87f2f5183dfb 901 #define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER |= (__DMA__))
Kojto 115:87f2f5183dfb 902 #define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER &= ~(__INTERRUPT__))
Kojto 115:87f2f5183dfb 903 #define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER &= ~(__DMA__))
Kojto 115:87f2f5183dfb 904 #define __HAL_TIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__))
Kojto 115:87f2f5183dfb 905 #define __HAL_TIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
Kojto 115:87f2f5183dfb 906
Kojto 115:87f2f5183dfb 907 #define __HAL_TIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->DIER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
Kojto 115:87f2f5183dfb 908 #define __HAL_TIM_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->SR = ~(__INTERRUPT__))
Kojto 115:87f2f5183dfb 909
Kojto 115:87f2f5183dfb 910 #define __HAL_TIM_IS_TIM_COUNTING_DOWN(__HANDLE__) (((__HANDLE__)->Instance->CR1 &(TIM_CR1_DIR)) == (TIM_CR1_DIR))
Kojto 115:87f2f5183dfb 911 #define __HAL_TIM_SET_PRESCALER (__HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__))
Kojto 115:87f2f5183dfb 912
Kojto 115:87f2f5183dfb 913 #define TIM_SET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__, __ICPSC__) \
Kojto 115:87f2f5183dfb 914 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= (__ICPSC__)) :\
Kojto 115:87f2f5183dfb 915 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= ((__ICPSC__) << 8)) :\
Kojto 115:87f2f5183dfb 916 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= (__ICPSC__)) :\
Kojto 115:87f2f5183dfb 917 ((__HANDLE__)->Instance->CCMR2 |= ((__ICPSC__) << 8)))
Kojto 115:87f2f5183dfb 918
Kojto 115:87f2f5183dfb 919 #define TIM_RESET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__) \
Kojto 115:87f2f5183dfb 920 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= (uint16_t)~TIM_CCMR1_IC1PSC) :\
Kojto 115:87f2f5183dfb 921 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= (uint16_t)~TIM_CCMR1_IC2PSC) :\
Kojto 115:87f2f5183dfb 922 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= (uint16_t)~TIM_CCMR2_IC3PSC) :\
Kojto 115:87f2f5183dfb 923 ((__HANDLE__)->Instance->CCMR2 &= (uint16_t)~TIM_CCMR2_IC4PSC))
Kojto 115:87f2f5183dfb 924
Kojto 115:87f2f5183dfb 925 #define TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \
Kojto 115:87f2f5183dfb 926 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER |= (__POLARITY__)) :\
Kojto 115:87f2f5183dfb 927 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 4)) :\
Kojto 115:87f2f5183dfb 928 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 8)) :\
Kojto 115:87f2f5183dfb 929 ((__HANDLE__)->Instance->CCER |= (((__POLARITY__) << 12) & TIM_CCER_CC4P)))
Kojto 115:87f2f5183dfb 930
Kojto 115:87f2f5183dfb 931 #define TIM_RESET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__) \
Kojto 115:87f2f5183dfb 932 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER &= (uint16_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP)) :\
Kojto 115:87f2f5183dfb 933 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER &= (uint16_t)~(TIM_CCER_CC2P | TIM_CCER_CC2NP)) :\
Kojto 115:87f2f5183dfb 934 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER &= (uint16_t)~(TIM_CCER_CC3P | TIM_CCER_CC3NP)) :\
Kojto 115:87f2f5183dfb 935 ((__HANDLE__)->Instance->CCER &= (uint16_t)~TIM_CCER_CC4P))
Kojto 115:87f2f5183dfb 936
Kojto 115:87f2f5183dfb 937 /**
Kojto 115:87f2f5183dfb 938 * @brief Sets the TIM Counter Register value on runtime.
Kojto 115:87f2f5183dfb 939 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 940 * @param __COUNTER__: specifies the Counter register new value.
Kojto 115:87f2f5183dfb 941 * @retval None
Kojto 115:87f2f5183dfb 942 */
Kojto 115:87f2f5183dfb 943 #define __HAL_TIM_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->CNT = (__COUNTER__))
Kojto 115:87f2f5183dfb 944
Kojto 115:87f2f5183dfb 945 /**
Kojto 115:87f2f5183dfb 946 * @brief Gets the TIM Counter Register value on runtime.
Kojto 115:87f2f5183dfb 947 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 948 * @retval None
Kojto 115:87f2f5183dfb 949 */
Kojto 115:87f2f5183dfb 950 #define __HAL_TIM_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNT)
Kojto 115:87f2f5183dfb 951
Kojto 115:87f2f5183dfb 952 /**
Kojto 115:87f2f5183dfb 953 * @brief Sets the TIM Autoreload Register value on runtime without calling
Kojto 115:87f2f5183dfb 954 * another time any Init function.
Kojto 115:87f2f5183dfb 955 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 956 * @param __AUTORELOAD__: specifies the Counter register new value.
Kojto 115:87f2f5183dfb 957 * @retval None
Kojto 115:87f2f5183dfb 958 */
Kojto 115:87f2f5183dfb 959 #define __HAL_TIM_SET_AUTORELOAD(__HANDLE__, __AUTORELOAD__) \
Kojto 115:87f2f5183dfb 960 do{ \
Kojto 115:87f2f5183dfb 961 (__HANDLE__)->Instance->ARR = (__AUTORELOAD__); \
Kojto 115:87f2f5183dfb 962 (__HANDLE__)->Init.Period = (__AUTORELOAD__); \
Kojto 115:87f2f5183dfb 963 } while(0)
Kojto 115:87f2f5183dfb 964 /**
Kojto 115:87f2f5183dfb 965 * @brief Gets the TIM Autoreload Register value on runtime
Kojto 115:87f2f5183dfb 966 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 967 * @retval None
Kojto 115:87f2f5183dfb 968 */
Kojto 115:87f2f5183dfb 969 #define __HAL_TIM_GET_AUTORELOAD(__HANDLE__) ((__HANDLE__)->Instance->ARR)
Kojto 115:87f2f5183dfb 970
Kojto 115:87f2f5183dfb 971 /**
Kojto 115:87f2f5183dfb 972 * @brief Sets the TIM Clock Division value on runtime without calling
Kojto 115:87f2f5183dfb 973 * another time any Init function.
Kojto 115:87f2f5183dfb 974 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 975 * @param __CKD__: specifies the clock division value.
Kojto 115:87f2f5183dfb 976 * This parameter can be one of the following value:
Kojto 115:87f2f5183dfb 977 * @arg TIM_CLOCKDIVISION_DIV1
Kojto 115:87f2f5183dfb 978 * @arg TIM_CLOCKDIVISION_DIV2
Kojto 115:87f2f5183dfb 979 * @arg TIM_CLOCKDIVISION_DIV4
Kojto 115:87f2f5183dfb 980 * @retval None
Kojto 115:87f2f5183dfb 981 */
Kojto 115:87f2f5183dfb 982 #define __HAL_TIM_SET_CLOCKDIVISION(__HANDLE__, __CKD__) \
Kojto 115:87f2f5183dfb 983 do{ \
Kojto 115:87f2f5183dfb 984 (__HANDLE__)->Instance->CR1 &= (uint16_t)(~TIM_CR1_CKD); \
Kojto 115:87f2f5183dfb 985 (__HANDLE__)->Instance->CR1 |= (__CKD__); \
Kojto 115:87f2f5183dfb 986 (__HANDLE__)->Init.ClockDivision = (__CKD__); \
Kojto 115:87f2f5183dfb 987 } while(0)
Kojto 115:87f2f5183dfb 988 /**
Kojto 115:87f2f5183dfb 989 * @brief Gets the TIM Clock Division value on runtime
Kojto 115:87f2f5183dfb 990 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 991 * @retval None
Kojto 115:87f2f5183dfb 992 */
Kojto 115:87f2f5183dfb 993 #define __HAL_TIM_GET_CLOCKDIVISION(__HANDLE__) ((__HANDLE__)->Instance->CR1 & TIM_CR1_CKD)
Kojto 115:87f2f5183dfb 994
Kojto 115:87f2f5183dfb 995 /**
Kojto 115:87f2f5183dfb 996 * @brief Sets the TIM Input Capture prescaler on runtime without calling
Kojto 115:87f2f5183dfb 997 * another time HAL_TIM_IC_ConfigChannel() function.
Kojto 115:87f2f5183dfb 998 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 999 * @param __CHANNEL__ : TIM Channels to be configured.
Kojto 115:87f2f5183dfb 1000 * This parameter can be one of the following values:
Kojto 115:87f2f5183dfb 1001 * @arg TIM_CHANNEL_1: TIM Channel 1 selected
Kojto 115:87f2f5183dfb 1002 * @arg TIM_CHANNEL_2: TIM Channel 2 selected
Kojto 115:87f2f5183dfb 1003 * @arg TIM_CHANNEL_3: TIM Channel 3 selected
Kojto 115:87f2f5183dfb 1004 * @arg TIM_CHANNEL_4: TIM Channel 4 selected
Kojto 115:87f2f5183dfb 1005 * @param __ICPSC__: specifies the Input Capture4 prescaler new value.
Kojto 115:87f2f5183dfb 1006 * This parameter can be one of the following values:
Kojto 115:87f2f5183dfb 1007 * @arg TIM_ICPSC_DIV1: no prescaler
Kojto 115:87f2f5183dfb 1008 * @arg TIM_ICPSC_DIV2: capture is done once every 2 events
Kojto 115:87f2f5183dfb 1009 * @arg TIM_ICPSC_DIV4: capture is done once every 4 events
Kojto 115:87f2f5183dfb 1010 * @arg TIM_ICPSC_DIV8: capture is done once every 8 events
Kojto 115:87f2f5183dfb 1011 * @retval None
Kojto 115:87f2f5183dfb 1012 */
Kojto 115:87f2f5183dfb 1013 #define __HAL_TIM_SET_ICPRESCALER(__HANDLE__, __CHANNEL__, __ICPSC__) \
Kojto 115:87f2f5183dfb 1014 do{ \
Kojto 115:87f2f5183dfb 1015 TIM_RESET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__)); \
Kojto 115:87f2f5183dfb 1016 TIM_SET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__), (__ICPSC__)); \
Kojto 115:87f2f5183dfb 1017 } while(0)
Kojto 115:87f2f5183dfb 1018
Kojto 115:87f2f5183dfb 1019 /**
Kojto 115:87f2f5183dfb 1020 * @brief Gets the TIM Input Capture prescaler on runtime
Kojto 115:87f2f5183dfb 1021 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 1022 * @param __CHANNEL__ : TIM Channels to be configured.
Kojto 115:87f2f5183dfb 1023 * This parameter can be one of the following values:
Kojto 115:87f2f5183dfb 1024 * @arg TIM_CHANNEL_1: get input capture 1 prescaler value
Kojto 115:87f2f5183dfb 1025 * @arg TIM_CHANNEL_2: get input capture 2 prescaler value
Kojto 115:87f2f5183dfb 1026 * @arg TIM_CHANNEL_3: get input capture 3 prescaler value
Kojto 115:87f2f5183dfb 1027 * @arg TIM_CHANNEL_4: get input capture 4 prescaler value
Kojto 115:87f2f5183dfb 1028 * @retval None
Kojto 115:87f2f5183dfb 1029 */
Kojto 115:87f2f5183dfb 1030 #define __HAL_TIM_GET_ICPRESCALER(__HANDLE__, __CHANNEL__) \
Kojto 115:87f2f5183dfb 1031 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC1PSC) :\
Kojto 115:87f2f5183dfb 1032 ((__CHANNEL__) == TIM_CHANNEL_2) ? (((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC2PSC) >> 8) :\
Kojto 115:87f2f5183dfb 1033 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC3PSC) :\
Kojto 115:87f2f5183dfb 1034 (((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC4PSC)) >> 8)
Kojto 115:87f2f5183dfb 1035
Kojto 115:87f2f5183dfb 1036 /**
Kojto 115:87f2f5183dfb 1037 * @brief Sets the TIM Capture x input polarity on runtime.
Kojto 115:87f2f5183dfb 1038 * @param __HANDLE__: TIM handle.
Kojto 115:87f2f5183dfb 1039 * @param __CHANNEL__: TIM Channels to be configured.
Kojto 115:87f2f5183dfb 1040 * This parameter can be one of the following values:
Kojto 115:87f2f5183dfb 1041 * @arg TIM_CHANNEL_1: TIM Channel 1 selected
Kojto 115:87f2f5183dfb 1042 * @arg TIM_CHANNEL_2: TIM Channel 2 selected
Kojto 115:87f2f5183dfb 1043 * @arg TIM_CHANNEL_3: TIM Channel 3 selected
Kojto 115:87f2f5183dfb 1044 * @arg TIM_CHANNEL_4: TIM Channel 4 selected
Kojto 115:87f2f5183dfb 1045 * @param __POLARITY__: Polarity for TIx source
Kojto 115:87f2f5183dfb 1046 * @arg TIM_INPUTCHANNELPOLARITY_RISING: Rising Edge
Kojto 115:87f2f5183dfb 1047 * @arg TIM_INPUTCHANNELPOLARITY_FALLING: Falling Edge
Kojto 115:87f2f5183dfb 1048 * @arg TIM_INPUTCHANNELPOLARITY_BOTHEDGE: Rising and Falling Edge
Kojto 115:87f2f5183dfb 1049 * @note The polarity TIM_INPUTCHANNELPOLARITY_BOTHEDGE is not authorized for TIM Channel 4.
Kojto 115:87f2f5183dfb 1050 * @retval None
Kojto 115:87f2f5183dfb 1051 */
Kojto 115:87f2f5183dfb 1052 #define __HAL_TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \
Kojto 115:87f2f5183dfb 1053 do{ \
Kojto 115:87f2f5183dfb 1054 TIM_RESET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__)); \
Kojto 115:87f2f5183dfb 1055 TIM_SET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__), (__POLARITY__)); \
Kojto 115:87f2f5183dfb 1056 }while(0)
Kojto 115:87f2f5183dfb 1057
Kojto 115:87f2f5183dfb 1058 /**
Kojto 115:87f2f5183dfb 1059 * @}
Kojto 115:87f2f5183dfb 1060 */
Kojto 115:87f2f5183dfb 1061
Kojto 115:87f2f5183dfb 1062 /* Include TIM HAL Extension module */
Kojto 115:87f2f5183dfb 1063 #include "stm32f7xx_hal_tim_ex.h"
Kojto 115:87f2f5183dfb 1064
Kojto 115:87f2f5183dfb 1065 /* Exported functions --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 1066 /** @addtogroup TIM_Exported_Functions
Kojto 115:87f2f5183dfb 1067 * @{
Kojto 115:87f2f5183dfb 1068 */
Kojto 115:87f2f5183dfb 1069
Kojto 115:87f2f5183dfb 1070 /** @addtogroup TIM_Exported_Functions_Group1
Kojto 115:87f2f5183dfb 1071 * @{
Kojto 115:87f2f5183dfb 1072 */
Kojto 115:87f2f5183dfb 1073
Kojto 115:87f2f5183dfb 1074 /* Time Base functions ********************************************************/
Kojto 115:87f2f5183dfb 1075 HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1076 HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1077 void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1078 void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1079 /* Blocking mode: Polling */
Kojto 115:87f2f5183dfb 1080 HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1081 HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1082 /* Non-Blocking mode: Interrupt */
Kojto 115:87f2f5183dfb 1083 HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1084 HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1085 /* Non-Blocking mode: DMA */
Kojto 115:87f2f5183dfb 1086 HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
Kojto 115:87f2f5183dfb 1087 HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1088 /**
Kojto 115:87f2f5183dfb 1089 * @}
Kojto 115:87f2f5183dfb 1090 */
Kojto 115:87f2f5183dfb 1091
Kojto 115:87f2f5183dfb 1092 /** @addtogroup TIM_Exported_Functions_Group2
Kojto 115:87f2f5183dfb 1093 * @{
Kojto 115:87f2f5183dfb 1094 */
Kojto 115:87f2f5183dfb 1095 /* Timer Output Compare functions **********************************************/
Kojto 115:87f2f5183dfb 1096 HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1097 HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1098 void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1099 void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1100 /* Blocking mode: Polling */
Kojto 115:87f2f5183dfb 1101 HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1102 HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1103 /* Non-Blocking mode: Interrupt */
Kojto 115:87f2f5183dfb 1104 HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1105 HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1106 /* Non-Blocking mode: DMA */
Kojto 115:87f2f5183dfb 1107 HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
Kojto 115:87f2f5183dfb 1108 HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1109
Kojto 115:87f2f5183dfb 1110 /**
Kojto 115:87f2f5183dfb 1111 * @}
Kojto 115:87f2f5183dfb 1112 */
Kojto 115:87f2f5183dfb 1113
Kojto 115:87f2f5183dfb 1114 /** @addtogroup TIM_Exported_Functions_Group3
Kojto 115:87f2f5183dfb 1115 * @{
Kojto 115:87f2f5183dfb 1116 */
Kojto 115:87f2f5183dfb 1117 /* Timer PWM functions *********************************************************/
Kojto 115:87f2f5183dfb 1118 HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1119 HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1120 void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1121 void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1122 /* Blocking mode: Polling */
Kojto 115:87f2f5183dfb 1123 HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1124 HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1125 /* Non-Blocking mode: Interrupt */
Kojto 115:87f2f5183dfb 1126 HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1127 HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1128 /* Non-Blocking mode: DMA */
Kojto 115:87f2f5183dfb 1129 HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
Kojto 115:87f2f5183dfb 1130 HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1131
Kojto 115:87f2f5183dfb 1132 /**
Kojto 115:87f2f5183dfb 1133 * @}
Kojto 115:87f2f5183dfb 1134 */
Kojto 115:87f2f5183dfb 1135
Kojto 115:87f2f5183dfb 1136 /** @addtogroup TIM_Exported_Functions_Group4
Kojto 115:87f2f5183dfb 1137 * @{
Kojto 115:87f2f5183dfb 1138 */
Kojto 115:87f2f5183dfb 1139 /* Timer Input Capture functions ***********************************************/
Kojto 115:87f2f5183dfb 1140 HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1141 HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1142 void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1143 void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1144 /* Blocking mode: Polling */
Kojto 115:87f2f5183dfb 1145 HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1146 HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1147 /* Non-Blocking mode: Interrupt */
Kojto 115:87f2f5183dfb 1148 HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1149 HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1150 /* Non-Blocking mode: DMA */
Kojto 115:87f2f5183dfb 1151 HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
Kojto 115:87f2f5183dfb 1152 HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1153
Kojto 115:87f2f5183dfb 1154 /**
Kojto 115:87f2f5183dfb 1155 * @}
Kojto 115:87f2f5183dfb 1156 */
Kojto 115:87f2f5183dfb 1157
Kojto 115:87f2f5183dfb 1158 /** @addtogroup TIM_Exported_Functions_Group5
Kojto 115:87f2f5183dfb 1159 * @{
Kojto 115:87f2f5183dfb 1160 */
Kojto 115:87f2f5183dfb 1161 /* Timer One Pulse functions ***************************************************/
Kojto 115:87f2f5183dfb 1162 HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode);
Kojto 115:87f2f5183dfb 1163 HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1164 void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1165 void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1166 /* Blocking mode: Polling */
Kojto 115:87f2f5183dfb 1167 HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
Kojto 115:87f2f5183dfb 1168 HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
Kojto 115:87f2f5183dfb 1169
Kojto 115:87f2f5183dfb 1170 /* Non-Blocking mode: Interrupt */
Kojto 115:87f2f5183dfb 1171 HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
Kojto 115:87f2f5183dfb 1172 HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
Kojto 115:87f2f5183dfb 1173
Kojto 115:87f2f5183dfb 1174 /**
Kojto 115:87f2f5183dfb 1175 * @}
Kojto 115:87f2f5183dfb 1176 */
Kojto 115:87f2f5183dfb 1177
Kojto 115:87f2f5183dfb 1178 /** @addtogroup TIM_Exported_Functions_Group6
Kojto 115:87f2f5183dfb 1179 * @{
Kojto 115:87f2f5183dfb 1180 */
Kojto 115:87f2f5183dfb 1181 /* Timer Encoder functions *****************************************************/
Kojto 115:87f2f5183dfb 1182 HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef* sConfig);
Kojto 115:87f2f5183dfb 1183 HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1184 void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1185 void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1186 /* Blocking mode: Polling */
Kojto 115:87f2f5183dfb 1187 HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1188 HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1189 /* Non-Blocking mode: Interrupt */
Kojto 115:87f2f5183dfb 1190 HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1191 HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1192 /* Non-Blocking mode: DMA */
Kojto 115:87f2f5183dfb 1193 HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, uint32_t *pData2, uint16_t Length);
Kojto 115:87f2f5183dfb 1194 HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1195
Kojto 115:87f2f5183dfb 1196 /**
Kojto 115:87f2f5183dfb 1197 * @}
Kojto 115:87f2f5183dfb 1198 */
Kojto 115:87f2f5183dfb 1199
Kojto 115:87f2f5183dfb 1200 /** @addtogroup TIM_Exported_Functions_Group7
Kojto 115:87f2f5183dfb 1201 * @{
Kojto 115:87f2f5183dfb 1202 */
Kojto 115:87f2f5183dfb 1203 /* Interrupt Handler functions **********************************************/
Kojto 115:87f2f5183dfb 1204 void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1205
Kojto 115:87f2f5183dfb 1206 /**
Kojto 115:87f2f5183dfb 1207 * @}
Kojto 115:87f2f5183dfb 1208 */
Kojto 115:87f2f5183dfb 1209
Kojto 115:87f2f5183dfb 1210 /** @addtogroup TIM_Exported_Functions_Group8
Kojto 115:87f2f5183dfb 1211 * @{
Kojto 115:87f2f5183dfb 1212 */
Kojto 115:87f2f5183dfb 1213 /* Control functions *********************************************************/
Kojto 115:87f2f5183dfb 1214 HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef* sConfig, uint32_t Channel);
Kojto 115:87f2f5183dfb 1215 HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef* sConfig, uint32_t Channel);
Kojto 115:87f2f5183dfb 1216 HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef* sConfig, uint32_t Channel);
Kojto 115:87f2f5183dfb 1217 HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef* sConfig, uint32_t OutputChannel, uint32_t InputChannel);
Kojto 115:87f2f5183dfb 1218 HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, TIM_ClearInputConfigTypeDef * sClearInputConfig, uint32_t Channel);
Kojto 115:87f2f5183dfb 1219 HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef * sClockSourceConfig);
Kojto 115:87f2f5183dfb 1220 HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection);
Kojto 115:87f2f5183dfb 1221 HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef * sSlaveConfig);
Kojto 115:87f2f5183dfb 1222 HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization_IT(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef * sSlaveConfig);
Kojto 115:87f2f5183dfb 1223 HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, \
Kojto 115:87f2f5183dfb 1224 uint32_t *BurstBuffer, uint32_t BurstLength);
Kojto 115:87f2f5183dfb 1225 HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc);
Kojto 115:87f2f5183dfb 1226 HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, \
Kojto 115:87f2f5183dfb 1227 uint32_t *BurstBuffer, uint32_t BurstLength);
Kojto 115:87f2f5183dfb 1228 HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc);
Kojto 115:87f2f5183dfb 1229 HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource);
Kojto 115:87f2f5183dfb 1230 uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel);
Kojto 115:87f2f5183dfb 1231
Kojto 115:87f2f5183dfb 1232 /**
Kojto 115:87f2f5183dfb 1233 * @}
Kojto 115:87f2f5183dfb 1234 */
Kojto 115:87f2f5183dfb 1235
Kojto 115:87f2f5183dfb 1236 /** @addtogroup TIM_Exported_Functions_Group9
Kojto 115:87f2f5183dfb 1237 * @{
Kojto 115:87f2f5183dfb 1238 */
Kojto 115:87f2f5183dfb 1239 /* Callback in non blocking modes (Interrupt and DMA) *************************/
Kojto 115:87f2f5183dfb 1240 void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1241 void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1242 void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1243 void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1244 void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1245 void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1246
Kojto 115:87f2f5183dfb 1247 /**
Kojto 115:87f2f5183dfb 1248 * @}
Kojto 115:87f2f5183dfb 1249 */
Kojto 115:87f2f5183dfb 1250
Kojto 115:87f2f5183dfb 1251 /** @addtogroup TIM_Exported_Functions_Group10
Kojto 115:87f2f5183dfb 1252 * @{
Kojto 115:87f2f5183dfb 1253 */
Kojto 115:87f2f5183dfb 1254 /* Peripheral State functions **************************************************/
Kojto 115:87f2f5183dfb 1255 HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1256 HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1257 HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1258 HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1259 HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1260 HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim);
Kojto 115:87f2f5183dfb 1261
Kojto 115:87f2f5183dfb 1262 /**
Kojto 115:87f2f5183dfb 1263 * @}
Kojto 115:87f2f5183dfb 1264 */
Kojto 115:87f2f5183dfb 1265
Kojto 115:87f2f5183dfb 1266 /**
Kojto 115:87f2f5183dfb 1267 * @}
Kojto 115:87f2f5183dfb 1268 */
Kojto 115:87f2f5183dfb 1269
Kojto 115:87f2f5183dfb 1270 /* Private macros ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 1271 /** @defgroup TIM_Private_Macros TIM Private Macros
Kojto 115:87f2f5183dfb 1272 * @{
Kojto 115:87f2f5183dfb 1273 */
Kojto 115:87f2f5183dfb 1274
Kojto 115:87f2f5183dfb 1275 /** @defgroup TIM_IS_TIM_Definitions TIM Private macros to check input parameters
Kojto 115:87f2f5183dfb 1276 * @{
Kojto 115:87f2f5183dfb 1277 */
Kojto 115:87f2f5183dfb 1278 #define IS_TIM_COUNTER_MODE(__MODE__) (((__MODE__) == TIM_COUNTERMODE_UP) || \
Kojto 115:87f2f5183dfb 1279 ((__MODE__) == TIM_COUNTERMODE_DOWN) || \
Kojto 115:87f2f5183dfb 1280 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED1) || \
Kojto 115:87f2f5183dfb 1281 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED2) || \
Kojto 115:87f2f5183dfb 1282 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED3))
Kojto 115:87f2f5183dfb 1283
Kojto 115:87f2f5183dfb 1284 #define IS_TIM_CLOCKDIVISION_DIV(__DIV__) (((__DIV__) == TIM_CLOCKDIVISION_DIV1) || \
Kojto 115:87f2f5183dfb 1285 ((__DIV__) == TIM_CLOCKDIVISION_DIV2) || \
Kojto 115:87f2f5183dfb 1286 ((__DIV__) == TIM_CLOCKDIVISION_DIV4))
Kojto 115:87f2f5183dfb 1287
Kojto 115:87f2f5183dfb 1288 #define IS_TIM_FAST_STATE(__STATE__) (((__STATE__) == TIM_OCFAST_DISABLE) || \
Kojto 115:87f2f5183dfb 1289 ((__STATE__) == TIM_OCFAST_ENABLE))
Kojto 115:87f2f5183dfb 1290
Kojto 115:87f2f5183dfb 1291 #define IS_TIM_OUTPUT_STATE(STATE) (((STATE) == TIM_OUTPUTSTATE_DISABLE) || \
Kojto 115:87f2f5183dfb 1292 ((STATE) == TIM_OUTPUTSTATE_ENABLE))
Kojto 115:87f2f5183dfb 1293
Kojto 115:87f2f5183dfb 1294 #define IS_TIM_OUTPUTN_STATE(STATE) (((STATE) == TIM_OUTPUTNSTATE_DISABLE) || \
Kojto 115:87f2f5183dfb 1295 ((STATE) == TIM_OUTPUTNSTATE_ENABLE))
Kojto 115:87f2f5183dfb 1296
Kojto 115:87f2f5183dfb 1297 #define IS_TIM_OC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCPOLARITY_HIGH) || \
Kojto 115:87f2f5183dfb 1298 ((__POLARITY__) == TIM_OCPOLARITY_LOW))
Kojto 115:87f2f5183dfb 1299
Kojto 115:87f2f5183dfb 1300 #define IS_TIM_OCN_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCNPOLARITY_HIGH) || \
Kojto 115:87f2f5183dfb 1301 ((__POLARITY__) == TIM_OCNPOLARITY_LOW))
Kojto 115:87f2f5183dfb 1302
Kojto 115:87f2f5183dfb 1303 #define IS_TIM_OCIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCIDLESTATE_SET) || \
Kojto 115:87f2f5183dfb 1304 ((__STATE__) == TIM_OCIDLESTATE_RESET))
Kojto 115:87f2f5183dfb 1305
Kojto 115:87f2f5183dfb 1306 #define IS_TIM_OCNIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCNIDLESTATE_SET) || \
Kojto 115:87f2f5183dfb 1307 ((__STATE__) == TIM_OCNIDLESTATE_RESET))
Kojto 115:87f2f5183dfb 1308
Kojto 115:87f2f5183dfb 1309 #define IS_TIM_IC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ICPOLARITY_RISING) || \
Kojto 115:87f2f5183dfb 1310 ((__POLARITY__) == TIM_ICPOLARITY_FALLING) || \
Kojto 115:87f2f5183dfb 1311 ((__POLARITY__) == TIM_ICPOLARITY_BOTHEDGE))
Kojto 115:87f2f5183dfb 1312
Kojto 115:87f2f5183dfb 1313 #define IS_TIM_IC_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_ICSELECTION_DIRECTTI) || \
Kojto 115:87f2f5183dfb 1314 ((__SELECTION__) == TIM_ICSELECTION_INDIRECTTI) || \
Kojto 115:87f2f5183dfb 1315 ((__SELECTION__) == TIM_ICSELECTION_TRC))
Kojto 115:87f2f5183dfb 1316
Kojto 115:87f2f5183dfb 1317 #define IS_TIM_IC_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_ICPSC_DIV1) || \
Kojto 115:87f2f5183dfb 1318 ((__PRESCALER__) == TIM_ICPSC_DIV2) || \
Kojto 115:87f2f5183dfb 1319 ((__PRESCALER__) == TIM_ICPSC_DIV4) || \
Kojto 115:87f2f5183dfb 1320 ((__PRESCALER__) == TIM_ICPSC_DIV8))
Kojto 115:87f2f5183dfb 1321
Kojto 115:87f2f5183dfb 1322 #define IS_TIM_OPM_MODE(__MODE__) (((__MODE__) == TIM_OPMODE_SINGLE) || \
Kojto 115:87f2f5183dfb 1323 ((__MODE__) == TIM_OPMODE_REPETITIVE))
Kojto 115:87f2f5183dfb 1324
Kojto 115:87f2f5183dfb 1325 #define IS_TIM_ENCODER_MODE(__MODE__) (((__MODE__) == TIM_ENCODERMODE_TI1) || \
Kojto 115:87f2f5183dfb 1326 ((__MODE__) == TIM_ENCODERMODE_TI2) || \
Kojto 115:87f2f5183dfb 1327 ((__MODE__) == TIM_ENCODERMODE_TI12))
Kojto 115:87f2f5183dfb 1328
Kojto 115:87f2f5183dfb 1329 #define IS_TIM_IT(__IT__) ((((__IT__) & 0xFFFFFF00) == 0x00000000) && ((__IT__) != 0x00000000))
Kojto 115:87f2f5183dfb 1330
Kojto 115:87f2f5183dfb 1331
Kojto 115:87f2f5183dfb 1332 #define IS_TIM_GET_IT(__IT__) (((__IT__) == TIM_IT_UPDATE) || \
Kojto 115:87f2f5183dfb 1333 ((__IT__) == TIM_IT_CC1) || \
Kojto 115:87f2f5183dfb 1334 ((__IT__) == TIM_IT_CC2) || \
Kojto 115:87f2f5183dfb 1335 ((__IT__) == TIM_IT_CC3) || \
Kojto 115:87f2f5183dfb 1336 ((__IT__) == TIM_IT_CC4) || \
Kojto 115:87f2f5183dfb 1337 ((__IT__) == TIM_IT_COM) || \
Kojto 115:87f2f5183dfb 1338 ((__IT__) == TIM_IT_TRIGGER) || \
Kojto 115:87f2f5183dfb 1339 ((__IT__) == TIM_IT_BREAK))
Kojto 115:87f2f5183dfb 1340
Kojto 115:87f2f5183dfb 1341 #define IS_TIM_DMA_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFF80FF) == 0x00000000) && ((__SOURCE__) != 0x00000000))
Kojto 115:87f2f5183dfb 1342
Kojto 115:87f2f5183dfb 1343 #define IS_TIM_EVENT_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFFFE00) == 0x00000000) && ((__SOURCE__) != 0x00000000))
Kojto 115:87f2f5183dfb 1344
Kojto 115:87f2f5183dfb 1345 #define IS_TIM_FLAG(__FLAG__) (((__FLAG__) == TIM_FLAG_UPDATE) || \
Kojto 115:87f2f5183dfb 1346 ((__FLAG__) == TIM_FLAG_CC1) || \
Kojto 115:87f2f5183dfb 1347 ((__FLAG__) == TIM_FLAG_CC2) || \
Kojto 115:87f2f5183dfb 1348 ((__FLAG__) == TIM_FLAG_CC3) || \
Kojto 115:87f2f5183dfb 1349 ((__FLAG__) == TIM_FLAG_CC4) || \
Kojto 115:87f2f5183dfb 1350 ((__FLAG__) == TIM_FLAG_COM) || \
Kojto 115:87f2f5183dfb 1351 ((__FLAG__) == TIM_FLAG_TRIGGER) || \
Kojto 115:87f2f5183dfb 1352 ((__FLAG__) == TIM_FLAG_BREAK) || \
Kojto 115:87f2f5183dfb 1353 ((__FLAG__) == TIM_FLAG_BREAK2) || \
Kojto 115:87f2f5183dfb 1354 ((__FLAG__) == TIM_FLAG_CC1OF) || \
Kojto 115:87f2f5183dfb 1355 ((__FLAG__) == TIM_FLAG_CC2OF) || \
Kojto 115:87f2f5183dfb 1356 ((__FLAG__) == TIM_FLAG_CC3OF) || \
Kojto 115:87f2f5183dfb 1357 ((__FLAG__) == TIM_FLAG_CC4OF))
Kojto 115:87f2f5183dfb 1358
Kojto 115:87f2f5183dfb 1359 #define IS_TIM_CLOCKSOURCE(__CLOCK__) (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \
Kojto 115:87f2f5183dfb 1360 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \
Kojto 115:87f2f5183dfb 1361 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \
Kojto 115:87f2f5183dfb 1362 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \
Kojto 115:87f2f5183dfb 1363 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \
Kojto 115:87f2f5183dfb 1364 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR3) || \
Kojto 115:87f2f5183dfb 1365 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \
Kojto 115:87f2f5183dfb 1366 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \
Kojto 115:87f2f5183dfb 1367 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \
Kojto 115:87f2f5183dfb 1368 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1))
Kojto 115:87f2f5183dfb 1369
Kojto 115:87f2f5183dfb 1370 #define IS_TIM_CLOCKPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLOCKPOLARITY_INVERTED) || \
Kojto 115:87f2f5183dfb 1371 ((__POLARITY__) == TIM_CLOCKPOLARITY_NONINVERTED) || \
Kojto 115:87f2f5183dfb 1372 ((__POLARITY__) == TIM_CLOCKPOLARITY_RISING) || \
Kojto 115:87f2f5183dfb 1373 ((__POLARITY__) == TIM_CLOCKPOLARITY_FALLING) || \
Kojto 115:87f2f5183dfb 1374 ((__POLARITY__) == TIM_CLOCKPOLARITY_BOTHEDGE))
Kojto 115:87f2f5183dfb 1375
Kojto 115:87f2f5183dfb 1376 #define IS_TIM_CLOCKPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV1) || \
Kojto 115:87f2f5183dfb 1377 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV2) || \
Kojto 115:87f2f5183dfb 1378 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV4) || \
Kojto 115:87f2f5183dfb 1379 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV8))
Kojto 115:87f2f5183dfb 1380
Kojto 115:87f2f5183dfb 1381 #define IS_TIM_CLOCKFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xF)
Kojto 115:87f2f5183dfb 1382
Kojto 115:87f2f5183dfb 1383 #define IS_TIM_CLEARINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLEARINPUTPOLARITY_INVERTED) || \
Kojto 115:87f2f5183dfb 1384 ((__POLARITY__) == TIM_CLEARINPUTPOLARITY_NONINVERTED))
Kojto 115:87f2f5183dfb 1385
Kojto 115:87f2f5183dfb 1386 #define IS_TIM_CLEARINPUT_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV1) || \
Kojto 115:87f2f5183dfb 1387 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV2) || \
Kojto 115:87f2f5183dfb 1388 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV4) || \
Kojto 115:87f2f5183dfb 1389 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV8))
Kojto 115:87f2f5183dfb 1390
Kojto 115:87f2f5183dfb 1391 #define IS_TIM_CLEARINPUT_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xF)
Kojto 115:87f2f5183dfb 1392
Kojto 115:87f2f5183dfb 1393 #define IS_TIM_OSSR_STATE(__STATE__) (((__STATE__) == TIM_OSSR_ENABLE) || \
Kojto 115:87f2f5183dfb 1394 ((__STATE__) == TIM_OSSR_DISABLE))
Kojto 115:87f2f5183dfb 1395
Kojto 115:87f2f5183dfb 1396 #define IS_TIM_OSSI_STATE(__STATE__) (((__STATE__) == TIM_OSSI_ENABLE) || \
Kojto 115:87f2f5183dfb 1397 ((__STATE__) == TIM_OSSI_DISABLE))
Kojto 115:87f2f5183dfb 1398
Kojto 115:87f2f5183dfb 1399 #define IS_TIM_LOCK_LEVEL(__LEVEL__) (((__LEVEL__) == TIM_LOCKLEVEL_OFF) || \
Kojto 115:87f2f5183dfb 1400 ((__LEVEL__) == TIM_LOCKLEVEL_1) || \
Kojto 115:87f2f5183dfb 1401 ((__LEVEL__) == TIM_LOCKLEVEL_2) || \
Kojto 115:87f2f5183dfb 1402 ((__LEVEL__) == TIM_LOCKLEVEL_3))
Kojto 115:87f2f5183dfb 1403
Kojto 115:87f2f5183dfb 1404 #define IS_TIM_BREAK_STATE(__STATE__) (((__STATE__) == TIM_BREAK_ENABLE) || \
Kojto 115:87f2f5183dfb 1405 ((__STATE__) == TIM_BREAK_DISABLE))
Kojto 115:87f2f5183dfb 1406
Kojto 115:87f2f5183dfb 1407 #define IS_TIM_BREAK_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKPOLARITY_LOW) || \
Kojto 115:87f2f5183dfb 1408 ((__POLARITY__) == TIM_BREAKPOLARITY_HIGH))
Kojto 115:87f2f5183dfb 1409
Kojto 115:87f2f5183dfb 1410 #define IS_TIM_AUTOMATIC_OUTPUT_STATE(__STATE__) (((__STATE__) == TIM_AUTOMATICOUTPUT_ENABLE) || \
Kojto 115:87f2f5183dfb 1411 ((__STATE__) == TIM_AUTOMATICOUTPUT_DISABLE))
Kojto 115:87f2f5183dfb 1412
Kojto 115:87f2f5183dfb 1413 #define IS_TIM_TRGO_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_TRGO_RESET) || \
Kojto 115:87f2f5183dfb 1414 ((__SOURCE__) == TIM_TRGO_ENABLE) || \
Kojto 115:87f2f5183dfb 1415 ((__SOURCE__) == TIM_TRGO_UPDATE) || \
Kojto 115:87f2f5183dfb 1416 ((__SOURCE__) == TIM_TRGO_OC1) || \
Kojto 115:87f2f5183dfb 1417 ((__SOURCE__) == TIM_TRGO_OC1REF) || \
Kojto 115:87f2f5183dfb 1418 ((__SOURCE__) == TIM_TRGO_OC2REF) || \
Kojto 115:87f2f5183dfb 1419 ((__SOURCE__) == TIM_TRGO_OC3REF) || \
Kojto 115:87f2f5183dfb 1420 ((__SOURCE__) == TIM_TRGO_OC4REF))
Kojto 115:87f2f5183dfb 1421
Kojto 115:87f2f5183dfb 1422 #define IS_TIM_MSM_STATE(__STATE__) (((__STATE__) == TIM_MASTERSLAVEMODE_ENABLE) || \
Kojto 115:87f2f5183dfb 1423 ((__STATE__) == TIM_MASTERSLAVEMODE_DISABLE))
Kojto 115:87f2f5183dfb 1424
Kojto 115:87f2f5183dfb 1425 #define IS_TIM_TRIGGER_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \
Kojto 115:87f2f5183dfb 1426 ((__SELECTION__) == TIM_TS_ITR1) || \
Kojto 115:87f2f5183dfb 1427 ((__SELECTION__) == TIM_TS_ITR2) || \
Kojto 115:87f2f5183dfb 1428 ((__SELECTION__) == TIM_TS_ITR3) || \
Kojto 115:87f2f5183dfb 1429 ((__SELECTION__) == TIM_TS_TI1F_ED) || \
Kojto 115:87f2f5183dfb 1430 ((__SELECTION__) == TIM_TS_TI1FP1) || \
Kojto 115:87f2f5183dfb 1431 ((__SELECTION__) == TIM_TS_TI2FP2) || \
Kojto 115:87f2f5183dfb 1432 ((__SELECTION__) == TIM_TS_ETRF))
Kojto 115:87f2f5183dfb 1433
Kojto 115:87f2f5183dfb 1434 #define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \
Kojto 115:87f2f5183dfb 1435 ((SELECTION) == TIM_TS_ITR1) || \
Kojto 115:87f2f5183dfb 1436 ((SELECTION) == TIM_TS_ITR2) || \
Kojto 115:87f2f5183dfb 1437 ((SELECTION) == TIM_TS_ITR3))
Kojto 115:87f2f5183dfb 1438
Kojto 115:87f2f5183dfb 1439 #define IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \
Kojto 115:87f2f5183dfb 1440 ((__SELECTION__) == TIM_TS_ITR1) || \
Kojto 115:87f2f5183dfb 1441 ((__SELECTION__) == TIM_TS_ITR2) || \
Kojto 115:87f2f5183dfb 1442 ((__SELECTION__) == TIM_TS_ITR3) || \
Kojto 115:87f2f5183dfb 1443 ((__SELECTION__) == TIM_TS_NONE))
Kojto 115:87f2f5183dfb 1444
Kojto 115:87f2f5183dfb 1445 #define IS_TIM_TRIGGERPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_TRIGGERPOLARITY_INVERTED ) || \
Kojto 115:87f2f5183dfb 1446 ((__POLARITY__) == TIM_TRIGGERPOLARITY_NONINVERTED) || \
Kojto 115:87f2f5183dfb 1447 ((__POLARITY__) == TIM_TRIGGERPOLARITY_RISING ) || \
Kojto 115:87f2f5183dfb 1448 ((__POLARITY__) == TIM_TRIGGERPOLARITY_FALLING ) || \
Kojto 115:87f2f5183dfb 1449 ((__POLARITY__) == TIM_TRIGGERPOLARITY_BOTHEDGE ))
Kojto 115:87f2f5183dfb 1450
Kojto 115:87f2f5183dfb 1451 #define IS_TIM_TRIGGERPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV1) || \
Kojto 115:87f2f5183dfb 1452 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV2) || \
Kojto 115:87f2f5183dfb 1453 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV4) || \
Kojto 115:87f2f5183dfb 1454 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV8))
Kojto 115:87f2f5183dfb 1455
Kojto 115:87f2f5183dfb 1456 #define IS_TIM_TRIGGERFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xF)
Kojto 115:87f2f5183dfb 1457
Kojto 115:87f2f5183dfb 1458 #define IS_TIM_TI1SELECTION(__TI1SELECTION__) (((__TI1SELECTION__) == TIM_TI1SELECTION_CH1) || \
Kojto 115:87f2f5183dfb 1459 ((__TI1SELECTION__) == TIM_TI1SELECTION_XORCOMBINATION))
Kojto 115:87f2f5183dfb 1460
Kojto 115:87f2f5183dfb 1461 #define IS_TIM_DMA_BASE(__BASE__) (((__BASE__) == TIM_DMABASE_CR1) || \
Kojto 115:87f2f5183dfb 1462 ((__BASE__) == TIM_DMABASE_CR2) || \
Kojto 115:87f2f5183dfb 1463 ((__BASE__) == TIM_DMABASE_SMCR) || \
Kojto 115:87f2f5183dfb 1464 ((__BASE__) == TIM_DMABASE_DIER) || \
Kojto 115:87f2f5183dfb 1465 ((__BASE__) == TIM_DMABASE_SR) || \
Kojto 115:87f2f5183dfb 1466 ((__BASE__) == TIM_DMABASE_EGR) || \
Kojto 115:87f2f5183dfb 1467 ((__BASE__) == TIM_DMABASE_CCMR1) || \
Kojto 115:87f2f5183dfb 1468 ((__BASE__) == TIM_DMABASE_CCMR2) || \
Kojto 115:87f2f5183dfb 1469 ((__BASE__) == TIM_DMABASE_CCER) || \
Kojto 115:87f2f5183dfb 1470 ((__BASE__) == TIM_DMABASE_CNT) || \
Kojto 115:87f2f5183dfb 1471 ((__BASE__) == TIM_DMABASE_PSC) || \
Kojto 115:87f2f5183dfb 1472 ((__BASE__) == TIM_DMABASE_ARR) || \
Kojto 115:87f2f5183dfb 1473 ((__BASE__) == TIM_DMABASE_RCR) || \
Kojto 115:87f2f5183dfb 1474 ((__BASE__) == TIM_DMABASE_CCR1) || \
Kojto 115:87f2f5183dfb 1475 ((__BASE__) == TIM_DMABASE_CCR2) || \
Kojto 115:87f2f5183dfb 1476 ((__BASE__) == TIM_DMABASE_CCR3) || \
Kojto 115:87f2f5183dfb 1477 ((__BASE__) == TIM_DMABASE_CCR4) || \
Kojto 115:87f2f5183dfb 1478 ((__BASE__) == TIM_DMABASE_BDTR) || \
Kojto 115:87f2f5183dfb 1479 ((__BASE__) == TIM_DMABASE_DCR) || \
Kojto 115:87f2f5183dfb 1480 ((__BASE__) == TIM_DMABASE_OR))
Kojto 115:87f2f5183dfb 1481
Kojto 115:87f2f5183dfb 1482 #define IS_TIM_DMA_LENGTH(__LENGTH__) (((__LENGTH__) == TIM_DMABURSTLENGTH_1TRANSFER) || \
Kojto 115:87f2f5183dfb 1483 ((__LENGTH__) == TIM_DMABURSTLENGTH_2TRANSFERS) || \
Kojto 115:87f2f5183dfb 1484 ((__LENGTH__) == TIM_DMABURSTLENGTH_3TRANSFERS) || \
Kojto 115:87f2f5183dfb 1485 ((__LENGTH__) == TIM_DMABURSTLENGTH_4TRANSFERS) || \
Kojto 115:87f2f5183dfb 1486 ((__LENGTH__) == TIM_DMABURSTLENGTH_5TRANSFERS) || \
Kojto 115:87f2f5183dfb 1487 ((__LENGTH__) == TIM_DMABURSTLENGTH_6TRANSFERS) || \
Kojto 115:87f2f5183dfb 1488 ((__LENGTH__) == TIM_DMABURSTLENGTH_7TRANSFERS) || \
Kojto 115:87f2f5183dfb 1489 ((__LENGTH__) == TIM_DMABURSTLENGTH_8TRANSFERS) || \
Kojto 115:87f2f5183dfb 1490 ((__LENGTH__) == TIM_DMABURSTLENGTH_9TRANSFERS) || \
Kojto 115:87f2f5183dfb 1491 ((__LENGTH__) == TIM_DMABURSTLENGTH_10TRANSFERS) || \
Kojto 115:87f2f5183dfb 1492 ((__LENGTH__) == TIM_DMABURSTLENGTH_11TRANSFERS) || \
Kojto 115:87f2f5183dfb 1493 ((__LENGTH__) == TIM_DMABURSTLENGTH_12TRANSFERS) || \
Kojto 115:87f2f5183dfb 1494 ((__LENGTH__) == TIM_DMABURSTLENGTH_13TRANSFERS) || \
Kojto 115:87f2f5183dfb 1495 ((__LENGTH__) == TIM_DMABURSTLENGTH_14TRANSFERS) || \
Kojto 115:87f2f5183dfb 1496 ((__LENGTH__) == TIM_DMABURSTLENGTH_15TRANSFERS) || \
Kojto 115:87f2f5183dfb 1497 ((__LENGTH__) == TIM_DMABURSTLENGTH_16TRANSFERS) || \
Kojto 115:87f2f5183dfb 1498 ((__LENGTH__) == TIM_DMABURSTLENGTH_17TRANSFERS) || \
Kojto 115:87f2f5183dfb 1499 ((__LENGTH__) == TIM_DMABURSTLENGTH_18TRANSFERS))
Kojto 115:87f2f5183dfb 1500
Kojto 115:87f2f5183dfb 1501 #define IS_TIM_IC_FILTER(ICFILTER) ((ICFILTER) <= 0xF)
Kojto 115:87f2f5183dfb 1502
Kojto 115:87f2f5183dfb 1503
Kojto 115:87f2f5183dfb 1504 /**
Kojto 115:87f2f5183dfb 1505 * @}
Kojto 115:87f2f5183dfb 1506 */
Kojto 115:87f2f5183dfb 1507
Kojto 115:87f2f5183dfb 1508 /**
Kojto 115:87f2f5183dfb 1509 * @}
Kojto 115:87f2f5183dfb 1510 */
Kojto 115:87f2f5183dfb 1511
Kojto 115:87f2f5183dfb 1512 /* Private functions ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 1513 /** @defgroup TIM_Private_Functions TIM Private Functions
Kojto 115:87f2f5183dfb 1514 * @{
Kojto 115:87f2f5183dfb 1515 */
Kojto 115:87f2f5183dfb 1516 void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure);
Kojto 115:87f2f5183dfb 1517 void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter);
Kojto 115:87f2f5183dfb 1518 void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
Kojto 115:87f2f5183dfb 1519 void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
Kojto 115:87f2f5183dfb 1520 void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
Kojto 115:87f2f5183dfb 1521 void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
Kojto 115:87f2f5183dfb 1522 void TIM_ETR_SetConfig(TIM_TypeDef* TIMx, uint32_t TIM_ExtTRGPrescaler, uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter);
Kojto 115:87f2f5183dfb 1523
Kojto 115:87f2f5183dfb 1524 void HAL_TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma);
Kojto 115:87f2f5183dfb 1525 void HAL_TIM_DMAError(DMA_HandleTypeDef *hdma);
Kojto 115:87f2f5183dfb 1526 void HAL_TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma);
Kojto 115:87f2f5183dfb 1527 void TIM_CCxChannelCmd(TIM_TypeDef* TIMx, uint32_t Channel, uint32_t ChannelState);
Kojto 115:87f2f5183dfb 1528 /**
Kojto 115:87f2f5183dfb 1529 * @}
Kojto 115:87f2f5183dfb 1530 */
Kojto 115:87f2f5183dfb 1531
Kojto 115:87f2f5183dfb 1532 /**
Kojto 115:87f2f5183dfb 1533 * @}
Kojto 115:87f2f5183dfb 1534 */
Kojto 115:87f2f5183dfb 1535
Kojto 115:87f2f5183dfb 1536 /**
Kojto 115:87f2f5183dfb 1537 * @}
Kojto 115:87f2f5183dfb 1538 */
Kojto 115:87f2f5183dfb 1539
Kojto 115:87f2f5183dfb 1540 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 1541 }
Kojto 115:87f2f5183dfb 1542 #endif
Kojto 115:87f2f5183dfb 1543
Kojto 115:87f2f5183dfb 1544 #endif /* __STM32F7xx_HAL_TIM_H */
Kojto 115:87f2f5183dfb 1545
Kojto 115:87f2f5183dfb 1546 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/