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