meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Parent:
81:7d30d6019079
Child:
90:cb3d968589d8
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

Who changed what in which revision?

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