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

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

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