cc y / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
100:cbbeb26dbd92
Child:
123:b0220dba8be7
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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