meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Fri Oct 02 07:35:07 2015 +0200
Revision:
108:34e6b704fe68
Parent:
93:e188a91d3eaa
Release 108  of the mbed library

Changes:
- new platforms - ELMO_F411RE, WIZNET_7500P, ARM_MPS2_BEID
- EFM32 - bugfixes in rtc, serial
- Cortex A cmsis - update files
- STML4 - RAM fixes

Who changed what in which revision?

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