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:
100:cbbeb26dbd92
.

Who changed what in which revision?

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