Mangue Baja Box

Dependencies:   mbed

Committer:
einsteingustavo
Date:
Mon Jul 29 20:38:00 2019 +0000
Revision:
0:0dee8840a1c0
Mangue Baja Box

Who changed what in which revision?

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