Elijah Orr / mbed-renbed

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Thu Oct 29 08:40:18 2015 +0000
Revision:
109:9296ab0bfc11
Release 109  of the mbed library

Changes:
- new platforms - NUCLEO_F042K6, WIZNWIKI_W7500ECO
- MTS targets - bootloaders update to 0.1.1
- STM F7 - RTC enable fixes
- STM F4 - i2c pending stop before start fix
- STM all targets - analogout normalization fix

Who changed what in which revision?

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