meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
90:cb3d968589d8
Child:
93:e188a91d3eaa
dgdgr

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