version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_NUCLEO_F030R8/stm32f0xx_tim.h@77:869cf507173a, 2014-02-14 (annotated)
- Committer:
- emilmont
- Date:
- Fri Feb 14 14:36:43 2014 +0000
- Revision:
- 77:869cf507173a
- Child:
- 81:7d30d6019079
Release 77 of the mbed library
Main changes:
* Add target NUCLEO_F030R8
* Add target NUCLEO_F401RE
* Add target NUCLEO_F103RB
* Add target NUCLEO_L152RE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
emilmont | 77:869cf507173a | 3 | * @file stm32f0xx_tim.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
emilmont | 77:869cf507173a | 5 | * @version V1.3.0 |
emilmont | 77:869cf507173a | 6 | * @date 16-January-2014 |
emilmont | 77:869cf507173a | 7 | * @brief This file contains all the functions prototypes for the TIM |
emilmont | 77:869cf507173a | 8 | * firmware library. |
emilmont | 77:869cf507173a | 9 | ****************************************************************************** |
emilmont | 77:869cf507173a | 10 | * @attention |
emilmont | 77:869cf507173a | 11 | * |
emilmont | 77:869cf507173a | 12 | * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 13 | * |
emilmont | 77:869cf507173a | 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
emilmont | 77:869cf507173a | 15 | * You may not use this file except in compliance with the License. |
emilmont | 77:869cf507173a | 16 | * You may obtain a copy of the License at: |
emilmont | 77:869cf507173a | 17 | * |
emilmont | 77:869cf507173a | 18 | * http://www.st.com/software_license_agreement_liberty_v2 |
emilmont | 77:869cf507173a | 19 | * |
emilmont | 77:869cf507173a | 20 | * Unless required by applicable law or agreed to in writing, software |
emilmont | 77:869cf507173a | 21 | * distributed under the License is distributed on an "AS IS" BASIS, |
emilmont | 77:869cf507173a | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
emilmont | 77:869cf507173a | 23 | * See the License for the specific language governing permissions and |
emilmont | 77:869cf507173a | 24 | * limitations under the License. |
emilmont | 77:869cf507173a | 25 | * |
emilmont | 77:869cf507173a | 26 | ****************************************************************************** |
emilmont | 77:869cf507173a | 27 | */ |
emilmont | 77:869cf507173a | 28 | |
emilmont | 77:869cf507173a | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 30 | #ifndef __STM32F0XX_TIM_H |
emilmont | 77:869cf507173a | 31 | #define __STM32F0XX_TIM_H |
emilmont | 77:869cf507173a | 32 | |
emilmont | 77:869cf507173a | 33 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 34 | extern "C" { |
emilmont | 77:869cf507173a | 35 | #endif |
emilmont | 77:869cf507173a | 36 | |
emilmont | 77:869cf507173a | 37 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 38 | #include "stm32f0xx.h" |
emilmont | 77:869cf507173a | 39 | |
emilmont | 77:869cf507173a | 40 | /** @addtogroup STM32F0xx_StdPeriph_Driver |
emilmont | 77:869cf507173a | 41 | * @{ |
emilmont | 77:869cf507173a | 42 | */ |
emilmont | 77:869cf507173a | 43 | |
emilmont | 77:869cf507173a | 44 | /** @addtogroup TIM |
emilmont | 77:869cf507173a | 45 | * @{ |
emilmont | 77:869cf507173a | 46 | */ |
emilmont | 77:869cf507173a | 47 | |
emilmont | 77:869cf507173a | 48 | /* Exported types ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 49 | |
emilmont | 77:869cf507173a | 50 | /** |
emilmont | 77:869cf507173a | 51 | * @brief TIM Time Base Init structure definition |
emilmont | 77:869cf507173a | 52 | * @note This sturcture is used with all TIMx. |
emilmont | 77:869cf507173a | 53 | */ |
emilmont | 77:869cf507173a | 54 | |
emilmont | 77:869cf507173a | 55 | typedef struct |
emilmont | 77:869cf507173a | 56 | { |
emilmont | 77:869cf507173a | 57 | uint16_t TIM_Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. |
emilmont | 77:869cf507173a | 58 | This parameter can be a number between 0x0000 and 0xFFFF */ |
emilmont | 77:869cf507173a | 59 | |
emilmont | 77:869cf507173a | 60 | uint16_t TIM_CounterMode; /*!< Specifies the counter mode. |
emilmont | 77:869cf507173a | 61 | This parameter can be a value of @ref TIM_Counter_Mode */ |
emilmont | 77:869cf507173a | 62 | |
emilmont | 77:869cf507173a | 63 | uint32_t TIM_Period; /*!< Specifies the period value to be loaded into the active |
emilmont | 77:869cf507173a | 64 | Auto-Reload Register at the next update event. |
emilmont | 77:869cf507173a | 65 | This parameter must be a number between 0x0000 and 0xFFFF. */ |
emilmont | 77:869cf507173a | 66 | |
emilmont | 77:869cf507173a | 67 | uint16_t TIM_ClockDivision; /*!< Specifies the clock division. |
emilmont | 77:869cf507173a | 68 | This parameter can be a value of @ref TIM_Clock_Division_CKD */ |
emilmont | 77:869cf507173a | 69 | |
emilmont | 77:869cf507173a | 70 | uint8_t TIM_RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter |
emilmont | 77:869cf507173a | 71 | reaches zero, an update event is generated and counting restarts |
emilmont | 77:869cf507173a | 72 | from the RCR value (N). |
emilmont | 77:869cf507173a | 73 | This means in PWM mode that (N+1) corresponds to: |
emilmont | 77:869cf507173a | 74 | - the number of PWM periods in edge-aligned mode |
emilmont | 77:869cf507173a | 75 | - the number of half PWM period in center-aligned mode |
emilmont | 77:869cf507173a | 76 | This parameter must be a number between 0x00 and 0xFF. |
emilmont | 77:869cf507173a | 77 | @note This parameter is valid only for TIM1. */ |
emilmont | 77:869cf507173a | 78 | } TIM_TimeBaseInitTypeDef; |
emilmont | 77:869cf507173a | 79 | |
emilmont | 77:869cf507173a | 80 | /** |
emilmont | 77:869cf507173a | 81 | * @brief TIM Output Compare Init structure definition |
emilmont | 77:869cf507173a | 82 | */ |
emilmont | 77:869cf507173a | 83 | |
emilmont | 77:869cf507173a | 84 | typedef struct |
emilmont | 77:869cf507173a | 85 | { |
emilmont | 77:869cf507173a | 86 | uint16_t TIM_OCMode; /*!< Specifies the TIM mode. |
emilmont | 77:869cf507173a | 87 | This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */ |
emilmont | 77:869cf507173a | 88 | |
emilmont | 77:869cf507173a | 89 | uint16_t TIM_OutputState; /*!< Specifies the TIM Output Compare state. |
emilmont | 77:869cf507173a | 90 | This parameter can be a value of @ref TIM_Output_Compare_state */ |
emilmont | 77:869cf507173a | 91 | |
emilmont | 77:869cf507173a | 92 | uint16_t TIM_OutputNState; /*!< Specifies the TIM complementary Output Compare state. |
emilmont | 77:869cf507173a | 93 | This parameter can be a value of @ref TIM_Output_Compare_N_state |
emilmont | 77:869cf507173a | 94 | @note This parameter is valid only for TIM1. */ |
emilmont | 77:869cf507173a | 95 | |
emilmont | 77:869cf507173a | 96 | uint32_t TIM_Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register. |
emilmont | 77:869cf507173a | 97 | This parameter can be a number between 0x0000 and 0xFFFF ( or 0xFFFFFFFF |
emilmont | 77:869cf507173a | 98 | for TIM2) */ |
emilmont | 77:869cf507173a | 99 | |
emilmont | 77:869cf507173a | 100 | uint16_t TIM_OCPolarity; /*!< Specifies the output polarity. |
emilmont | 77:869cf507173a | 101 | This parameter can be a value of @ref TIM_Output_Compare_Polarity */ |
emilmont | 77:869cf507173a | 102 | |
emilmont | 77:869cf507173a | 103 | uint16_t TIM_OCNPolarity; /*!< Specifies the complementary output polarity. |
emilmont | 77:869cf507173a | 104 | This parameter can be a value of @ref TIM_Output_Compare_N_Polarity |
emilmont | 77:869cf507173a | 105 | @note This parameter is valid only for TIM1. */ |
emilmont | 77:869cf507173a | 106 | |
emilmont | 77:869cf507173a | 107 | uint16_t TIM_OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. |
emilmont | 77:869cf507173a | 108 | This parameter can be a value of @ref TIM_Output_Compare_Idle_State |
emilmont | 77:869cf507173a | 109 | @note This parameter is valid only for TIM1. */ |
emilmont | 77:869cf507173a | 110 | |
emilmont | 77:869cf507173a | 111 | uint16_t TIM_OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. |
emilmont | 77:869cf507173a | 112 | This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State |
emilmont | 77:869cf507173a | 113 | @note This parameter is valid only for TIM1. */ |
emilmont | 77:869cf507173a | 114 | } TIM_OCInitTypeDef; |
emilmont | 77:869cf507173a | 115 | |
emilmont | 77:869cf507173a | 116 | /** |
emilmont | 77:869cf507173a | 117 | * @brief TIM Input Capture Init structure definition |
emilmont | 77:869cf507173a | 118 | */ |
emilmont | 77:869cf507173a | 119 | |
emilmont | 77:869cf507173a | 120 | typedef struct |
emilmont | 77:869cf507173a | 121 | { |
emilmont | 77:869cf507173a | 122 | |
emilmont | 77:869cf507173a | 123 | uint16_t TIM_Channel; /*!< Specifies the TIM channel. |
emilmont | 77:869cf507173a | 124 | This parameter can be a value of @ref TIM_Channel */ |
emilmont | 77:869cf507173a | 125 | |
emilmont | 77:869cf507173a | 126 | uint16_t TIM_ICPolarity; /*!< Specifies the active edge of the input signal. |
emilmont | 77:869cf507173a | 127 | This parameter can be a value of @ref TIM_Input_Capture_Polarity */ |
emilmont | 77:869cf507173a | 128 | |
emilmont | 77:869cf507173a | 129 | uint16_t TIM_ICSelection; /*!< Specifies the input. |
emilmont | 77:869cf507173a | 130 | This parameter can be a value of @ref TIM_Input_Capture_Selection */ |
emilmont | 77:869cf507173a | 131 | |
emilmont | 77:869cf507173a | 132 | uint16_t TIM_ICPrescaler; /*!< Specifies the Input Capture Prescaler. |
emilmont | 77:869cf507173a | 133 | This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ |
emilmont | 77:869cf507173a | 134 | |
emilmont | 77:869cf507173a | 135 | uint16_t TIM_ICFilter; /*!< Specifies the input capture filter. |
emilmont | 77:869cf507173a | 136 | This parameter can be a number between 0x0 and 0xF */ |
emilmont | 77:869cf507173a | 137 | } TIM_ICInitTypeDef; |
emilmont | 77:869cf507173a | 138 | |
emilmont | 77:869cf507173a | 139 | /** |
emilmont | 77:869cf507173a | 140 | * @brief TIM_BDTR structure definition |
emilmont | 77:869cf507173a | 141 | * @note This sturcture is used only with TIM1. |
emilmont | 77:869cf507173a | 142 | */ |
emilmont | 77:869cf507173a | 143 | |
emilmont | 77:869cf507173a | 144 | typedef struct |
emilmont | 77:869cf507173a | 145 | { |
emilmont | 77:869cf507173a | 146 | |
emilmont | 77:869cf507173a | 147 | uint16_t TIM_OSSRState; /*!< Specifies the Off-State selection used in Run mode. |
emilmont | 77:869cf507173a | 148 | This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */ |
emilmont | 77:869cf507173a | 149 | |
emilmont | 77:869cf507173a | 150 | uint16_t TIM_OSSIState; /*!< Specifies the Off-State used in Idle state. |
emilmont | 77:869cf507173a | 151 | This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */ |
emilmont | 77:869cf507173a | 152 | |
emilmont | 77:869cf507173a | 153 | uint16_t TIM_LOCKLevel; /*!< Specifies the LOCK level parameters. |
emilmont | 77:869cf507173a | 154 | This parameter can be a value of @ref TIM_Lock_level */ |
emilmont | 77:869cf507173a | 155 | |
emilmont | 77:869cf507173a | 156 | uint16_t TIM_DeadTime; /*!< Specifies the delay time between the switching-off and the |
emilmont | 77:869cf507173a | 157 | switching-on of the outputs. |
emilmont | 77:869cf507173a | 158 | This parameter can be a number between 0x00 and 0xFF */ |
emilmont | 77:869cf507173a | 159 | |
emilmont | 77:869cf507173a | 160 | uint16_t TIM_Break; /*!< Specifies whether the TIM Break input is enabled or not. |
emilmont | 77:869cf507173a | 161 | This parameter can be a value of @ref TIM_Break_Input_enable_disable */ |
emilmont | 77:869cf507173a | 162 | |
emilmont | 77:869cf507173a | 163 | uint16_t TIM_BreakPolarity; /*!< Specifies the TIM Break Input pin polarity. |
emilmont | 77:869cf507173a | 164 | This parameter can be a value of @ref TIM_Break_Polarity */ |
emilmont | 77:869cf507173a | 165 | |
emilmont | 77:869cf507173a | 166 | uint16_t TIM_AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not. |
emilmont | 77:869cf507173a | 167 | This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */ |
emilmont | 77:869cf507173a | 168 | } TIM_BDTRInitTypeDef; |
emilmont | 77:869cf507173a | 169 | |
emilmont | 77:869cf507173a | 170 | /** |
emilmont | 77:869cf507173a | 171 | * @brief TIM Input Capture Init structure definition |
emilmont | 77:869cf507173a | 172 | */ |
emilmont | 77:869cf507173a | 173 | |
emilmont | 77:869cf507173a | 174 | /* Exported constants --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 175 | |
emilmont | 77:869cf507173a | 176 | |
emilmont | 77:869cf507173a | 177 | /** @defgroup TIM_Exported_constants |
emilmont | 77:869cf507173a | 178 | * @{ |
emilmont | 77:869cf507173a | 179 | */ |
emilmont | 77:869cf507173a | 180 | |
emilmont | 77:869cf507173a | 181 | #define IS_TIM_ALL_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 182 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 183 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 184 | ((PERIPH) == TIM6) || \ |
emilmont | 77:869cf507173a | 185 | ((PERIPH) == TIM7) || \ |
emilmont | 77:869cf507173a | 186 | ((PERIPH) == TIM14)|| \ |
emilmont | 77:869cf507173a | 187 | ((PERIPH) == TIM15)|| \ |
emilmont | 77:869cf507173a | 188 | ((PERIPH) == TIM16)|| \ |
emilmont | 77:869cf507173a | 189 | ((PERIPH) == TIM17)) |
emilmont | 77:869cf507173a | 190 | |
emilmont | 77:869cf507173a | 191 | /* LIST1: TIM 1 */ |
emilmont | 77:869cf507173a | 192 | #define IS_TIM_LIST1_PERIPH(PERIPH) ((PERIPH) == TIM1) |
emilmont | 77:869cf507173a | 193 | |
emilmont | 77:869cf507173a | 194 | /* LIST2: TIM 1, 15, 16 and 17 */ |
emilmont | 77:869cf507173a | 195 | #define IS_TIM_LIST2_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 196 | ((PERIPH) == TIM15)|| \ |
emilmont | 77:869cf507173a | 197 | ((PERIPH) == TIM16)|| \ |
emilmont | 77:869cf507173a | 198 | ((PERIPH) == TIM17)) |
emilmont | 77:869cf507173a | 199 | |
emilmont | 77:869cf507173a | 200 | /* LIST3: TIM 1, 2 and 3 */ |
emilmont | 77:869cf507173a | 201 | #define IS_TIM_LIST3_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 202 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 203 | ((PERIPH) == TIM3)) |
emilmont | 77:869cf507173a | 204 | |
emilmont | 77:869cf507173a | 205 | /* LIST4: TIM 1, 2, 3, 14, 15, 16 and 17 */ |
emilmont | 77:869cf507173a | 206 | #define IS_TIM_LIST4_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 207 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 208 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 209 | ((PERIPH) == TIM14) || \ |
emilmont | 77:869cf507173a | 210 | ((PERIPH) == TIM15)|| \ |
emilmont | 77:869cf507173a | 211 | ((PERIPH) == TIM16)|| \ |
emilmont | 77:869cf507173a | 212 | ((PERIPH) == TIM17)) |
emilmont | 77:869cf507173a | 213 | |
emilmont | 77:869cf507173a | 214 | /* LIST5: TIM 1, 2, 3, 15, 16 and 17 */ |
emilmont | 77:869cf507173a | 215 | #define IS_TIM_LIST5_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 216 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 217 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 218 | ((PERIPH) == TIM15)|| \ |
emilmont | 77:869cf507173a | 219 | ((PERIPH) == TIM16)|| \ |
emilmont | 77:869cf507173a | 220 | ((PERIPH) == TIM17)) |
emilmont | 77:869cf507173a | 221 | |
emilmont | 77:869cf507173a | 222 | /* LIST6: TIM 1, 2, 3 and 15 */ |
emilmont | 77:869cf507173a | 223 | #define IS_TIM_LIST6_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 224 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 225 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 226 | ((PERIPH) == TIM15)) |
emilmont | 77:869cf507173a | 227 | |
emilmont | 77:869cf507173a | 228 | /* LIST7: TIM 1, 2, 3, 6, 7 and 14 */ |
emilmont | 77:869cf507173a | 229 | #define IS_TIM_LIST7_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 230 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 231 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 232 | ((PERIPH) == TIM6) || \ |
emilmont | 77:869cf507173a | 233 | ((PERIPH) == TIM7) || \ |
emilmont | 77:869cf507173a | 234 | ((PERIPH) == TIM14)) |
emilmont | 77:869cf507173a | 235 | |
emilmont | 77:869cf507173a | 236 | /* LIST8: TIM 1, 2, 3 and 14 */ |
emilmont | 77:869cf507173a | 237 | #define IS_TIM_LIST8_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 238 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 239 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 240 | ((PERIPH) == TIM14)) |
emilmont | 77:869cf507173a | 241 | |
emilmont | 77:869cf507173a | 242 | /* LIST9: TIM 1, 2, 3, 6, 7 and 15 */ |
emilmont | 77:869cf507173a | 243 | #define IS_TIM_LIST9_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 244 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 245 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 246 | ((PERIPH) == TIM6) || \ |
emilmont | 77:869cf507173a | 247 | ((PERIPH) == TIM7) || \ |
emilmont | 77:869cf507173a | 248 | ((PERIPH) == TIM15)) |
emilmont | 77:869cf507173a | 249 | |
emilmont | 77:869cf507173a | 250 | /* LIST10: TIM 1, 2, 3, 6, 7, 15, 16 and 17 */ |
emilmont | 77:869cf507173a | 251 | #define IS_TIM_LIST10_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ |
emilmont | 77:869cf507173a | 252 | ((PERIPH) == TIM2) || \ |
emilmont | 77:869cf507173a | 253 | ((PERIPH) == TIM3) || \ |
emilmont | 77:869cf507173a | 254 | ((PERIPH) == TIM6) || \ |
emilmont | 77:869cf507173a | 255 | ((PERIPH) == TIM7) || \ |
emilmont | 77:869cf507173a | 256 | ((PERIPH) == TIM15)|| \ |
emilmont | 77:869cf507173a | 257 | ((PERIPH) == TIM16)|| \ |
emilmont | 77:869cf507173a | 258 | ((PERIPH) == TIM17)) |
emilmont | 77:869cf507173a | 259 | |
emilmont | 77:869cf507173a | 260 | /* LIST1: TIM 11 */ |
emilmont | 77:869cf507173a | 261 | #define IS_TIM_LIST11_PERIPH(PERIPH) ((PERIPH) == TIM14) |
emilmont | 77:869cf507173a | 262 | |
emilmont | 77:869cf507173a | 263 | |
emilmont | 77:869cf507173a | 264 | /** |
emilmont | 77:869cf507173a | 265 | * @} |
emilmont | 77:869cf507173a | 266 | */ |
emilmont | 77:869cf507173a | 267 | |
emilmont | 77:869cf507173a | 268 | /** @defgroup TIM_Output_Compare_and_PWM_modes |
emilmont | 77:869cf507173a | 269 | * @{ |
emilmont | 77:869cf507173a | 270 | */ |
emilmont | 77:869cf507173a | 271 | |
emilmont | 77:869cf507173a | 272 | #define TIM_OCMode_Timing ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 273 | #define TIM_OCMode_Active ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 274 | #define TIM_OCMode_Inactive ((uint16_t)0x0020) |
emilmont | 77:869cf507173a | 275 | #define TIM_OCMode_Toggle ((uint16_t)0x0030) |
emilmont | 77:869cf507173a | 276 | #define TIM_OCMode_PWM1 ((uint16_t)0x0060) |
emilmont | 77:869cf507173a | 277 | #define TIM_OCMode_PWM2 ((uint16_t)0x0070) |
emilmont | 77:869cf507173a | 278 | #define IS_TIM_OC_MODE(MODE) (((MODE) == TIM_OCMode_Timing) || \ |
emilmont | 77:869cf507173a | 279 | ((MODE) == TIM_OCMode_Active) || \ |
emilmont | 77:869cf507173a | 280 | ((MODE) == TIM_OCMode_Inactive) || \ |
emilmont | 77:869cf507173a | 281 | ((MODE) == TIM_OCMode_Toggle)|| \ |
emilmont | 77:869cf507173a | 282 | ((MODE) == TIM_OCMode_PWM1) || \ |
emilmont | 77:869cf507173a | 283 | ((MODE) == TIM_OCMode_PWM2)) |
emilmont | 77:869cf507173a | 284 | #define IS_TIM_OCM(MODE) (((MODE) == TIM_OCMode_Timing) || \ |
emilmont | 77:869cf507173a | 285 | ((MODE) == TIM_OCMode_Active) || \ |
emilmont | 77:869cf507173a | 286 | ((MODE) == TIM_OCMode_Inactive) || \ |
emilmont | 77:869cf507173a | 287 | ((MODE) == TIM_OCMode_Toggle)|| \ |
emilmont | 77:869cf507173a | 288 | ((MODE) == TIM_OCMode_PWM1) || \ |
emilmont | 77:869cf507173a | 289 | ((MODE) == TIM_OCMode_PWM2) || \ |
emilmont | 77:869cf507173a | 290 | ((MODE) == TIM_ForcedAction_Active) || \ |
emilmont | 77:869cf507173a | 291 | ((MODE) == TIM_ForcedAction_InActive)) |
emilmont | 77:869cf507173a | 292 | /** |
emilmont | 77:869cf507173a | 293 | * @} |
emilmont | 77:869cf507173a | 294 | */ |
emilmont | 77:869cf507173a | 295 | |
emilmont | 77:869cf507173a | 296 | /** @defgroup TIM_One_Pulse_Mode |
emilmont | 77:869cf507173a | 297 | * @{ |
emilmont | 77:869cf507173a | 298 | */ |
emilmont | 77:869cf507173a | 299 | |
emilmont | 77:869cf507173a | 300 | #define TIM_OPMode_Single ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 301 | #define TIM_OPMode_Repetitive ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 302 | #define IS_TIM_OPM_MODE(MODE) (((MODE) == TIM_OPMode_Single) || \ |
emilmont | 77:869cf507173a | 303 | ((MODE) == TIM_OPMode_Repetitive)) |
emilmont | 77:869cf507173a | 304 | /** |
emilmont | 77:869cf507173a | 305 | * @} |
emilmont | 77:869cf507173a | 306 | */ |
emilmont | 77:869cf507173a | 307 | |
emilmont | 77:869cf507173a | 308 | /** @defgroup TIM_Channel |
emilmont | 77:869cf507173a | 309 | * @{ |
emilmont | 77:869cf507173a | 310 | */ |
emilmont | 77:869cf507173a | 311 | |
emilmont | 77:869cf507173a | 312 | #define TIM_Channel_1 ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 313 | #define TIM_Channel_2 ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 314 | #define TIM_Channel_3 ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 315 | #define TIM_Channel_4 ((uint16_t)0x000C) |
emilmont | 77:869cf507173a | 316 | |
emilmont | 77:869cf507173a | 317 | #define IS_TIM_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \ |
emilmont | 77:869cf507173a | 318 | ((CHANNEL) == TIM_Channel_2) || \ |
emilmont | 77:869cf507173a | 319 | ((CHANNEL) == TIM_Channel_3) || \ |
emilmont | 77:869cf507173a | 320 | ((CHANNEL) == TIM_Channel_4)) |
emilmont | 77:869cf507173a | 321 | #define IS_TIM_COMPLEMENTARY_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \ |
emilmont | 77:869cf507173a | 322 | ((CHANNEL) == TIM_Channel_2) || \ |
emilmont | 77:869cf507173a | 323 | ((CHANNEL) == TIM_Channel_3)) |
emilmont | 77:869cf507173a | 324 | #define IS_TIM_PWMI_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \ |
emilmont | 77:869cf507173a | 325 | ((CHANNEL) == TIM_Channel_2)) |
emilmont | 77:869cf507173a | 326 | |
emilmont | 77:869cf507173a | 327 | /** |
emilmont | 77:869cf507173a | 328 | * @} |
emilmont | 77:869cf507173a | 329 | */ |
emilmont | 77:869cf507173a | 330 | |
emilmont | 77:869cf507173a | 331 | /** @defgroup TIM_Clock_Division_CKD |
emilmont | 77:869cf507173a | 332 | * @{ |
emilmont | 77:869cf507173a | 333 | */ |
emilmont | 77:869cf507173a | 334 | |
emilmont | 77:869cf507173a | 335 | #define TIM_CKD_DIV1 ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 336 | #define TIM_CKD_DIV2 ((uint16_t)0x0100) |
emilmont | 77:869cf507173a | 337 | #define TIM_CKD_DIV4 ((uint16_t)0x0200) |
emilmont | 77:869cf507173a | 338 | #define IS_TIM_CKD_DIV(DIV) (((DIV) == TIM_CKD_DIV1) || \ |
emilmont | 77:869cf507173a | 339 | ((DIV) == TIM_CKD_DIV2) || \ |
emilmont | 77:869cf507173a | 340 | ((DIV) == TIM_CKD_DIV4)) |
emilmont | 77:869cf507173a | 341 | /** |
emilmont | 77:869cf507173a | 342 | * @} |
emilmont | 77:869cf507173a | 343 | */ |
emilmont | 77:869cf507173a | 344 | |
emilmont | 77:869cf507173a | 345 | /** @defgroup TIM_Counter_Mode |
emilmont | 77:869cf507173a | 346 | * @{ |
emilmont | 77:869cf507173a | 347 | */ |
emilmont | 77:869cf507173a | 348 | |
emilmont | 77:869cf507173a | 349 | #define TIM_CounterMode_Up ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 350 | #define TIM_CounterMode_Down ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 351 | #define TIM_CounterMode_CenterAligned1 ((uint16_t)0x0020) |
emilmont | 77:869cf507173a | 352 | #define TIM_CounterMode_CenterAligned2 ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 353 | #define TIM_CounterMode_CenterAligned3 ((uint16_t)0x0060) |
emilmont | 77:869cf507173a | 354 | #define IS_TIM_COUNTER_MODE(MODE) (((MODE) == TIM_CounterMode_Up) || \ |
emilmont | 77:869cf507173a | 355 | ((MODE) == TIM_CounterMode_Down) || \ |
emilmont | 77:869cf507173a | 356 | ((MODE) == TIM_CounterMode_CenterAligned1) || \ |
emilmont | 77:869cf507173a | 357 | ((MODE) == TIM_CounterMode_CenterAligned2) || \ |
emilmont | 77:869cf507173a | 358 | ((MODE) == TIM_CounterMode_CenterAligned3)) |
emilmont | 77:869cf507173a | 359 | /** |
emilmont | 77:869cf507173a | 360 | * @} |
emilmont | 77:869cf507173a | 361 | */ |
emilmont | 77:869cf507173a | 362 | |
emilmont | 77:869cf507173a | 363 | /** @defgroup TIM_Output_Compare_Polarity |
emilmont | 77:869cf507173a | 364 | * @{ |
emilmont | 77:869cf507173a | 365 | */ |
emilmont | 77:869cf507173a | 366 | |
emilmont | 77:869cf507173a | 367 | #define TIM_OCPolarity_High ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 368 | #define TIM_OCPolarity_Low ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 369 | #define IS_TIM_OC_POLARITY(POLARITY) (((POLARITY) == TIM_OCPolarity_High) || \ |
emilmont | 77:869cf507173a | 370 | ((POLARITY) == TIM_OCPolarity_Low)) |
emilmont | 77:869cf507173a | 371 | /** |
emilmont | 77:869cf507173a | 372 | * @} |
emilmont | 77:869cf507173a | 373 | */ |
emilmont | 77:869cf507173a | 374 | |
emilmont | 77:869cf507173a | 375 | /** @defgroup TIM_Output_Compare_N_Polarity |
emilmont | 77:869cf507173a | 376 | * @{ |
emilmont | 77:869cf507173a | 377 | */ |
emilmont | 77:869cf507173a | 378 | |
emilmont | 77:869cf507173a | 379 | #define TIM_OCNPolarity_High ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 380 | #define TIM_OCNPolarity_Low ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 381 | #define IS_TIM_OCN_POLARITY(POLARITY) (((POLARITY) == TIM_OCNPolarity_High) || \ |
emilmont | 77:869cf507173a | 382 | ((POLARITY) == TIM_OCNPolarity_Low)) |
emilmont | 77:869cf507173a | 383 | /** |
emilmont | 77:869cf507173a | 384 | * @} |
emilmont | 77:869cf507173a | 385 | */ |
emilmont | 77:869cf507173a | 386 | |
emilmont | 77:869cf507173a | 387 | /** @defgroup TIM_Output_Compare_state |
emilmont | 77:869cf507173a | 388 | * @{ |
emilmont | 77:869cf507173a | 389 | */ |
emilmont | 77:869cf507173a | 390 | |
emilmont | 77:869cf507173a | 391 | #define TIM_OutputState_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 392 | #define TIM_OutputState_Enable ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 393 | #define IS_TIM_OUTPUT_STATE(STATE) (((STATE) == TIM_OutputState_Disable) || \ |
emilmont | 77:869cf507173a | 394 | ((STATE) == TIM_OutputState_Enable)) |
emilmont | 77:869cf507173a | 395 | /** |
emilmont | 77:869cf507173a | 396 | * @} |
emilmont | 77:869cf507173a | 397 | */ |
emilmont | 77:869cf507173a | 398 | |
emilmont | 77:869cf507173a | 399 | /** @defgroup TIM_Output_Compare_N_state |
emilmont | 77:869cf507173a | 400 | * @{ |
emilmont | 77:869cf507173a | 401 | */ |
emilmont | 77:869cf507173a | 402 | |
emilmont | 77:869cf507173a | 403 | #define TIM_OutputNState_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 404 | #define TIM_OutputNState_Enable ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 405 | #define IS_TIM_OUTPUTN_STATE(STATE) (((STATE) == TIM_OutputNState_Disable) || \ |
emilmont | 77:869cf507173a | 406 | ((STATE) == TIM_OutputNState_Enable)) |
emilmont | 77:869cf507173a | 407 | /** |
emilmont | 77:869cf507173a | 408 | * @} |
emilmont | 77:869cf507173a | 409 | */ |
emilmont | 77:869cf507173a | 410 | |
emilmont | 77:869cf507173a | 411 | /** @defgroup TIM_Capture_Compare_state |
emilmont | 77:869cf507173a | 412 | * @{ |
emilmont | 77:869cf507173a | 413 | */ |
emilmont | 77:869cf507173a | 414 | |
emilmont | 77:869cf507173a | 415 | #define TIM_CCx_Enable ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 416 | #define TIM_CCx_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 417 | #define IS_TIM_CCX(CCX) (((CCX) == TIM_CCx_Enable) || \ |
emilmont | 77:869cf507173a | 418 | ((CCX) == TIM_CCx_Disable)) |
emilmont | 77:869cf507173a | 419 | /** |
emilmont | 77:869cf507173a | 420 | * @} |
emilmont | 77:869cf507173a | 421 | */ |
emilmont | 77:869cf507173a | 422 | |
emilmont | 77:869cf507173a | 423 | /** @defgroup TIM_Capture_Compare_N_state |
emilmont | 77:869cf507173a | 424 | * @{ |
emilmont | 77:869cf507173a | 425 | */ |
emilmont | 77:869cf507173a | 426 | |
emilmont | 77:869cf507173a | 427 | #define TIM_CCxN_Enable ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 428 | #define TIM_CCxN_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 429 | #define IS_TIM_CCXN(CCXN) (((CCXN) == TIM_CCxN_Enable) || \ |
emilmont | 77:869cf507173a | 430 | ((CCXN) == TIM_CCxN_Disable)) |
emilmont | 77:869cf507173a | 431 | /** |
emilmont | 77:869cf507173a | 432 | * @} |
emilmont | 77:869cf507173a | 433 | */ |
emilmont | 77:869cf507173a | 434 | |
emilmont | 77:869cf507173a | 435 | /** @defgroup TIM_Break_Input_enable_disable |
emilmont | 77:869cf507173a | 436 | * @{ |
emilmont | 77:869cf507173a | 437 | */ |
emilmont | 77:869cf507173a | 438 | |
emilmont | 77:869cf507173a | 439 | #define TIM_Break_Enable ((uint16_t)0x1000) |
emilmont | 77:869cf507173a | 440 | #define TIM_Break_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 441 | #define IS_TIM_BREAK_STATE(STATE) (((STATE) == TIM_Break_Enable) || \ |
emilmont | 77:869cf507173a | 442 | ((STATE) == TIM_Break_Disable)) |
emilmont | 77:869cf507173a | 443 | /** |
emilmont | 77:869cf507173a | 444 | * @} |
emilmont | 77:869cf507173a | 445 | */ |
emilmont | 77:869cf507173a | 446 | |
emilmont | 77:869cf507173a | 447 | /** @defgroup TIM_Break_Polarity |
emilmont | 77:869cf507173a | 448 | * @{ |
emilmont | 77:869cf507173a | 449 | */ |
emilmont | 77:869cf507173a | 450 | |
emilmont | 77:869cf507173a | 451 | #define TIM_BreakPolarity_Low ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 452 | #define TIM_BreakPolarity_High ((uint16_t)0x2000) |
emilmont | 77:869cf507173a | 453 | #define IS_TIM_BREAK_POLARITY(POLARITY) (((POLARITY) == TIM_BreakPolarity_Low) || \ |
emilmont | 77:869cf507173a | 454 | ((POLARITY) == TIM_BreakPolarity_High)) |
emilmont | 77:869cf507173a | 455 | /** |
emilmont | 77:869cf507173a | 456 | * @} |
emilmont | 77:869cf507173a | 457 | */ |
emilmont | 77:869cf507173a | 458 | |
emilmont | 77:869cf507173a | 459 | /** @defgroup TIM_AOE_Bit_Set_Reset |
emilmont | 77:869cf507173a | 460 | * @{ |
emilmont | 77:869cf507173a | 461 | */ |
emilmont | 77:869cf507173a | 462 | |
emilmont | 77:869cf507173a | 463 | #define TIM_AutomaticOutput_Enable ((uint16_t)0x4000) |
emilmont | 77:869cf507173a | 464 | #define TIM_AutomaticOutput_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 465 | #define IS_TIM_AUTOMATIC_OUTPUT_STATE(STATE) (((STATE) == TIM_AutomaticOutput_Enable) || \ |
emilmont | 77:869cf507173a | 466 | ((STATE) == TIM_AutomaticOutput_Disable)) |
emilmont | 77:869cf507173a | 467 | /** |
emilmont | 77:869cf507173a | 468 | * @} |
emilmont | 77:869cf507173a | 469 | */ |
emilmont | 77:869cf507173a | 470 | |
emilmont | 77:869cf507173a | 471 | /** @defgroup TIM_Lock_level |
emilmont | 77:869cf507173a | 472 | * @{ |
emilmont | 77:869cf507173a | 473 | */ |
emilmont | 77:869cf507173a | 474 | |
emilmont | 77:869cf507173a | 475 | #define TIM_LOCKLevel_OFF ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 476 | #define TIM_LOCKLevel_1 ((uint16_t)0x0100) |
emilmont | 77:869cf507173a | 477 | #define TIM_LOCKLevel_2 ((uint16_t)0x0200) |
emilmont | 77:869cf507173a | 478 | #define TIM_LOCKLevel_3 ((uint16_t)0x0300) |
emilmont | 77:869cf507173a | 479 | #define IS_TIM_LOCK_LEVEL(LEVEL) (((LEVEL) == TIM_LOCKLevel_OFF) || \ |
emilmont | 77:869cf507173a | 480 | ((LEVEL) == TIM_LOCKLevel_1) || \ |
emilmont | 77:869cf507173a | 481 | ((LEVEL) == TIM_LOCKLevel_2) || \ |
emilmont | 77:869cf507173a | 482 | ((LEVEL) == TIM_LOCKLevel_3)) |
emilmont | 77:869cf507173a | 483 | /** |
emilmont | 77:869cf507173a | 484 | * @} |
emilmont | 77:869cf507173a | 485 | */ |
emilmont | 77:869cf507173a | 486 | |
emilmont | 77:869cf507173a | 487 | /** @defgroup TIM_OSSI_Off_State_Selection_for_Idle_mode_state |
emilmont | 77:869cf507173a | 488 | * @{ |
emilmont | 77:869cf507173a | 489 | */ |
emilmont | 77:869cf507173a | 490 | |
emilmont | 77:869cf507173a | 491 | #define TIM_OSSIState_Enable ((uint16_t)0x0400) |
emilmont | 77:869cf507173a | 492 | #define TIM_OSSIState_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 493 | #define IS_TIM_OSSI_STATE(STATE) (((STATE) == TIM_OSSIState_Enable) || \ |
emilmont | 77:869cf507173a | 494 | ((STATE) == TIM_OSSIState_Disable)) |
emilmont | 77:869cf507173a | 495 | /** |
emilmont | 77:869cf507173a | 496 | * @} |
emilmont | 77:869cf507173a | 497 | */ |
emilmont | 77:869cf507173a | 498 | |
emilmont | 77:869cf507173a | 499 | /** @defgroup TIM_OSSR_Off_State_Selection_for_Run_mode_state |
emilmont | 77:869cf507173a | 500 | * @{ |
emilmont | 77:869cf507173a | 501 | */ |
emilmont | 77:869cf507173a | 502 | |
emilmont | 77:869cf507173a | 503 | #define TIM_OSSRState_Enable ((uint16_t)0x0800) |
emilmont | 77:869cf507173a | 504 | #define TIM_OSSRState_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 505 | #define IS_TIM_OSSR_STATE(STATE) (((STATE) == TIM_OSSRState_Enable) || \ |
emilmont | 77:869cf507173a | 506 | ((STATE) == TIM_OSSRState_Disable)) |
emilmont | 77:869cf507173a | 507 | /** |
emilmont | 77:869cf507173a | 508 | * @} |
emilmont | 77:869cf507173a | 509 | */ |
emilmont | 77:869cf507173a | 510 | |
emilmont | 77:869cf507173a | 511 | /** @defgroup TIM_Output_Compare_Idle_State |
emilmont | 77:869cf507173a | 512 | * @{ |
emilmont | 77:869cf507173a | 513 | */ |
emilmont | 77:869cf507173a | 514 | |
emilmont | 77:869cf507173a | 515 | #define TIM_OCIdleState_Set ((uint16_t)0x0100) |
emilmont | 77:869cf507173a | 516 | #define TIM_OCIdleState_Reset ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 517 | #define IS_TIM_OCIDLE_STATE(STATE) (((STATE) == TIM_OCIdleState_Set) || \ |
emilmont | 77:869cf507173a | 518 | ((STATE) == TIM_OCIdleState_Reset)) |
emilmont | 77:869cf507173a | 519 | /** |
emilmont | 77:869cf507173a | 520 | * @} |
emilmont | 77:869cf507173a | 521 | */ |
emilmont | 77:869cf507173a | 522 | |
emilmont | 77:869cf507173a | 523 | /** @defgroup TIM_Output_Compare_N_Idle_State |
emilmont | 77:869cf507173a | 524 | * @{ |
emilmont | 77:869cf507173a | 525 | */ |
emilmont | 77:869cf507173a | 526 | |
emilmont | 77:869cf507173a | 527 | #define TIM_OCNIdleState_Set ((uint16_t)0x0200) |
emilmont | 77:869cf507173a | 528 | #define TIM_OCNIdleState_Reset ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 529 | #define IS_TIM_OCNIDLE_STATE(STATE) (((STATE) == TIM_OCNIdleState_Set) || \ |
emilmont | 77:869cf507173a | 530 | ((STATE) == TIM_OCNIdleState_Reset)) |
emilmont | 77:869cf507173a | 531 | /** |
emilmont | 77:869cf507173a | 532 | * @} |
emilmont | 77:869cf507173a | 533 | */ |
emilmont | 77:869cf507173a | 534 | |
emilmont | 77:869cf507173a | 535 | /** @defgroup TIM_Input_Capture_Polarity |
emilmont | 77:869cf507173a | 536 | * @{ |
emilmont | 77:869cf507173a | 537 | */ |
emilmont | 77:869cf507173a | 538 | |
emilmont | 77:869cf507173a | 539 | #define TIM_ICPolarity_Rising ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 540 | #define TIM_ICPolarity_Falling ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 541 | #define TIM_ICPolarity_BothEdge ((uint16_t)0x000A) |
emilmont | 77:869cf507173a | 542 | #define IS_TIM_IC_POLARITY(POLARITY) (((POLARITY) == TIM_ICPolarity_Rising) || \ |
emilmont | 77:869cf507173a | 543 | ((POLARITY) == TIM_ICPolarity_Falling)|| \ |
emilmont | 77:869cf507173a | 544 | ((POLARITY) == TIM_ICPolarity_BothEdge)) |
emilmont | 77:869cf507173a | 545 | /** |
emilmont | 77:869cf507173a | 546 | * @} |
emilmont | 77:869cf507173a | 547 | */ |
emilmont | 77:869cf507173a | 548 | |
emilmont | 77:869cf507173a | 549 | /** @defgroup TIM_Input_Capture_Selection |
emilmont | 77:869cf507173a | 550 | * @{ |
emilmont | 77:869cf507173a | 551 | */ |
emilmont | 77:869cf507173a | 552 | |
emilmont | 77:869cf507173a | 553 | #define TIM_ICSelection_DirectTI ((uint16_t)0x0001) /*!< TIM Input 1, 2, 3 or 4 is selected to be |
emilmont | 77:869cf507173a | 554 | connected to IC1, IC2, IC3 or IC4, respectively */ |
emilmont | 77:869cf507173a | 555 | #define TIM_ICSelection_IndirectTI ((uint16_t)0x0002) /*!< TIM Input 1, 2, 3 or 4 is selected to be |
emilmont | 77:869cf507173a | 556 | connected to IC2, IC1, IC4 or IC3, respectively. */ |
emilmont | 77:869cf507173a | 557 | #define TIM_ICSelection_TRC ((uint16_t)0x0003) /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to TRC. */ |
emilmont | 77:869cf507173a | 558 | #define IS_TIM_IC_SELECTION(SELECTION) (((SELECTION) == TIM_ICSelection_DirectTI) || \ |
emilmont | 77:869cf507173a | 559 | ((SELECTION) == TIM_ICSelection_IndirectTI) || \ |
emilmont | 77:869cf507173a | 560 | ((SELECTION) == TIM_ICSelection_TRC)) |
emilmont | 77:869cf507173a | 561 | /** |
emilmont | 77:869cf507173a | 562 | * @} |
emilmont | 77:869cf507173a | 563 | */ |
emilmont | 77:869cf507173a | 564 | |
emilmont | 77:869cf507173a | 565 | /** @defgroup TIM_Input_Capture_Prescaler |
emilmont | 77:869cf507173a | 566 | * @{ |
emilmont | 77:869cf507173a | 567 | */ |
emilmont | 77:869cf507173a | 568 | |
emilmont | 77:869cf507173a | 569 | #define TIM_ICPSC_DIV1 ((uint16_t)0x0000) /*!< Capture performed each time an edge is detected on the capture input. */ |
emilmont | 77:869cf507173a | 570 | #define TIM_ICPSC_DIV2 ((uint16_t)0x0004) /*!< Capture performed once every 2 events. */ |
emilmont | 77:869cf507173a | 571 | #define TIM_ICPSC_DIV4 ((uint16_t)0x0008) /*!< Capture performed once every 4 events. */ |
emilmont | 77:869cf507173a | 572 | #define TIM_ICPSC_DIV8 ((uint16_t)0x000C) /*!< Capture performed once every 8 events. */ |
emilmont | 77:869cf507173a | 573 | #define IS_TIM_IC_PRESCALER(PRESCALER) (((PRESCALER) == TIM_ICPSC_DIV1) || \ |
emilmont | 77:869cf507173a | 574 | ((PRESCALER) == TIM_ICPSC_DIV2) || \ |
emilmont | 77:869cf507173a | 575 | ((PRESCALER) == TIM_ICPSC_DIV4) || \ |
emilmont | 77:869cf507173a | 576 | ((PRESCALER) == TIM_ICPSC_DIV8)) |
emilmont | 77:869cf507173a | 577 | /** |
emilmont | 77:869cf507173a | 578 | * @} |
emilmont | 77:869cf507173a | 579 | */ |
emilmont | 77:869cf507173a | 580 | |
emilmont | 77:869cf507173a | 581 | /** @defgroup TIM_interrupt_sources |
emilmont | 77:869cf507173a | 582 | * @{ |
emilmont | 77:869cf507173a | 583 | */ |
emilmont | 77:869cf507173a | 584 | |
emilmont | 77:869cf507173a | 585 | #define TIM_IT_Update ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 586 | #define TIM_IT_CC1 ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 587 | #define TIM_IT_CC2 ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 588 | #define TIM_IT_CC3 ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 589 | #define TIM_IT_CC4 ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 590 | #define TIM_IT_COM ((uint16_t)0x0020) |
emilmont | 77:869cf507173a | 591 | #define TIM_IT_Trigger ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 592 | #define TIM_IT_Break ((uint16_t)0x0080) |
emilmont | 77:869cf507173a | 593 | #define IS_TIM_IT(IT) ((((IT) & (uint16_t)0xFF00) == 0x0000) && ((IT) != 0x0000)) |
emilmont | 77:869cf507173a | 594 | |
emilmont | 77:869cf507173a | 595 | #define IS_TIM_GET_IT(IT) (((IT) == TIM_IT_Update) || \ |
emilmont | 77:869cf507173a | 596 | ((IT) == TIM_IT_CC1) || \ |
emilmont | 77:869cf507173a | 597 | ((IT) == TIM_IT_CC2) || \ |
emilmont | 77:869cf507173a | 598 | ((IT) == TIM_IT_CC3) || \ |
emilmont | 77:869cf507173a | 599 | ((IT) == TIM_IT_CC4) || \ |
emilmont | 77:869cf507173a | 600 | ((IT) == TIM_IT_COM) || \ |
emilmont | 77:869cf507173a | 601 | ((IT) == TIM_IT_Trigger) || \ |
emilmont | 77:869cf507173a | 602 | ((IT) == TIM_IT_Break)) |
emilmont | 77:869cf507173a | 603 | /** |
emilmont | 77:869cf507173a | 604 | * @} |
emilmont | 77:869cf507173a | 605 | */ |
emilmont | 77:869cf507173a | 606 | |
emilmont | 77:869cf507173a | 607 | /** @defgroup TIM_DMA_Base_address |
emilmont | 77:869cf507173a | 608 | * @{ |
emilmont | 77:869cf507173a | 609 | */ |
emilmont | 77:869cf507173a | 610 | |
emilmont | 77:869cf507173a | 611 | #define TIM_DMABase_CR1 ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 612 | #define TIM_DMABase_CR2 ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 613 | #define TIM_DMABase_SMCR ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 614 | #define TIM_DMABase_DIER ((uint16_t)0x0003) |
emilmont | 77:869cf507173a | 615 | #define TIM_DMABase_SR ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 616 | #define TIM_DMABase_EGR ((uint16_t)0x0005) |
emilmont | 77:869cf507173a | 617 | #define TIM_DMABase_CCMR1 ((uint16_t)0x0006) |
emilmont | 77:869cf507173a | 618 | #define TIM_DMABase_CCMR2 ((uint16_t)0x0007) |
emilmont | 77:869cf507173a | 619 | #define TIM_DMABase_CCER ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 620 | #define TIM_DMABase_CNT ((uint16_t)0x0009) |
emilmont | 77:869cf507173a | 621 | #define TIM_DMABase_PSC ((uint16_t)0x000A) |
emilmont | 77:869cf507173a | 622 | #define TIM_DMABase_ARR ((uint16_t)0x000B) |
emilmont | 77:869cf507173a | 623 | #define TIM_DMABase_RCR ((uint16_t)0x000C) |
emilmont | 77:869cf507173a | 624 | #define TIM_DMABase_CCR1 ((uint16_t)0x000D) |
emilmont | 77:869cf507173a | 625 | #define TIM_DMABase_CCR2 ((uint16_t)0x000E) |
emilmont | 77:869cf507173a | 626 | #define TIM_DMABase_CCR3 ((uint16_t)0x000F) |
emilmont | 77:869cf507173a | 627 | #define TIM_DMABase_CCR4 ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 628 | #define TIM_DMABase_BDTR ((uint16_t)0x0011) |
emilmont | 77:869cf507173a | 629 | #define TIM_DMABase_DCR ((uint16_t)0x0012) |
emilmont | 77:869cf507173a | 630 | #define TIM_DMABase_OR ((uint16_t)0x0013) |
emilmont | 77:869cf507173a | 631 | #define IS_TIM_DMA_BASE(BASE) (((BASE) == TIM_DMABase_CR1) || \ |
emilmont | 77:869cf507173a | 632 | ((BASE) == TIM_DMABase_CR2) || \ |
emilmont | 77:869cf507173a | 633 | ((BASE) == TIM_DMABase_SMCR) || \ |
emilmont | 77:869cf507173a | 634 | ((BASE) == TIM_DMABase_DIER) || \ |
emilmont | 77:869cf507173a | 635 | ((BASE) == TIM_DMABase_SR) || \ |
emilmont | 77:869cf507173a | 636 | ((BASE) == TIM_DMABase_EGR) || \ |
emilmont | 77:869cf507173a | 637 | ((BASE) == TIM_DMABase_CCMR1) || \ |
emilmont | 77:869cf507173a | 638 | ((BASE) == TIM_DMABase_CCMR2) || \ |
emilmont | 77:869cf507173a | 639 | ((BASE) == TIM_DMABase_CCER) || \ |
emilmont | 77:869cf507173a | 640 | ((BASE) == TIM_DMABase_CNT) || \ |
emilmont | 77:869cf507173a | 641 | ((BASE) == TIM_DMABase_PSC) || \ |
emilmont | 77:869cf507173a | 642 | ((BASE) == TIM_DMABase_ARR) || \ |
emilmont | 77:869cf507173a | 643 | ((BASE) == TIM_DMABase_RCR) || \ |
emilmont | 77:869cf507173a | 644 | ((BASE) == TIM_DMABase_CCR1) || \ |
emilmont | 77:869cf507173a | 645 | ((BASE) == TIM_DMABase_CCR2) || \ |
emilmont | 77:869cf507173a | 646 | ((BASE) == TIM_DMABase_CCR3) || \ |
emilmont | 77:869cf507173a | 647 | ((BASE) == TIM_DMABase_CCR4) || \ |
emilmont | 77:869cf507173a | 648 | ((BASE) == TIM_DMABase_BDTR) || \ |
emilmont | 77:869cf507173a | 649 | ((BASE) == TIM_DMABase_DCR) || \ |
emilmont | 77:869cf507173a | 650 | ((BASE) == TIM_DMABase_OR)) |
emilmont | 77:869cf507173a | 651 | /** |
emilmont | 77:869cf507173a | 652 | * @} |
emilmont | 77:869cf507173a | 653 | */ |
emilmont | 77:869cf507173a | 654 | |
emilmont | 77:869cf507173a | 655 | |
emilmont | 77:869cf507173a | 656 | /** @defgroup TIM_DMA_Burst_Length |
emilmont | 77:869cf507173a | 657 | * @{ |
emilmont | 77:869cf507173a | 658 | */ |
emilmont | 77:869cf507173a | 659 | |
emilmont | 77:869cf507173a | 660 | #define TIM_DMABurstLength_1Transfer ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 661 | #define TIM_DMABurstLength_2Transfers ((uint16_t)0x0100) |
emilmont | 77:869cf507173a | 662 | #define TIM_DMABurstLength_3Transfers ((uint16_t)0x0200) |
emilmont | 77:869cf507173a | 663 | #define TIM_DMABurstLength_4Transfers ((uint16_t)0x0300) |
emilmont | 77:869cf507173a | 664 | #define TIM_DMABurstLength_5Transfers ((uint16_t)0x0400) |
emilmont | 77:869cf507173a | 665 | #define TIM_DMABurstLength_6Transfers ((uint16_t)0x0500) |
emilmont | 77:869cf507173a | 666 | #define TIM_DMABurstLength_7Transfers ((uint16_t)0x0600) |
emilmont | 77:869cf507173a | 667 | #define TIM_DMABurstLength_8Transfers ((uint16_t)0x0700) |
emilmont | 77:869cf507173a | 668 | #define TIM_DMABurstLength_9Transfers ((uint16_t)0x0800) |
emilmont | 77:869cf507173a | 669 | #define TIM_DMABurstLength_10Transfers ((uint16_t)0x0900) |
emilmont | 77:869cf507173a | 670 | #define TIM_DMABurstLength_11Transfers ((uint16_t)0x0A00) |
emilmont | 77:869cf507173a | 671 | #define TIM_DMABurstLength_12Transfers ((uint16_t)0x0B00) |
emilmont | 77:869cf507173a | 672 | #define TIM_DMABurstLength_13Transfers ((uint16_t)0x0C00) |
emilmont | 77:869cf507173a | 673 | #define TIM_DMABurstLength_14Transfers ((uint16_t)0x0D00) |
emilmont | 77:869cf507173a | 674 | #define TIM_DMABurstLength_15Transfers ((uint16_t)0x0E00) |
emilmont | 77:869cf507173a | 675 | #define TIM_DMABurstLength_16Transfers ((uint16_t)0x0F00) |
emilmont | 77:869cf507173a | 676 | #define TIM_DMABurstLength_17Transfers ((uint16_t)0x1000) |
emilmont | 77:869cf507173a | 677 | #define TIM_DMABurstLength_18Transfers ((uint16_t)0x1100) |
emilmont | 77:869cf507173a | 678 | #define IS_TIM_DMA_LENGTH(LENGTH) (((LENGTH) == TIM_DMABurstLength_1Transfer) || \ |
emilmont | 77:869cf507173a | 679 | ((LENGTH) == TIM_DMABurstLength_2Transfers) || \ |
emilmont | 77:869cf507173a | 680 | ((LENGTH) == TIM_DMABurstLength_3Transfers) || \ |
emilmont | 77:869cf507173a | 681 | ((LENGTH) == TIM_DMABurstLength_4Transfers) || \ |
emilmont | 77:869cf507173a | 682 | ((LENGTH) == TIM_DMABurstLength_5Transfers) || \ |
emilmont | 77:869cf507173a | 683 | ((LENGTH) == TIM_DMABurstLength_6Transfers) || \ |
emilmont | 77:869cf507173a | 684 | ((LENGTH) == TIM_DMABurstLength_7Transfers) || \ |
emilmont | 77:869cf507173a | 685 | ((LENGTH) == TIM_DMABurstLength_8Transfers) || \ |
emilmont | 77:869cf507173a | 686 | ((LENGTH) == TIM_DMABurstLength_9Transfers) || \ |
emilmont | 77:869cf507173a | 687 | ((LENGTH) == TIM_DMABurstLength_10Transfers) || \ |
emilmont | 77:869cf507173a | 688 | ((LENGTH) == TIM_DMABurstLength_11Transfers) || \ |
emilmont | 77:869cf507173a | 689 | ((LENGTH) == TIM_DMABurstLength_12Transfers) || \ |
emilmont | 77:869cf507173a | 690 | ((LENGTH) == TIM_DMABurstLength_13Transfers) || \ |
emilmont | 77:869cf507173a | 691 | ((LENGTH) == TIM_DMABurstLength_14Transfers) || \ |
emilmont | 77:869cf507173a | 692 | ((LENGTH) == TIM_DMABurstLength_15Transfers) || \ |
emilmont | 77:869cf507173a | 693 | ((LENGTH) == TIM_DMABurstLength_16Transfers) || \ |
emilmont | 77:869cf507173a | 694 | ((LENGTH) == TIM_DMABurstLength_17Transfers) || \ |
emilmont | 77:869cf507173a | 695 | ((LENGTH) == TIM_DMABurstLength_18Transfers)) |
emilmont | 77:869cf507173a | 696 | /** |
emilmont | 77:869cf507173a | 697 | * @} |
emilmont | 77:869cf507173a | 698 | */ |
emilmont | 77:869cf507173a | 699 | |
emilmont | 77:869cf507173a | 700 | /** @defgroup TIM_DMA_sources |
emilmont | 77:869cf507173a | 701 | * @{ |
emilmont | 77:869cf507173a | 702 | */ |
emilmont | 77:869cf507173a | 703 | |
emilmont | 77:869cf507173a | 704 | #define TIM_DMA_Update ((uint16_t)0x0100) |
emilmont | 77:869cf507173a | 705 | #define TIM_DMA_CC1 ((uint16_t)0x0200) |
emilmont | 77:869cf507173a | 706 | #define TIM_DMA_CC2 ((uint16_t)0x0400) |
emilmont | 77:869cf507173a | 707 | #define TIM_DMA_CC3 ((uint16_t)0x0800) |
emilmont | 77:869cf507173a | 708 | #define TIM_DMA_CC4 ((uint16_t)0x1000) |
emilmont | 77:869cf507173a | 709 | #define TIM_DMA_COM ((uint16_t)0x2000) |
emilmont | 77:869cf507173a | 710 | #define TIM_DMA_Trigger ((uint16_t)0x4000) |
emilmont | 77:869cf507173a | 711 | #define IS_TIM_DMA_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0x80FF) == 0x0000) && ((SOURCE) != 0x0000)) |
emilmont | 77:869cf507173a | 712 | |
emilmont | 77:869cf507173a | 713 | /** |
emilmont | 77:869cf507173a | 714 | * @} |
emilmont | 77:869cf507173a | 715 | */ |
emilmont | 77:869cf507173a | 716 | |
emilmont | 77:869cf507173a | 717 | /** @defgroup TIM_External_Trigger_Prescaler |
emilmont | 77:869cf507173a | 718 | * @{ |
emilmont | 77:869cf507173a | 719 | */ |
emilmont | 77:869cf507173a | 720 | |
emilmont | 77:869cf507173a | 721 | #define TIM_ExtTRGPSC_OFF ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 722 | #define TIM_ExtTRGPSC_DIV2 ((uint16_t)0x1000) |
emilmont | 77:869cf507173a | 723 | #define TIM_ExtTRGPSC_DIV4 ((uint16_t)0x2000) |
emilmont | 77:869cf507173a | 724 | #define TIM_ExtTRGPSC_DIV8 ((uint16_t)0x3000) |
emilmont | 77:869cf507173a | 725 | #define IS_TIM_EXT_PRESCALER(PRESCALER) (((PRESCALER) == TIM_ExtTRGPSC_OFF) || \ |
emilmont | 77:869cf507173a | 726 | ((PRESCALER) == TIM_ExtTRGPSC_DIV2) || \ |
emilmont | 77:869cf507173a | 727 | ((PRESCALER) == TIM_ExtTRGPSC_DIV4) || \ |
emilmont | 77:869cf507173a | 728 | ((PRESCALER) == TIM_ExtTRGPSC_DIV8)) |
emilmont | 77:869cf507173a | 729 | /** |
emilmont | 77:869cf507173a | 730 | * @} |
emilmont | 77:869cf507173a | 731 | */ |
emilmont | 77:869cf507173a | 732 | |
emilmont | 77:869cf507173a | 733 | /** @defgroup TIM_Internal_Trigger_Selection |
emilmont | 77:869cf507173a | 734 | * @{ |
emilmont | 77:869cf507173a | 735 | */ |
emilmont | 77:869cf507173a | 736 | |
emilmont | 77:869cf507173a | 737 | #define TIM_TS_ITR0 ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 738 | #define TIM_TS_ITR1 ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 739 | #define TIM_TS_ITR2 ((uint16_t)0x0020) |
emilmont | 77:869cf507173a | 740 | #define TIM_TS_ITR3 ((uint16_t)0x0030) |
emilmont | 77:869cf507173a | 741 | #define TIM_TS_TI1F_ED ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 742 | #define TIM_TS_TI1FP1 ((uint16_t)0x0050) |
emilmont | 77:869cf507173a | 743 | #define TIM_TS_TI2FP2 ((uint16_t)0x0060) |
emilmont | 77:869cf507173a | 744 | #define TIM_TS_ETRF ((uint16_t)0x0070) |
emilmont | 77:869cf507173a | 745 | #define IS_TIM_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \ |
emilmont | 77:869cf507173a | 746 | ((SELECTION) == TIM_TS_ITR1) || \ |
emilmont | 77:869cf507173a | 747 | ((SELECTION) == TIM_TS_ITR2) || \ |
emilmont | 77:869cf507173a | 748 | ((SELECTION) == TIM_TS_ITR3) || \ |
emilmont | 77:869cf507173a | 749 | ((SELECTION) == TIM_TS_TI1F_ED) || \ |
emilmont | 77:869cf507173a | 750 | ((SELECTION) == TIM_TS_TI1FP1) || \ |
emilmont | 77:869cf507173a | 751 | ((SELECTION) == TIM_TS_TI2FP2) || \ |
emilmont | 77:869cf507173a | 752 | ((SELECTION) == TIM_TS_ETRF)) |
emilmont | 77:869cf507173a | 753 | #define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \ |
emilmont | 77:869cf507173a | 754 | ((SELECTION) == TIM_TS_ITR1) || \ |
emilmont | 77:869cf507173a | 755 | ((SELECTION) == TIM_TS_ITR2) || \ |
emilmont | 77:869cf507173a | 756 | ((SELECTION) == TIM_TS_ITR3)) |
emilmont | 77:869cf507173a | 757 | /** |
emilmont | 77:869cf507173a | 758 | * @} |
emilmont | 77:869cf507173a | 759 | */ |
emilmont | 77:869cf507173a | 760 | |
emilmont | 77:869cf507173a | 761 | /** @defgroup TIM_TIx_External_Clock_Source |
emilmont | 77:869cf507173a | 762 | * @{ |
emilmont | 77:869cf507173a | 763 | */ |
emilmont | 77:869cf507173a | 764 | |
emilmont | 77:869cf507173a | 765 | #define TIM_TIxExternalCLK1Source_TI1 ((uint16_t)0x0050) |
emilmont | 77:869cf507173a | 766 | #define TIM_TIxExternalCLK1Source_TI2 ((uint16_t)0x0060) |
emilmont | 77:869cf507173a | 767 | #define TIM_TIxExternalCLK1Source_TI1ED ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 768 | |
emilmont | 77:869cf507173a | 769 | /** |
emilmont | 77:869cf507173a | 770 | * @} |
emilmont | 77:869cf507173a | 771 | */ |
emilmont | 77:869cf507173a | 772 | |
emilmont | 77:869cf507173a | 773 | /** @defgroup TIM_External_Trigger_Polarity |
emilmont | 77:869cf507173a | 774 | * @{ |
emilmont | 77:869cf507173a | 775 | */ |
emilmont | 77:869cf507173a | 776 | #define TIM_ExtTRGPolarity_Inverted ((uint16_t)0x8000) |
emilmont | 77:869cf507173a | 777 | #define TIM_ExtTRGPolarity_NonInverted ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 778 | #define IS_TIM_EXT_POLARITY(POLARITY) (((POLARITY) == TIM_ExtTRGPolarity_Inverted) || \ |
emilmont | 77:869cf507173a | 779 | ((POLARITY) == TIM_ExtTRGPolarity_NonInverted)) |
emilmont | 77:869cf507173a | 780 | /** |
emilmont | 77:869cf507173a | 781 | * @} |
emilmont | 77:869cf507173a | 782 | */ |
emilmont | 77:869cf507173a | 783 | |
emilmont | 77:869cf507173a | 784 | /** @defgroup TIM_Prescaler_Reload_Mode |
emilmont | 77:869cf507173a | 785 | * @{ |
emilmont | 77:869cf507173a | 786 | */ |
emilmont | 77:869cf507173a | 787 | |
emilmont | 77:869cf507173a | 788 | #define TIM_PSCReloadMode_Update ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 789 | #define TIM_PSCReloadMode_Immediate ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 790 | #define IS_TIM_PRESCALER_RELOAD(RELOAD) (((RELOAD) == TIM_PSCReloadMode_Update) || \ |
emilmont | 77:869cf507173a | 791 | ((RELOAD) == TIM_PSCReloadMode_Immediate)) |
emilmont | 77:869cf507173a | 792 | /** |
emilmont | 77:869cf507173a | 793 | * @} |
emilmont | 77:869cf507173a | 794 | */ |
emilmont | 77:869cf507173a | 795 | |
emilmont | 77:869cf507173a | 796 | /** @defgroup TIM_Forced_Action |
emilmont | 77:869cf507173a | 797 | * @{ |
emilmont | 77:869cf507173a | 798 | */ |
emilmont | 77:869cf507173a | 799 | |
emilmont | 77:869cf507173a | 800 | #define TIM_ForcedAction_Active ((uint16_t)0x0050) |
emilmont | 77:869cf507173a | 801 | #define TIM_ForcedAction_InActive ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 802 | #define IS_TIM_FORCED_ACTION(ACTION) (((ACTION) == TIM_ForcedAction_Active) || \ |
emilmont | 77:869cf507173a | 803 | ((ACTION) == TIM_ForcedAction_InActive)) |
emilmont | 77:869cf507173a | 804 | /** |
emilmont | 77:869cf507173a | 805 | * @} |
emilmont | 77:869cf507173a | 806 | */ |
emilmont | 77:869cf507173a | 807 | |
emilmont | 77:869cf507173a | 808 | /** @defgroup TIM_Encoder_Mode |
emilmont | 77:869cf507173a | 809 | * @{ |
emilmont | 77:869cf507173a | 810 | */ |
emilmont | 77:869cf507173a | 811 | |
emilmont | 77:869cf507173a | 812 | #define TIM_EncoderMode_TI1 ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 813 | #define TIM_EncoderMode_TI2 ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 814 | #define TIM_EncoderMode_TI12 ((uint16_t)0x0003) |
emilmont | 77:869cf507173a | 815 | #define IS_TIM_ENCODER_MODE(MODE) (((MODE) == TIM_EncoderMode_TI1) || \ |
emilmont | 77:869cf507173a | 816 | ((MODE) == TIM_EncoderMode_TI2) || \ |
emilmont | 77:869cf507173a | 817 | ((MODE) == TIM_EncoderMode_TI12)) |
emilmont | 77:869cf507173a | 818 | /** |
emilmont | 77:869cf507173a | 819 | * @} |
emilmont | 77:869cf507173a | 820 | */ |
emilmont | 77:869cf507173a | 821 | |
emilmont | 77:869cf507173a | 822 | |
emilmont | 77:869cf507173a | 823 | /** @defgroup TIM_Event_Source |
emilmont | 77:869cf507173a | 824 | * @{ |
emilmont | 77:869cf507173a | 825 | */ |
emilmont | 77:869cf507173a | 826 | |
emilmont | 77:869cf507173a | 827 | #define TIM_EventSource_Update ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 828 | #define TIM_EventSource_CC1 ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 829 | #define TIM_EventSource_CC2 ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 830 | #define TIM_EventSource_CC3 ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 831 | #define TIM_EventSource_CC4 ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 832 | #define TIM_EventSource_COM ((uint16_t)0x0020) |
emilmont | 77:869cf507173a | 833 | #define TIM_EventSource_Trigger ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 834 | #define TIM_EventSource_Break ((uint16_t)0x0080) |
emilmont | 77:869cf507173a | 835 | #define IS_TIM_EVENT_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0xFF00) == 0x0000) && ((SOURCE) != 0x0000)) |
emilmont | 77:869cf507173a | 836 | |
emilmont | 77:869cf507173a | 837 | /** |
emilmont | 77:869cf507173a | 838 | * @} |
emilmont | 77:869cf507173a | 839 | */ |
emilmont | 77:869cf507173a | 840 | |
emilmont | 77:869cf507173a | 841 | /** @defgroup TIM_Update_Source |
emilmont | 77:869cf507173a | 842 | * @{ |
emilmont | 77:869cf507173a | 843 | */ |
emilmont | 77:869cf507173a | 844 | |
emilmont | 77:869cf507173a | 845 | #define TIM_UpdateSource_Global ((uint16_t)0x0000) /*!< Source of update is the counter overflow/underflow |
emilmont | 77:869cf507173a | 846 | or the setting of UG bit, or an update generation |
emilmont | 77:869cf507173a | 847 | through the slave mode controller. */ |
emilmont | 77:869cf507173a | 848 | #define TIM_UpdateSource_Regular ((uint16_t)0x0001) /*!< Source of update is counter overflow/underflow. */ |
emilmont | 77:869cf507173a | 849 | #define IS_TIM_UPDATE_SOURCE(SOURCE) (((SOURCE) == TIM_UpdateSource_Global) || \ |
emilmont | 77:869cf507173a | 850 | ((SOURCE) == TIM_UpdateSource_Regular)) |
emilmont | 77:869cf507173a | 851 | /** |
emilmont | 77:869cf507173a | 852 | * @} |
emilmont | 77:869cf507173a | 853 | */ |
emilmont | 77:869cf507173a | 854 | |
emilmont | 77:869cf507173a | 855 | /** @defgroup TIM_Output_Compare_Preload_State |
emilmont | 77:869cf507173a | 856 | * @{ |
emilmont | 77:869cf507173a | 857 | */ |
emilmont | 77:869cf507173a | 858 | |
emilmont | 77:869cf507173a | 859 | #define TIM_OCPreload_Enable ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 860 | #define TIM_OCPreload_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 861 | #define IS_TIM_OCPRELOAD_STATE(STATE) (((STATE) == TIM_OCPreload_Enable) || \ |
emilmont | 77:869cf507173a | 862 | ((STATE) == TIM_OCPreload_Disable)) |
emilmont | 77:869cf507173a | 863 | /** |
emilmont | 77:869cf507173a | 864 | * @} |
emilmont | 77:869cf507173a | 865 | */ |
emilmont | 77:869cf507173a | 866 | |
emilmont | 77:869cf507173a | 867 | /** @defgroup TIM_Output_Compare_Fast_State |
emilmont | 77:869cf507173a | 868 | * @{ |
emilmont | 77:869cf507173a | 869 | */ |
emilmont | 77:869cf507173a | 870 | |
emilmont | 77:869cf507173a | 871 | #define TIM_OCFast_Enable ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 872 | #define TIM_OCFast_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 873 | #define IS_TIM_OCFAST_STATE(STATE) (((STATE) == TIM_OCFast_Enable) || \ |
emilmont | 77:869cf507173a | 874 | ((STATE) == TIM_OCFast_Disable)) |
emilmont | 77:869cf507173a | 875 | |
emilmont | 77:869cf507173a | 876 | /** |
emilmont | 77:869cf507173a | 877 | * @} |
emilmont | 77:869cf507173a | 878 | */ |
emilmont | 77:869cf507173a | 879 | |
emilmont | 77:869cf507173a | 880 | /** @defgroup TIM_Output_Compare_Clear_State |
emilmont | 77:869cf507173a | 881 | * @{ |
emilmont | 77:869cf507173a | 882 | */ |
emilmont | 77:869cf507173a | 883 | |
emilmont | 77:869cf507173a | 884 | #define TIM_OCClear_Enable ((uint16_t)0x0080) |
emilmont | 77:869cf507173a | 885 | #define TIM_OCClear_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 886 | #define IS_TIM_OCCLEAR_STATE(STATE) (((STATE) == TIM_OCClear_Enable) || \ |
emilmont | 77:869cf507173a | 887 | ((STATE) == TIM_OCClear_Disable)) |
emilmont | 77:869cf507173a | 888 | /** |
emilmont | 77:869cf507173a | 889 | * @} |
emilmont | 77:869cf507173a | 890 | */ |
emilmont | 77:869cf507173a | 891 | |
emilmont | 77:869cf507173a | 892 | /** @defgroup TIM_Trigger_Output_Source |
emilmont | 77:869cf507173a | 893 | * @{ |
emilmont | 77:869cf507173a | 894 | */ |
emilmont | 77:869cf507173a | 895 | |
emilmont | 77:869cf507173a | 896 | #define TIM_TRGOSource_Reset ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 897 | #define TIM_TRGOSource_Enable ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 898 | #define TIM_TRGOSource_Update ((uint16_t)0x0020) |
emilmont | 77:869cf507173a | 899 | #define TIM_TRGOSource_OC1 ((uint16_t)0x0030) |
emilmont | 77:869cf507173a | 900 | #define TIM_TRGOSource_OC1Ref ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 901 | #define TIM_TRGOSource_OC2Ref ((uint16_t)0x0050) |
emilmont | 77:869cf507173a | 902 | #define TIM_TRGOSource_OC3Ref ((uint16_t)0x0060) |
emilmont | 77:869cf507173a | 903 | #define TIM_TRGOSource_OC4Ref ((uint16_t)0x0070) |
emilmont | 77:869cf507173a | 904 | #define IS_TIM_TRGO_SOURCE(SOURCE) (((SOURCE) == TIM_TRGOSource_Reset) || \ |
emilmont | 77:869cf507173a | 905 | ((SOURCE) == TIM_TRGOSource_Enable) || \ |
emilmont | 77:869cf507173a | 906 | ((SOURCE) == TIM_TRGOSource_Update) || \ |
emilmont | 77:869cf507173a | 907 | ((SOURCE) == TIM_TRGOSource_OC1) || \ |
emilmont | 77:869cf507173a | 908 | ((SOURCE) == TIM_TRGOSource_OC1Ref) || \ |
emilmont | 77:869cf507173a | 909 | ((SOURCE) == TIM_TRGOSource_OC2Ref) || \ |
emilmont | 77:869cf507173a | 910 | ((SOURCE) == TIM_TRGOSource_OC3Ref) || \ |
emilmont | 77:869cf507173a | 911 | ((SOURCE) == TIM_TRGOSource_OC4Ref)) |
emilmont | 77:869cf507173a | 912 | /** |
emilmont | 77:869cf507173a | 913 | * @} |
emilmont | 77:869cf507173a | 914 | */ |
emilmont | 77:869cf507173a | 915 | |
emilmont | 77:869cf507173a | 916 | /** @defgroup TIM_Slave_Mode |
emilmont | 77:869cf507173a | 917 | * @{ |
emilmont | 77:869cf507173a | 918 | */ |
emilmont | 77:869cf507173a | 919 | |
emilmont | 77:869cf507173a | 920 | #define TIM_SlaveMode_Reset ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 921 | #define TIM_SlaveMode_Gated ((uint16_t)0x0005) |
emilmont | 77:869cf507173a | 922 | #define TIM_SlaveMode_Trigger ((uint16_t)0x0006) |
emilmont | 77:869cf507173a | 923 | #define TIM_SlaveMode_External1 ((uint16_t)0x0007) |
emilmont | 77:869cf507173a | 924 | #define IS_TIM_SLAVE_MODE(MODE) (((MODE) == TIM_SlaveMode_Reset) || \ |
emilmont | 77:869cf507173a | 925 | ((MODE) == TIM_SlaveMode_Gated) || \ |
emilmont | 77:869cf507173a | 926 | ((MODE) == TIM_SlaveMode_Trigger) || \ |
emilmont | 77:869cf507173a | 927 | ((MODE) == TIM_SlaveMode_External1)) |
emilmont | 77:869cf507173a | 928 | /** |
emilmont | 77:869cf507173a | 929 | * @} |
emilmont | 77:869cf507173a | 930 | */ |
emilmont | 77:869cf507173a | 931 | |
emilmont | 77:869cf507173a | 932 | /** @defgroup TIM_Master_Slave_Mode |
emilmont | 77:869cf507173a | 933 | * @{ |
emilmont | 77:869cf507173a | 934 | */ |
emilmont | 77:869cf507173a | 935 | |
emilmont | 77:869cf507173a | 936 | #define TIM_MasterSlaveMode_Enable ((uint16_t)0x0080) |
emilmont | 77:869cf507173a | 937 | #define TIM_MasterSlaveMode_Disable ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 938 | #define IS_TIM_MSM_STATE(STATE) (((STATE) == TIM_MasterSlaveMode_Enable) || \ |
emilmont | 77:869cf507173a | 939 | ((STATE) == TIM_MasterSlaveMode_Disable)) |
emilmont | 77:869cf507173a | 940 | /** |
emilmont | 77:869cf507173a | 941 | * @} |
emilmont | 77:869cf507173a | 942 | */ |
emilmont | 77:869cf507173a | 943 | |
emilmont | 77:869cf507173a | 944 | /** @defgroup TIM_Flags |
emilmont | 77:869cf507173a | 945 | * @{ |
emilmont | 77:869cf507173a | 946 | */ |
emilmont | 77:869cf507173a | 947 | |
emilmont | 77:869cf507173a | 948 | #define TIM_FLAG_Update ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 949 | #define TIM_FLAG_CC1 ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 950 | #define TIM_FLAG_CC2 ((uint16_t)0x0004) |
emilmont | 77:869cf507173a | 951 | #define TIM_FLAG_CC3 ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 952 | #define TIM_FLAG_CC4 ((uint16_t)0x0010) |
emilmont | 77:869cf507173a | 953 | #define TIM_FLAG_COM ((uint16_t)0x0020) |
emilmont | 77:869cf507173a | 954 | #define TIM_FLAG_Trigger ((uint16_t)0x0040) |
emilmont | 77:869cf507173a | 955 | #define TIM_FLAG_Break ((uint16_t)0x0080) |
emilmont | 77:869cf507173a | 956 | #define TIM_FLAG_CC1OF ((uint16_t)0x0200) |
emilmont | 77:869cf507173a | 957 | #define TIM_FLAG_CC2OF ((uint16_t)0x0400) |
emilmont | 77:869cf507173a | 958 | #define TIM_FLAG_CC3OF ((uint16_t)0x0800) |
emilmont | 77:869cf507173a | 959 | #define TIM_FLAG_CC4OF ((uint16_t)0x1000) |
emilmont | 77:869cf507173a | 960 | #define IS_TIM_GET_FLAG(FLAG) (((FLAG) == TIM_FLAG_Update) || \ |
emilmont | 77:869cf507173a | 961 | ((FLAG) == TIM_FLAG_CC1) || \ |
emilmont | 77:869cf507173a | 962 | ((FLAG) == TIM_FLAG_CC2) || \ |
emilmont | 77:869cf507173a | 963 | ((FLAG) == TIM_FLAG_CC3) || \ |
emilmont | 77:869cf507173a | 964 | ((FLAG) == TIM_FLAG_CC4) || \ |
emilmont | 77:869cf507173a | 965 | ((FLAG) == TIM_FLAG_COM) || \ |
emilmont | 77:869cf507173a | 966 | ((FLAG) == TIM_FLAG_Trigger) || \ |
emilmont | 77:869cf507173a | 967 | ((FLAG) == TIM_FLAG_Break) || \ |
emilmont | 77:869cf507173a | 968 | ((FLAG) == TIM_FLAG_CC1OF) || \ |
emilmont | 77:869cf507173a | 969 | ((FLAG) == TIM_FLAG_CC2OF) || \ |
emilmont | 77:869cf507173a | 970 | ((FLAG) == TIM_FLAG_CC3OF) || \ |
emilmont | 77:869cf507173a | 971 | ((FLAG) == TIM_FLAG_CC4OF)) |
emilmont | 77:869cf507173a | 972 | |
emilmont | 77:869cf507173a | 973 | |
emilmont | 77:869cf507173a | 974 | #define IS_TIM_CLEAR_FLAG(TIM_FLAG) ((((TIM_FLAG) & (uint16_t)0xE100) == 0x0000) && ((TIM_FLAG) != 0x0000)) |
emilmont | 77:869cf507173a | 975 | /** |
emilmont | 77:869cf507173a | 976 | * @} |
emilmont | 77:869cf507173a | 977 | */ |
emilmont | 77:869cf507173a | 978 | |
emilmont | 77:869cf507173a | 979 | |
emilmont | 77:869cf507173a | 980 | /** @defgroup TIM_Input_Capture_Filer_Value |
emilmont | 77:869cf507173a | 981 | * @{ |
emilmont | 77:869cf507173a | 982 | */ |
emilmont | 77:869cf507173a | 983 | |
emilmont | 77:869cf507173a | 984 | #define IS_TIM_IC_FILTER(ICFILTER) ((ICFILTER) <= 0xF) |
emilmont | 77:869cf507173a | 985 | /** |
emilmont | 77:869cf507173a | 986 | * @} |
emilmont | 77:869cf507173a | 987 | */ |
emilmont | 77:869cf507173a | 988 | |
emilmont | 77:869cf507173a | 989 | /** @defgroup TIM_External_Trigger_Filter |
emilmont | 77:869cf507173a | 990 | * @{ |
emilmont | 77:869cf507173a | 991 | */ |
emilmont | 77:869cf507173a | 992 | |
emilmont | 77:869cf507173a | 993 | #define IS_TIM_EXT_FILTER(EXTFILTER) ((EXTFILTER) <= 0xF) |
emilmont | 77:869cf507173a | 994 | /** |
emilmont | 77:869cf507173a | 995 | * @} |
emilmont | 77:869cf507173a | 996 | */ |
emilmont | 77:869cf507173a | 997 | |
emilmont | 77:869cf507173a | 998 | /** @defgroup TIM_OCReferenceClear |
emilmont | 77:869cf507173a | 999 | * @{ |
emilmont | 77:869cf507173a | 1000 | */ |
emilmont | 77:869cf507173a | 1001 | #define TIM_OCReferenceClear_ETRF ((uint16_t)0x0008) |
emilmont | 77:869cf507173a | 1002 | #define TIM_OCReferenceClear_OCREFCLR ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 1003 | #define TIM_OCREFERENCECECLEAR_SOURCE(SOURCE) (((SOURCE) == TIM_OCReferenceClear_ETRF) || \ |
emilmont | 77:869cf507173a | 1004 | ((SOURCE) == TIM_OCReferenceClear_OCREFCLR)) |
emilmont | 77:869cf507173a | 1005 | |
emilmont | 77:869cf507173a | 1006 | /** |
emilmont | 77:869cf507173a | 1007 | * @} |
emilmont | 77:869cf507173a | 1008 | */ |
emilmont | 77:869cf507173a | 1009 | /** @defgroup TIM_Remap |
emilmont | 77:869cf507173a | 1010 | * @{ |
emilmont | 77:869cf507173a | 1011 | */ |
emilmont | 77:869cf507173a | 1012 | #define TIM14_GPIO ((uint16_t)0x0000) |
emilmont | 77:869cf507173a | 1013 | #define TIM14_RTC_CLK ((uint16_t)0x0001) |
emilmont | 77:869cf507173a | 1014 | #define TIM14_HSEDiv32 ((uint16_t)0x0002) |
emilmont | 77:869cf507173a | 1015 | #define TIM14_MCO ((uint16_t)0x0003) |
emilmont | 77:869cf507173a | 1016 | |
emilmont | 77:869cf507173a | 1017 | #define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM14_GPIO)|| \ |
emilmont | 77:869cf507173a | 1018 | ((TIM_REMAP) == TIM14_RTC_CLK) || \ |
emilmont | 77:869cf507173a | 1019 | ((TIM_REMAP) == TIM14_HSEDiv32) || \ |
emilmont | 77:869cf507173a | 1020 | ((TIM_REMAP) == TIM14_MCO)) |
emilmont | 77:869cf507173a | 1021 | /** |
emilmont | 77:869cf507173a | 1022 | * @} |
emilmont | 77:869cf507173a | 1023 | */ |
emilmont | 77:869cf507173a | 1024 | |
emilmont | 77:869cf507173a | 1025 | /** @defgroup TIM_Legacy |
emilmont | 77:869cf507173a | 1026 | * @{ |
emilmont | 77:869cf507173a | 1027 | */ |
emilmont | 77:869cf507173a | 1028 | |
emilmont | 77:869cf507173a | 1029 | #define TIM_DMABurstLength_1Byte TIM_DMABurstLength_1Transfer |
emilmont | 77:869cf507173a | 1030 | #define TIM_DMABurstLength_2Bytes TIM_DMABurstLength_2Transfers |
emilmont | 77:869cf507173a | 1031 | #define TIM_DMABurstLength_3Bytes TIM_DMABurstLength_3Transfers |
emilmont | 77:869cf507173a | 1032 | #define TIM_DMABurstLength_4Bytes TIM_DMABurstLength_4Transfers |
emilmont | 77:869cf507173a | 1033 | #define TIM_DMABurstLength_5Bytes TIM_DMABurstLength_5Transfers |
emilmont | 77:869cf507173a | 1034 | #define TIM_DMABurstLength_6Bytes TIM_DMABurstLength_6Transfers |
emilmont | 77:869cf507173a | 1035 | #define TIM_DMABurstLength_7Bytes TIM_DMABurstLength_7Transfers |
emilmont | 77:869cf507173a | 1036 | #define TIM_DMABurstLength_8Bytes TIM_DMABurstLength_8Transfers |
emilmont | 77:869cf507173a | 1037 | #define TIM_DMABurstLength_9Bytes TIM_DMABurstLength_9Transfers |
emilmont | 77:869cf507173a | 1038 | #define TIM_DMABurstLength_10Bytes TIM_DMABurstLength_10Transfers |
emilmont | 77:869cf507173a | 1039 | #define TIM_DMABurstLength_11Bytes TIM_DMABurstLength_11Transfers |
emilmont | 77:869cf507173a | 1040 | #define TIM_DMABurstLength_12Bytes TIM_DMABurstLength_12Transfers |
emilmont | 77:869cf507173a | 1041 | #define TIM_DMABurstLength_13Bytes TIM_DMABurstLength_13Transfers |
emilmont | 77:869cf507173a | 1042 | #define TIM_DMABurstLength_14Bytes TIM_DMABurstLength_14Transfers |
emilmont | 77:869cf507173a | 1043 | #define TIM_DMABurstLength_15Bytes TIM_DMABurstLength_15Transfers |
emilmont | 77:869cf507173a | 1044 | #define TIM_DMABurstLength_16Bytes TIM_DMABurstLength_16Transfers |
emilmont | 77:869cf507173a | 1045 | #define TIM_DMABurstLength_17Bytes TIM_DMABurstLength_17Transfers |
emilmont | 77:869cf507173a | 1046 | #define TIM_DMABurstLength_18Bytes TIM_DMABurstLength_18Transfers |
emilmont | 77:869cf507173a | 1047 | /** |
emilmont | 77:869cf507173a | 1048 | * @} |
emilmont | 77:869cf507173a | 1049 | */ |
emilmont | 77:869cf507173a | 1050 | |
emilmont | 77:869cf507173a | 1051 | /** |
emilmont | 77:869cf507173a | 1052 | * @} |
emilmont | 77:869cf507173a | 1053 | */ |
emilmont | 77:869cf507173a | 1054 | |
emilmont | 77:869cf507173a | 1055 | /* Exported macro ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 1056 | /* Exported functions ------------------------------------------------------- */ |
emilmont | 77:869cf507173a | 1057 | |
emilmont | 77:869cf507173a | 1058 | /* TimeBase management ********************************************************/ |
emilmont | 77:869cf507173a | 1059 | void TIM_DeInit(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1060 | void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct); |
emilmont | 77:869cf507173a | 1061 | void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct); |
emilmont | 77:869cf507173a | 1062 | void TIM_PrescalerConfig(TIM_TypeDef* TIMx, uint16_t Prescaler, uint16_t TIM_PSCReloadMode); |
emilmont | 77:869cf507173a | 1063 | void TIM_CounterModeConfig(TIM_TypeDef* TIMx, uint16_t TIM_CounterMode); |
emilmont | 77:869cf507173a | 1064 | void TIM_SetCounter(TIM_TypeDef* TIMx, uint32_t Counter); |
emilmont | 77:869cf507173a | 1065 | void TIM_SetAutoreload(TIM_TypeDef* TIMx, uint32_t Autoreload); |
emilmont | 77:869cf507173a | 1066 | uint32_t TIM_GetCounter(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1067 | uint16_t TIM_GetPrescaler(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1068 | void TIM_UpdateDisableConfig(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1069 | void TIM_UpdateRequestConfig(TIM_TypeDef* TIMx, uint16_t TIM_UpdateSource); |
emilmont | 77:869cf507173a | 1070 | void TIM_ARRPreloadConfig(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1071 | void TIM_SelectOnePulseMode(TIM_TypeDef* TIMx, uint16_t TIM_OPMode); |
emilmont | 77:869cf507173a | 1072 | void TIM_SetClockDivision(TIM_TypeDef* TIMx, uint16_t TIM_CKD); |
emilmont | 77:869cf507173a | 1073 | void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1074 | |
emilmont | 77:869cf507173a | 1075 | /* Advanced-control timers (TIM1) specific features*******************/ |
emilmont | 77:869cf507173a | 1076 | void TIM_BDTRConfig(TIM_TypeDef* TIMx, TIM_BDTRInitTypeDef *TIM_BDTRInitStruct); |
emilmont | 77:869cf507173a | 1077 | void TIM_BDTRStructInit(TIM_BDTRInitTypeDef* TIM_BDTRInitStruct); |
emilmont | 77:869cf507173a | 1078 | void TIM_CtrlPWMOutputs(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1079 | |
emilmont | 77:869cf507173a | 1080 | /* Output Compare management **************************************************/ |
emilmont | 77:869cf507173a | 1081 | void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); |
emilmont | 77:869cf507173a | 1082 | void TIM_OC2Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); |
emilmont | 77:869cf507173a | 1083 | void TIM_OC3Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); |
emilmont | 77:869cf507173a | 1084 | void TIM_OC4Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); |
emilmont | 77:869cf507173a | 1085 | void TIM_OCStructInit(TIM_OCInitTypeDef* TIM_OCInitStruct); |
emilmont | 77:869cf507173a | 1086 | void TIM_SelectOCxM(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_OCMode); |
emilmont | 77:869cf507173a | 1087 | void TIM_SetCompare1(TIM_TypeDef* TIMx, uint32_t Compare1); |
emilmont | 77:869cf507173a | 1088 | void TIM_SetCompare2(TIM_TypeDef* TIMx, uint32_t Compare2); |
emilmont | 77:869cf507173a | 1089 | void TIM_SetCompare3(TIM_TypeDef* TIMx, uint32_t Compare3); |
emilmont | 77:869cf507173a | 1090 | void TIM_SetCompare4(TIM_TypeDef* TIMx, uint32_t Compare4); |
emilmont | 77:869cf507173a | 1091 | void TIM_ForcedOC1Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); |
emilmont | 77:869cf507173a | 1092 | void TIM_ForcedOC2Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); |
emilmont | 77:869cf507173a | 1093 | void TIM_ForcedOC3Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); |
emilmont | 77:869cf507173a | 1094 | void TIM_ForcedOC4Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); |
emilmont | 77:869cf507173a | 1095 | void TIM_CCPreloadControl(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1096 | void TIM_OC1PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); |
emilmont | 77:869cf507173a | 1097 | void TIM_OC2PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); |
emilmont | 77:869cf507173a | 1098 | void TIM_OC3PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); |
emilmont | 77:869cf507173a | 1099 | void TIM_OC4PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); |
emilmont | 77:869cf507173a | 1100 | void TIM_OC1FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); |
emilmont | 77:869cf507173a | 1101 | void TIM_OC2FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); |
emilmont | 77:869cf507173a | 1102 | void TIM_OC3FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); |
emilmont | 77:869cf507173a | 1103 | void TIM_OC4FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); |
emilmont | 77:869cf507173a | 1104 | void TIM_ClearOC1Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); |
emilmont | 77:869cf507173a | 1105 | void TIM_ClearOC2Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); |
emilmont | 77:869cf507173a | 1106 | void TIM_ClearOC3Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); |
emilmont | 77:869cf507173a | 1107 | void TIM_ClearOC4Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); |
emilmont | 77:869cf507173a | 1108 | void TIM_OC1PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); |
emilmont | 77:869cf507173a | 1109 | void TIM_OC1NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity); |
emilmont | 77:869cf507173a | 1110 | void TIM_OC2PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); |
emilmont | 77:869cf507173a | 1111 | void TIM_OC2NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity); |
emilmont | 77:869cf507173a | 1112 | void TIM_OC3PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); |
emilmont | 77:869cf507173a | 1113 | void TIM_OC3NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity); |
emilmont | 77:869cf507173a | 1114 | void TIM_OC4PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); |
emilmont | 77:869cf507173a | 1115 | void TIM_SelectOCREFClear(TIM_TypeDef* TIMx, uint16_t TIM_OCReferenceClear); |
emilmont | 77:869cf507173a | 1116 | void TIM_CCxCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx); |
emilmont | 77:869cf507173a | 1117 | void TIM_CCxNCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN); |
emilmont | 77:869cf507173a | 1118 | void TIM_SelectCOM(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1119 | |
emilmont | 77:869cf507173a | 1120 | /* Input Capture management ***************************************************/ |
emilmont | 77:869cf507173a | 1121 | void TIM_ICInit(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct); |
emilmont | 77:869cf507173a | 1122 | void TIM_ICStructInit(TIM_ICInitTypeDef* TIM_ICInitStruct); |
emilmont | 77:869cf507173a | 1123 | void TIM_PWMIConfig(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct); |
emilmont | 77:869cf507173a | 1124 | uint32_t TIM_GetCapture1(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1125 | uint32_t TIM_GetCapture2(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1126 | uint32_t TIM_GetCapture3(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1127 | uint32_t TIM_GetCapture4(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1128 | void TIM_SetIC1Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); |
emilmont | 77:869cf507173a | 1129 | void TIM_SetIC2Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); |
emilmont | 77:869cf507173a | 1130 | void TIM_SetIC3Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); |
emilmont | 77:869cf507173a | 1131 | void TIM_SetIC4Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); |
emilmont | 77:869cf507173a | 1132 | |
emilmont | 77:869cf507173a | 1133 | /* Interrupts, DMA and flags management ***************************************/ |
emilmont | 77:869cf507173a | 1134 | void TIM_ITConfig(TIM_TypeDef* TIMx, uint16_t TIM_IT, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1135 | void TIM_GenerateEvent(TIM_TypeDef* TIMx, uint16_t TIM_EventSource); |
emilmont | 77:869cf507173a | 1136 | FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, uint16_t TIM_FLAG); |
emilmont | 77:869cf507173a | 1137 | void TIM_ClearFlag(TIM_TypeDef* TIMx, uint16_t TIM_FLAG); |
emilmont | 77:869cf507173a | 1138 | ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, uint16_t TIM_IT); |
emilmont | 77:869cf507173a | 1139 | void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, uint16_t TIM_IT); |
emilmont | 77:869cf507173a | 1140 | void TIM_DMAConfig(TIM_TypeDef* TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength); |
emilmont | 77:869cf507173a | 1141 | void TIM_DMACmd(TIM_TypeDef* TIMx, uint16_t TIM_DMASource, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1142 | void TIM_SelectCCDMA(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1143 | |
emilmont | 77:869cf507173a | 1144 | /* Clocks management **********************************************************/ |
emilmont | 77:869cf507173a | 1145 | void TIM_InternalClockConfig(TIM_TypeDef* TIMx); |
emilmont | 77:869cf507173a | 1146 | void TIM_ITRxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource); |
emilmont | 77:869cf507173a | 1147 | void TIM_TIxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_TIxExternalCLKSource, |
emilmont | 77:869cf507173a | 1148 | uint16_t TIM_ICPolarity, uint16_t ICFilter); |
emilmont | 77:869cf507173a | 1149 | void TIM_ETRClockMode1Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, |
emilmont | 77:869cf507173a | 1150 | uint16_t ExtTRGFilter); |
emilmont | 77:869cf507173a | 1151 | void TIM_ETRClockMode2Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, |
emilmont | 77:869cf507173a | 1152 | uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter); |
emilmont | 77:869cf507173a | 1153 | |
emilmont | 77:869cf507173a | 1154 | |
emilmont | 77:869cf507173a | 1155 | /* Synchronization management *************************************************/ |
emilmont | 77:869cf507173a | 1156 | void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource); |
emilmont | 77:869cf507173a | 1157 | void TIM_SelectOutputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_TRGOSource); |
emilmont | 77:869cf507173a | 1158 | void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_SlaveMode); |
emilmont | 77:869cf507173a | 1159 | void TIM_SelectMasterSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_MasterSlaveMode); |
emilmont | 77:869cf507173a | 1160 | void TIM_ETRConfig(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, |
emilmont | 77:869cf507173a | 1161 | uint16_t ExtTRGFilter); |
emilmont | 77:869cf507173a | 1162 | |
emilmont | 77:869cf507173a | 1163 | /* Specific interface management **********************************************/ |
emilmont | 77:869cf507173a | 1164 | void TIM_EncoderInterfaceConfig(TIM_TypeDef* TIMx, uint16_t TIM_EncoderMode, |
emilmont | 77:869cf507173a | 1165 | uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity); |
emilmont | 77:869cf507173a | 1166 | void TIM_SelectHallSensor(TIM_TypeDef* TIMx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 1167 | |
emilmont | 77:869cf507173a | 1168 | /* Specific remapping management **********************************************/ |
emilmont | 77:869cf507173a | 1169 | void TIM_RemapConfig(TIM_TypeDef* TIMx, uint16_t TIM_Remap); |
emilmont | 77:869cf507173a | 1170 | |
emilmont | 77:869cf507173a | 1171 | |
emilmont | 77:869cf507173a | 1172 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 1173 | } |
emilmont | 77:869cf507173a | 1174 | #endif |
emilmont | 77:869cf507173a | 1175 | |
emilmont | 77:869cf507173a | 1176 | #endif /*__STM32F0XX_TIM_H */ |
emilmont | 77:869cf507173a | 1177 | |
emilmont | 77:869cf507173a | 1178 | /** |
emilmont | 77:869cf507173a | 1179 | * @} |
emilmont | 77:869cf507173a | 1180 | */ |
emilmont | 77:869cf507173a | 1181 | |
emilmont | 77:869cf507173a | 1182 | /** |
emilmont | 77:869cf507173a | 1183 | * @} |
emilmont | 77:869cf507173a | 1184 | */ |
emilmont | 77:869cf507173a | 1185 | |
emilmont | 77:869cf507173a | 1186 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |