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