The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Oct 28 16:40:41 2014 +0000
Revision:
90:cb3d968589d8
Release 90 of the mbed library

Changes:

- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files

Who changed what in which revision?

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