mbed w/ spi bug fig

Dependents:   display-puck

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Jun 27 07:30:09 2014 +0100
Revision:
242:7074e42da0b2
Parent:
133:d4dda5c437f0
Synchronized with git revision 124ef5e3add9e74a3221347a3fbeea7c8b3cf353

Full URL: https://github.com/mbedmicro/mbed/commit/124ef5e3add9e74a3221347a3fbeea7c8b3cf353/

[DISCO_F407VG] HAL update.

Who changed what in which revision?

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