mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32F3XX/stm32f30x_tim.c@637:ed69428d4850, 2015-12-22 (annotated)
- Committer:
- jaerts
- Date:
- Tue Dec 22 13:22:16 2015 +0000
- Revision:
- 637:ed69428d4850
- Parent:
- 155:8435094ec241
Add very shady LPC1768 CAN Filter implementation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 155:8435094ec241 | 1 | /** |
mbed_official | 155:8435094ec241 | 2 | ****************************************************************************** |
mbed_official | 155:8435094ec241 | 3 | * @file stm32f30x_tim.c |
mbed_official | 155:8435094ec241 | 4 | * @author MCD Application Team |
mbed_official | 155:8435094ec241 | 5 | * @version V1.1.0 |
mbed_official | 155:8435094ec241 | 6 | * @date 27-February-2014 |
mbed_official | 155:8435094ec241 | 7 | * @brief This file provides firmware functions to manage the following |
mbed_official | 155:8435094ec241 | 8 | * functionalities of the TIM peripheral: |
mbed_official | 155:8435094ec241 | 9 | * + TimeBase management |
mbed_official | 155:8435094ec241 | 10 | * + Output Compare management |
mbed_official | 155:8435094ec241 | 11 | * + Input Capture management |
mbed_official | 155:8435094ec241 | 12 | * + Advanced-control timers (TIM1 and TIM8) specific features |
mbed_official | 155:8435094ec241 | 13 | * + Interrupts, DMA and flags management |
mbed_official | 155:8435094ec241 | 14 | * + Clocks management |
mbed_official | 155:8435094ec241 | 15 | * + Synchronization management |
mbed_official | 155:8435094ec241 | 16 | * + Specific interface management |
mbed_official | 155:8435094ec241 | 17 | * + Specific remapping management |
mbed_official | 155:8435094ec241 | 18 | * |
mbed_official | 155:8435094ec241 | 19 | @verbatim |
mbed_official | 155:8435094ec241 | 20 | |
mbed_official | 155:8435094ec241 | 21 | ============================================================================== |
mbed_official | 155:8435094ec241 | 22 | ##### How to use this driver ##### |
mbed_official | 155:8435094ec241 | 23 | ============================================================================== |
mbed_official | 155:8435094ec241 | 24 | [..] This driver provides functions to configure and program the TIM |
mbed_official | 155:8435094ec241 | 25 | of all stm32f30x devices. |
mbed_official | 155:8435094ec241 | 26 | These functions are split in 9 groups: |
mbed_official | 155:8435094ec241 | 27 | |
mbed_official | 155:8435094ec241 | 28 | (#) TIM TimeBase management: this group includes all needed functions |
mbed_official | 155:8435094ec241 | 29 | to configure the TM Timebase unit: |
mbed_official | 155:8435094ec241 | 30 | (++) Set/Get Prescaler |
mbed_official | 155:8435094ec241 | 31 | (++) Set/Get Autoreload |
mbed_official | 155:8435094ec241 | 32 | (++) Counter modes configuration |
mbed_official | 155:8435094ec241 | 33 | (++) Set Clock division |
mbed_official | 155:8435094ec241 | 34 | (++) Select the One Pulse mode |
mbed_official | 155:8435094ec241 | 35 | (++) Update Request Configuration |
mbed_official | 155:8435094ec241 | 36 | (++) Update Disable Configuration |
mbed_official | 155:8435094ec241 | 37 | (++) Auto-Preload Configuration |
mbed_official | 155:8435094ec241 | 38 | (++) Enable/Disable the counter |
mbed_official | 155:8435094ec241 | 39 | |
mbed_official | 155:8435094ec241 | 40 | (#) TIM Output Compare management: this group includes all needed |
mbed_official | 155:8435094ec241 | 41 | functions to configure the Capture/Compare unit used in Output |
mbed_official | 155:8435094ec241 | 42 | compare mode: |
mbed_official | 155:8435094ec241 | 43 | (++) Configure each channel, independently, in Output Compare mode |
mbed_official | 155:8435094ec241 | 44 | (++) Select the output compare modes |
mbed_official | 155:8435094ec241 | 45 | (++) Select the Polarities of each channel |
mbed_official | 155:8435094ec241 | 46 | (++) Set/Get the Capture/Compare register values |
mbed_official | 155:8435094ec241 | 47 | (++) Select the Output Compare Fast mode |
mbed_official | 155:8435094ec241 | 48 | (++) Select the Output Compare Forced mode |
mbed_official | 155:8435094ec241 | 49 | (++) Output Compare-Preload Configuration |
mbed_official | 155:8435094ec241 | 50 | (++) Clear Output Compare Reference |
mbed_official | 155:8435094ec241 | 51 | (++) Select the OCREF Clear signal |
mbed_official | 155:8435094ec241 | 52 | (++) Enable/Disable the Capture/Compare Channels |
mbed_official | 155:8435094ec241 | 53 | |
mbed_official | 155:8435094ec241 | 54 | (#) TIM Input Capture management: this group includes all needed |
mbed_official | 155:8435094ec241 | 55 | functions to configure the Capture/Compare unit used in |
mbed_official | 155:8435094ec241 | 56 | Input Capture mode: |
mbed_official | 155:8435094ec241 | 57 | (++) Configure each channel in input capture mode |
mbed_official | 155:8435094ec241 | 58 | (++) Configure Channel1/2 in PWM Input mode |
mbed_official | 155:8435094ec241 | 59 | (++) Set the Input Capture Prescaler |
mbed_official | 155:8435094ec241 | 60 | (++) Get the Capture/Compare values |
mbed_official | 155:8435094ec241 | 61 | |
mbed_official | 155:8435094ec241 | 62 | (#) Advanced-control timers (TIM1 and TIM8) specific features |
mbed_official | 155:8435094ec241 | 63 | (++) Configures the Break input, dead time, Lock level, the OSSI, |
mbed_official | 155:8435094ec241 | 64 | the OSSR State and the AOE(automatic output enable) |
mbed_official | 155:8435094ec241 | 65 | (++) Enable/Disable the TIM peripheral Main Outputs |
mbed_official | 155:8435094ec241 | 66 | (++) Select the Commutation event |
mbed_official | 155:8435094ec241 | 67 | (++) Set/Reset the Capture Compare Preload Control bit |
mbed_official | 155:8435094ec241 | 68 | |
mbed_official | 155:8435094ec241 | 69 | (#) TIM interrupts, DMA and flags management |
mbed_official | 155:8435094ec241 | 70 | (++) Enable/Disable interrupt sources |
mbed_official | 155:8435094ec241 | 71 | (++) Get flags status |
mbed_official | 155:8435094ec241 | 72 | (++) Clear flags/ Pending bits |
mbed_official | 155:8435094ec241 | 73 | (++) Enable/Disable DMA requests |
mbed_official | 155:8435094ec241 | 74 | (++) Configure DMA burst mode |
mbed_official | 155:8435094ec241 | 75 | (++) Select CaptureCompare DMA request |
mbed_official | 155:8435094ec241 | 76 | |
mbed_official | 155:8435094ec241 | 77 | (#) TIM clocks management: this group includes all needed functions |
mbed_official | 155:8435094ec241 | 78 | to configure the clock controller unit: |
mbed_official | 155:8435094ec241 | 79 | (++) Select internal/External clock |
mbed_official | 155:8435094ec241 | 80 | (++) Select the external clock mode: ETR(Mode1/Mode2), TIx or ITRx |
mbed_official | 155:8435094ec241 | 81 | |
mbed_official | 155:8435094ec241 | 82 | (#) TIM synchronization management: this group includes all needed |
mbed_official | 155:8435094ec241 | 83 | functions to configure the Synchronization unit: |
mbed_official | 155:8435094ec241 | 84 | (++) Select Input Trigger |
mbed_official | 155:8435094ec241 | 85 | (++) Select Output Trigger |
mbed_official | 155:8435094ec241 | 86 | (++) Select Master Slave Mode |
mbed_official | 155:8435094ec241 | 87 | (++) ETR Configuration when used as external trigger |
mbed_official | 155:8435094ec241 | 88 | |
mbed_official | 155:8435094ec241 | 89 | (#) TIM specific interface management, this group includes all |
mbed_official | 155:8435094ec241 | 90 | needed functions to use the specific TIM interface: |
mbed_official | 155:8435094ec241 | 91 | (++) Encoder Interface Configuration |
mbed_official | 155:8435094ec241 | 92 | (++) Select Hall Sensor |
mbed_official | 155:8435094ec241 | 93 | |
mbed_official | 155:8435094ec241 | 94 | (#) TIM specific remapping management includes the Remapping |
mbed_official | 155:8435094ec241 | 95 | configuration of specific timers |
mbed_official | 155:8435094ec241 | 96 | |
mbed_official | 155:8435094ec241 | 97 | @endverbatim |
mbed_official | 155:8435094ec241 | 98 | |
mbed_official | 155:8435094ec241 | 99 | ****************************************************************************** |
mbed_official | 155:8435094ec241 | 100 | * @attention |
mbed_official | 155:8435094ec241 | 101 | * |
mbed_official | 155:8435094ec241 | 102 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 155:8435094ec241 | 103 | * |
mbed_official | 155:8435094ec241 | 104 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 155:8435094ec241 | 105 | * are permitted provided that the following conditions are met: |
mbed_official | 155:8435094ec241 | 106 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 155:8435094ec241 | 107 | * this list of conditions and the following disclaimer. |
mbed_official | 155:8435094ec241 | 108 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 155:8435094ec241 | 109 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 155:8435094ec241 | 110 | * and/or other materials provided with the distribution. |
mbed_official | 155:8435094ec241 | 111 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 155:8435094ec241 | 112 | * may be used to endorse or promote products derived from this software |
mbed_official | 155:8435094ec241 | 113 | * without specific prior written permission. |
mbed_official | 155:8435094ec241 | 114 | * |
mbed_official | 155:8435094ec241 | 115 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 155:8435094ec241 | 116 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 155:8435094ec241 | 117 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 155:8435094ec241 | 118 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 155:8435094ec241 | 119 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 155:8435094ec241 | 120 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 155:8435094ec241 | 121 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 155:8435094ec241 | 122 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 155:8435094ec241 | 123 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 155:8435094ec241 | 124 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 155:8435094ec241 | 125 | * |
mbed_official | 155:8435094ec241 | 126 | ****************************************************************************** |
mbed_official | 155:8435094ec241 | 127 | */ |
mbed_official | 155:8435094ec241 | 128 | |
mbed_official | 155:8435094ec241 | 129 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 155:8435094ec241 | 130 | #include "stm32f30x_tim.h" |
mbed_official | 155:8435094ec241 | 131 | #include "stm32f30x_rcc.h" |
mbed_official | 155:8435094ec241 | 132 | |
mbed_official | 155:8435094ec241 | 133 | /** @addtogroup STM32F30x_StdPeriph_Driver |
mbed_official | 155:8435094ec241 | 134 | * @{ |
mbed_official | 155:8435094ec241 | 135 | */ |
mbed_official | 155:8435094ec241 | 136 | |
mbed_official | 155:8435094ec241 | 137 | /** @defgroup TIM |
mbed_official | 155:8435094ec241 | 138 | * @brief TIM driver modules |
mbed_official | 155:8435094ec241 | 139 | * @{ |
mbed_official | 155:8435094ec241 | 140 | */ |
mbed_official | 155:8435094ec241 | 141 | |
mbed_official | 155:8435094ec241 | 142 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 155:8435094ec241 | 143 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 155:8435094ec241 | 144 | |
mbed_official | 155:8435094ec241 | 145 | /* ---------------------- TIM registers bit mask ------------------------ */ |
mbed_official | 155:8435094ec241 | 146 | #define SMCR_ETR_MASK ((uint16_t)0x00FF) |
mbed_official | 155:8435094ec241 | 147 | #define CCMR_OFFSET ((uint16_t)0x0018) |
mbed_official | 155:8435094ec241 | 148 | #define CCER_CCE_SET ((uint16_t)0x0001) |
mbed_official | 155:8435094ec241 | 149 | #define CCER_CCNE_SET ((uint16_t)0x0004) |
mbed_official | 155:8435094ec241 | 150 | #define CCMR_OC13M_MASK ((uint32_t)0xFFFEFF8F) |
mbed_official | 155:8435094ec241 | 151 | #define CCMR_OC24M_MASK ((uint32_t)0xFEFF8FFF) |
mbed_official | 155:8435094ec241 | 152 | |
mbed_official | 155:8435094ec241 | 153 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 155:8435094ec241 | 154 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 155:8435094ec241 | 155 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 155:8435094ec241 | 156 | static void TI1_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 157 | uint16_t TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 158 | static void TI2_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 159 | uint16_t TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 160 | static void TI3_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 161 | uint16_t TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 162 | static void TI4_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 163 | uint16_t TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 164 | |
mbed_official | 155:8435094ec241 | 165 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 155:8435094ec241 | 166 | |
mbed_official | 155:8435094ec241 | 167 | /** @defgroup TIM_Private_Functions |
mbed_official | 155:8435094ec241 | 168 | * @{ |
mbed_official | 155:8435094ec241 | 169 | */ |
mbed_official | 155:8435094ec241 | 170 | |
mbed_official | 155:8435094ec241 | 171 | /** @defgroup TIM_Group1 TimeBase management functions |
mbed_official | 155:8435094ec241 | 172 | * @brief TimeBase management functions |
mbed_official | 155:8435094ec241 | 173 | * |
mbed_official | 155:8435094ec241 | 174 | @verbatim |
mbed_official | 155:8435094ec241 | 175 | =============================================================================== |
mbed_official | 155:8435094ec241 | 176 | ##### TimeBase management functions ##### |
mbed_official | 155:8435094ec241 | 177 | =============================================================================== |
mbed_official | 155:8435094ec241 | 178 | |
mbed_official | 155:8435094ec241 | 179 | |
mbed_official | 155:8435094ec241 | 180 | *** TIM Driver: how to use it in Timing(Time base) Mode *** |
mbed_official | 155:8435094ec241 | 181 | ============================================================ |
mbed_official | 155:8435094ec241 | 182 | [..] |
mbed_official | 155:8435094ec241 | 183 | To use the Timer in Timing(Time base) mode, the following steps are mandatory: |
mbed_official | 155:8435094ec241 | 184 | |
mbed_official | 155:8435094ec241 | 185 | (#) Enable TIM clock using |
mbed_official | 155:8435094ec241 | 186 | RCC_APBxPeriphClockCmd(RCC_APBxPeriph_TIMx, ENABLE) function |
mbed_official | 155:8435094ec241 | 187 | (#) Fill the TIM_TimeBaseInitStruct with the desired parameters. |
mbed_official | 155:8435094ec241 | 188 | (#) Call TIM_TimeBaseInit(TIMx, &TIM_TimeBaseInitStruct) to configure |
mbed_official | 155:8435094ec241 | 189 | the Time Base unit |
mbed_official | 155:8435094ec241 | 190 | with the corresponding configuration |
mbed_official | 155:8435094ec241 | 191 | (#) Enable the NVIC if you need to generate the update interrupt. |
mbed_official | 155:8435094ec241 | 192 | (#) Enable the corresponding interrupt using the function |
mbed_official | 155:8435094ec241 | 193 | TIM_ITConfig(TIMx, TIM_IT_Update) |
mbed_official | 155:8435094ec241 | 194 | (#) Call the TIM_Cmd(ENABLE) function to enable the TIM counter. |
mbed_official | 155:8435094ec241 | 195 | [..] |
mbed_official | 155:8435094ec241 | 196 | (@) All other functions can be used separately to modify, if needed, |
mbed_official | 155:8435094ec241 | 197 | a specific feature of the Timer. |
mbed_official | 155:8435094ec241 | 198 | |
mbed_official | 155:8435094ec241 | 199 | @endverbatim |
mbed_official | 155:8435094ec241 | 200 | * @{ |
mbed_official | 155:8435094ec241 | 201 | */ |
mbed_official | 155:8435094ec241 | 202 | |
mbed_official | 155:8435094ec241 | 203 | /** |
mbed_official | 155:8435094ec241 | 204 | * @brief Deinitializes the TIMx peripheral registers to their default reset values. |
mbed_official | 155:8435094ec241 | 205 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 206 | * @retval None |
mbed_official | 155:8435094ec241 | 207 | |
mbed_official | 155:8435094ec241 | 208 | */ |
mbed_official | 155:8435094ec241 | 209 | void TIM_DeInit(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 210 | { |
mbed_official | 155:8435094ec241 | 211 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 212 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 213 | |
mbed_official | 155:8435094ec241 | 214 | if (TIMx == TIM1) |
mbed_official | 155:8435094ec241 | 215 | { |
mbed_official | 155:8435094ec241 | 216 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, ENABLE); |
mbed_official | 155:8435094ec241 | 217 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, DISABLE); |
mbed_official | 155:8435094ec241 | 218 | } |
mbed_official | 155:8435094ec241 | 219 | else if (TIMx == TIM2) |
mbed_official | 155:8435094ec241 | 220 | { |
mbed_official | 155:8435094ec241 | 221 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, ENABLE); |
mbed_official | 155:8435094ec241 | 222 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, DISABLE); |
mbed_official | 155:8435094ec241 | 223 | } |
mbed_official | 155:8435094ec241 | 224 | else if (TIMx == TIM3) |
mbed_official | 155:8435094ec241 | 225 | { |
mbed_official | 155:8435094ec241 | 226 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, ENABLE); |
mbed_official | 155:8435094ec241 | 227 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, DISABLE); |
mbed_official | 155:8435094ec241 | 228 | } |
mbed_official | 155:8435094ec241 | 229 | else if (TIMx == TIM4) |
mbed_official | 155:8435094ec241 | 230 | { |
mbed_official | 155:8435094ec241 | 231 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, ENABLE); |
mbed_official | 155:8435094ec241 | 232 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, DISABLE); |
mbed_official | 155:8435094ec241 | 233 | } |
mbed_official | 155:8435094ec241 | 234 | else if (TIMx == TIM6) |
mbed_official | 155:8435094ec241 | 235 | { |
mbed_official | 155:8435094ec241 | 236 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE); |
mbed_official | 155:8435094ec241 | 237 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, DISABLE); |
mbed_official | 155:8435094ec241 | 238 | } |
mbed_official | 155:8435094ec241 | 239 | else if (TIMx == TIM7) |
mbed_official | 155:8435094ec241 | 240 | { |
mbed_official | 155:8435094ec241 | 241 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, ENABLE); |
mbed_official | 155:8435094ec241 | 242 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, DISABLE); |
mbed_official | 155:8435094ec241 | 243 | } |
mbed_official | 155:8435094ec241 | 244 | else if (TIMx == TIM8) |
mbed_official | 155:8435094ec241 | 245 | { |
mbed_official | 155:8435094ec241 | 246 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, ENABLE); |
mbed_official | 155:8435094ec241 | 247 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, DISABLE); |
mbed_official | 155:8435094ec241 | 248 | } |
mbed_official | 155:8435094ec241 | 249 | else if (TIMx == TIM15) |
mbed_official | 155:8435094ec241 | 250 | { |
mbed_official | 155:8435094ec241 | 251 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM15, ENABLE); |
mbed_official | 155:8435094ec241 | 252 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM15, DISABLE); |
mbed_official | 155:8435094ec241 | 253 | } |
mbed_official | 155:8435094ec241 | 254 | else if (TIMx == TIM16) |
mbed_official | 155:8435094ec241 | 255 | { |
mbed_official | 155:8435094ec241 | 256 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM16, ENABLE); |
mbed_official | 155:8435094ec241 | 257 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM16, DISABLE); |
mbed_official | 155:8435094ec241 | 258 | } |
mbed_official | 155:8435094ec241 | 259 | else |
mbed_official | 155:8435094ec241 | 260 | { |
mbed_official | 155:8435094ec241 | 261 | if (TIMx == TIM17) |
mbed_official | 155:8435094ec241 | 262 | { |
mbed_official | 155:8435094ec241 | 263 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM17, ENABLE); |
mbed_official | 155:8435094ec241 | 264 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM17, DISABLE); |
mbed_official | 155:8435094ec241 | 265 | } |
mbed_official | 155:8435094ec241 | 266 | } |
mbed_official | 155:8435094ec241 | 267 | } |
mbed_official | 155:8435094ec241 | 268 | |
mbed_official | 155:8435094ec241 | 269 | /** |
mbed_official | 155:8435094ec241 | 270 | * @brief Initializes the TIMx Time Base Unit peripheral according to |
mbed_official | 155:8435094ec241 | 271 | * the specified parameters in the TIM_TimeBaseInitStruct. |
mbed_official | 155:8435094ec241 | 272 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 273 | * @param TIM_TimeBaseInitStruct: pointer to a TIM_TimeBaseInitTypeDef structure |
mbed_official | 155:8435094ec241 | 274 | * that contains the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 275 | * @retval None |
mbed_official | 155:8435094ec241 | 276 | */ |
mbed_official | 155:8435094ec241 | 277 | void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct) |
mbed_official | 155:8435094ec241 | 278 | { |
mbed_official | 155:8435094ec241 | 279 | uint16_t tmpcr1 = 0; |
mbed_official | 155:8435094ec241 | 280 | |
mbed_official | 155:8435094ec241 | 281 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 282 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 283 | assert_param(IS_TIM_COUNTER_MODE(TIM_TimeBaseInitStruct->TIM_CounterMode)); |
mbed_official | 155:8435094ec241 | 284 | assert_param(IS_TIM_CKD_DIV(TIM_TimeBaseInitStruct->TIM_ClockDivision)); |
mbed_official | 155:8435094ec241 | 285 | |
mbed_official | 155:8435094ec241 | 286 | tmpcr1 = TIMx->CR1; |
mbed_official | 155:8435094ec241 | 287 | |
mbed_official | 155:8435094ec241 | 288 | if((TIMx == TIM1) || (TIMx == TIM8)|| (TIMx == TIM2) || |
mbed_official | 155:8435094ec241 | 289 | (TIMx == TIM3)|| (TIMx == TIM4)) |
mbed_official | 155:8435094ec241 | 290 | { |
mbed_official | 155:8435094ec241 | 291 | /* Select the Counter Mode */ |
mbed_official | 155:8435094ec241 | 292 | tmpcr1 &= (uint16_t)(~(TIM_CR1_DIR | TIM_CR1_CMS)); |
mbed_official | 155:8435094ec241 | 293 | tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_CounterMode; |
mbed_official | 155:8435094ec241 | 294 | } |
mbed_official | 155:8435094ec241 | 295 | |
mbed_official | 155:8435094ec241 | 296 | if((TIMx != TIM6) && (TIMx != TIM7)) |
mbed_official | 155:8435094ec241 | 297 | { |
mbed_official | 155:8435094ec241 | 298 | /* Set the clock division */ |
mbed_official | 155:8435094ec241 | 299 | tmpcr1 &= (uint16_t)(~TIM_CR1_CKD); |
mbed_official | 155:8435094ec241 | 300 | tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_ClockDivision; |
mbed_official | 155:8435094ec241 | 301 | } |
mbed_official | 155:8435094ec241 | 302 | |
mbed_official | 155:8435094ec241 | 303 | TIMx->CR1 = tmpcr1; |
mbed_official | 155:8435094ec241 | 304 | |
mbed_official | 155:8435094ec241 | 305 | /* Set the Autoreload value */ |
mbed_official | 155:8435094ec241 | 306 | TIMx->ARR = TIM_TimeBaseInitStruct->TIM_Period ; |
mbed_official | 155:8435094ec241 | 307 | |
mbed_official | 155:8435094ec241 | 308 | /* Set the Prescaler value */ |
mbed_official | 155:8435094ec241 | 309 | TIMx->PSC = TIM_TimeBaseInitStruct->TIM_Prescaler; |
mbed_official | 155:8435094ec241 | 310 | |
mbed_official | 155:8435094ec241 | 311 | if ((TIMx == TIM1) || (TIMx == TIM8)|| (TIMx == TIM15) || |
mbed_official | 155:8435094ec241 | 312 | (TIMx == TIM16) || (TIMx == TIM17)) |
mbed_official | 155:8435094ec241 | 313 | { |
mbed_official | 155:8435094ec241 | 314 | /* Set the Repetition Counter value */ |
mbed_official | 155:8435094ec241 | 315 | TIMx->RCR = TIM_TimeBaseInitStruct->TIM_RepetitionCounter; |
mbed_official | 155:8435094ec241 | 316 | } |
mbed_official | 155:8435094ec241 | 317 | |
mbed_official | 155:8435094ec241 | 318 | /* Generate an update event to reload the Prescaler |
mbed_official | 155:8435094ec241 | 319 | and the repetition counter(only for TIM1 and TIM8) value immediatly */ |
mbed_official | 155:8435094ec241 | 320 | TIMx->EGR = TIM_PSCReloadMode_Immediate; |
mbed_official | 155:8435094ec241 | 321 | } |
mbed_official | 155:8435094ec241 | 322 | |
mbed_official | 155:8435094ec241 | 323 | /** |
mbed_official | 155:8435094ec241 | 324 | * @brief Fills each TIM_TimeBaseInitStruct member with its default value. |
mbed_official | 155:8435094ec241 | 325 | * @param TIM_TimeBaseInitStruct : pointer to a TIM_TimeBaseInitTypeDef |
mbed_official | 155:8435094ec241 | 326 | * structure which will be initialized. |
mbed_official | 155:8435094ec241 | 327 | * @retval None |
mbed_official | 155:8435094ec241 | 328 | */ |
mbed_official | 155:8435094ec241 | 329 | void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct) |
mbed_official | 155:8435094ec241 | 330 | { |
mbed_official | 155:8435094ec241 | 331 | /* Set the default configuration */ |
mbed_official | 155:8435094ec241 | 332 | TIM_TimeBaseInitStruct->TIM_Period = 0xFFFFFFFF; |
mbed_official | 155:8435094ec241 | 333 | TIM_TimeBaseInitStruct->TIM_Prescaler = 0x0000; |
mbed_official | 155:8435094ec241 | 334 | TIM_TimeBaseInitStruct->TIM_ClockDivision = TIM_CKD_DIV1; |
mbed_official | 155:8435094ec241 | 335 | TIM_TimeBaseInitStruct->TIM_CounterMode = TIM_CounterMode_Up; |
mbed_official | 155:8435094ec241 | 336 | TIM_TimeBaseInitStruct->TIM_RepetitionCounter = 0x0000; |
mbed_official | 155:8435094ec241 | 337 | } |
mbed_official | 155:8435094ec241 | 338 | |
mbed_official | 155:8435094ec241 | 339 | /** |
mbed_official | 155:8435094ec241 | 340 | * @brief Configures the TIMx Prescaler. |
mbed_official | 155:8435094ec241 | 341 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 342 | * @param Prescaler: specifies the Prescaler Register value |
mbed_official | 155:8435094ec241 | 343 | * @param TIM_PSCReloadMode: specifies the TIM Prescaler Reload mode |
mbed_official | 155:8435094ec241 | 344 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 345 | * @arg TIM_PSCReloadMode_Update: The Prescaler is loaded at the update event. |
mbed_official | 155:8435094ec241 | 346 | * @arg TIM_PSCReloadMode_Immediate: The Prescaler is loaded immediatly. |
mbed_official | 155:8435094ec241 | 347 | * @retval None |
mbed_official | 155:8435094ec241 | 348 | */ |
mbed_official | 155:8435094ec241 | 349 | void TIM_PrescalerConfig(TIM_TypeDef* TIMx, uint16_t Prescaler, uint16_t TIM_PSCReloadMode) |
mbed_official | 155:8435094ec241 | 350 | { |
mbed_official | 155:8435094ec241 | 351 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 352 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 353 | assert_param(IS_TIM_PRESCALER_RELOAD(TIM_PSCReloadMode)); |
mbed_official | 155:8435094ec241 | 354 | /* Set the Prescaler value */ |
mbed_official | 155:8435094ec241 | 355 | TIMx->PSC = Prescaler; |
mbed_official | 155:8435094ec241 | 356 | /* Set or reset the UG Bit */ |
mbed_official | 155:8435094ec241 | 357 | TIMx->EGR = TIM_PSCReloadMode; |
mbed_official | 155:8435094ec241 | 358 | } |
mbed_official | 155:8435094ec241 | 359 | |
mbed_official | 155:8435094ec241 | 360 | /** |
mbed_official | 155:8435094ec241 | 361 | * @brief Specifies the TIMx Counter Mode to be used. |
mbed_official | 155:8435094ec241 | 362 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 363 | * @param TIM_CounterMode: specifies the Counter Mode to be used |
mbed_official | 155:8435094ec241 | 364 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 365 | * @arg TIM_CounterMode_Up: TIM Up Counting Mode |
mbed_official | 155:8435094ec241 | 366 | * @arg TIM_CounterMode_Down: TIM Down Counting Mode |
mbed_official | 155:8435094ec241 | 367 | * @arg TIM_CounterMode_CenterAligned1: TIM Center Aligned Mode1 |
mbed_official | 155:8435094ec241 | 368 | * @arg TIM_CounterMode_CenterAligned2: TIM Center Aligned Mode2 |
mbed_official | 155:8435094ec241 | 369 | * @arg TIM_CounterMode_CenterAligned3: TIM Center Aligned Mode3 |
mbed_official | 155:8435094ec241 | 370 | * @retval None |
mbed_official | 155:8435094ec241 | 371 | */ |
mbed_official | 155:8435094ec241 | 372 | void TIM_CounterModeConfig(TIM_TypeDef* TIMx, uint16_t TIM_CounterMode) |
mbed_official | 155:8435094ec241 | 373 | { |
mbed_official | 155:8435094ec241 | 374 | uint16_t tmpcr1 = 0; |
mbed_official | 155:8435094ec241 | 375 | |
mbed_official | 155:8435094ec241 | 376 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 377 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 378 | assert_param(IS_TIM_COUNTER_MODE(TIM_CounterMode)); |
mbed_official | 155:8435094ec241 | 379 | |
mbed_official | 155:8435094ec241 | 380 | tmpcr1 = TIMx->CR1; |
mbed_official | 155:8435094ec241 | 381 | |
mbed_official | 155:8435094ec241 | 382 | /* Reset the CMS and DIR Bits */ |
mbed_official | 155:8435094ec241 | 383 | tmpcr1 &= (uint16_t)~(TIM_CR1_DIR | TIM_CR1_CMS); |
mbed_official | 155:8435094ec241 | 384 | |
mbed_official | 155:8435094ec241 | 385 | /* Set the Counter Mode */ |
mbed_official | 155:8435094ec241 | 386 | tmpcr1 |= TIM_CounterMode; |
mbed_official | 155:8435094ec241 | 387 | |
mbed_official | 155:8435094ec241 | 388 | /* Write to TIMx CR1 register */ |
mbed_official | 155:8435094ec241 | 389 | TIMx->CR1 = tmpcr1; |
mbed_official | 155:8435094ec241 | 390 | } |
mbed_official | 155:8435094ec241 | 391 | |
mbed_official | 155:8435094ec241 | 392 | /** |
mbed_official | 155:8435094ec241 | 393 | * @brief Sets the TIMx Counter Register value |
mbed_official | 155:8435094ec241 | 394 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 395 | * @param Counter: specifies the Counter register new value. |
mbed_official | 155:8435094ec241 | 396 | * @retval None |
mbed_official | 155:8435094ec241 | 397 | */ |
mbed_official | 155:8435094ec241 | 398 | void TIM_SetCounter(TIM_TypeDef* TIMx, uint32_t Counter) |
mbed_official | 155:8435094ec241 | 399 | { |
mbed_official | 155:8435094ec241 | 400 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 401 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 402 | |
mbed_official | 155:8435094ec241 | 403 | /* Set the Counter Register value */ |
mbed_official | 155:8435094ec241 | 404 | TIMx->CNT = Counter; |
mbed_official | 155:8435094ec241 | 405 | } |
mbed_official | 155:8435094ec241 | 406 | |
mbed_official | 155:8435094ec241 | 407 | /** |
mbed_official | 155:8435094ec241 | 408 | * @brief Sets the TIMx Autoreload Register value |
mbed_official | 155:8435094ec241 | 409 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 410 | * @param Autoreload: specifies the Autoreload register new value. |
mbed_official | 155:8435094ec241 | 411 | * @retval None |
mbed_official | 155:8435094ec241 | 412 | */ |
mbed_official | 155:8435094ec241 | 413 | void TIM_SetAutoreload(TIM_TypeDef* TIMx, uint32_t Autoreload) |
mbed_official | 155:8435094ec241 | 414 | { |
mbed_official | 155:8435094ec241 | 415 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 416 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 417 | |
mbed_official | 155:8435094ec241 | 418 | /* Set the Autoreload Register value */ |
mbed_official | 155:8435094ec241 | 419 | TIMx->ARR = Autoreload; |
mbed_official | 155:8435094ec241 | 420 | } |
mbed_official | 155:8435094ec241 | 421 | |
mbed_official | 155:8435094ec241 | 422 | /** |
mbed_official | 155:8435094ec241 | 423 | * @brief Gets the TIMx Counter value. |
mbed_official | 155:8435094ec241 | 424 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 425 | * @retval Counter Register value |
mbed_official | 155:8435094ec241 | 426 | */ |
mbed_official | 155:8435094ec241 | 427 | uint32_t TIM_GetCounter(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 428 | { |
mbed_official | 155:8435094ec241 | 429 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 430 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 431 | |
mbed_official | 155:8435094ec241 | 432 | /* Get the Counter Register value */ |
mbed_official | 155:8435094ec241 | 433 | return TIMx->CNT; |
mbed_official | 155:8435094ec241 | 434 | } |
mbed_official | 155:8435094ec241 | 435 | |
mbed_official | 155:8435094ec241 | 436 | /** |
mbed_official | 155:8435094ec241 | 437 | * @brief Gets the TIMx Prescaler value. |
mbed_official | 155:8435094ec241 | 438 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 439 | * @retval Prescaler Register value. |
mbed_official | 155:8435094ec241 | 440 | */ |
mbed_official | 155:8435094ec241 | 441 | uint16_t TIM_GetPrescaler(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 442 | { |
mbed_official | 155:8435094ec241 | 443 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 444 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 445 | |
mbed_official | 155:8435094ec241 | 446 | /* Get the Prescaler Register value */ |
mbed_official | 155:8435094ec241 | 447 | return TIMx->PSC; |
mbed_official | 155:8435094ec241 | 448 | } |
mbed_official | 155:8435094ec241 | 449 | |
mbed_official | 155:8435094ec241 | 450 | /** |
mbed_official | 155:8435094ec241 | 451 | * @brief Enables or Disables the TIMx Update event. |
mbed_official | 155:8435094ec241 | 452 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 453 | * @param NewState: new state of the TIMx UDIS bit |
mbed_official | 155:8435094ec241 | 454 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 455 | * @retval None |
mbed_official | 155:8435094ec241 | 456 | */ |
mbed_official | 155:8435094ec241 | 457 | void TIM_UpdateDisableConfig(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 458 | { |
mbed_official | 155:8435094ec241 | 459 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 460 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 461 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 462 | |
mbed_official | 155:8435094ec241 | 463 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 464 | { |
mbed_official | 155:8435094ec241 | 465 | /* Set the Update Disable Bit */ |
mbed_official | 155:8435094ec241 | 466 | TIMx->CR1 |= TIM_CR1_UDIS; |
mbed_official | 155:8435094ec241 | 467 | } |
mbed_official | 155:8435094ec241 | 468 | else |
mbed_official | 155:8435094ec241 | 469 | { |
mbed_official | 155:8435094ec241 | 470 | /* Reset the Update Disable Bit */ |
mbed_official | 155:8435094ec241 | 471 | TIMx->CR1 &= (uint16_t)~TIM_CR1_UDIS; |
mbed_official | 155:8435094ec241 | 472 | } |
mbed_official | 155:8435094ec241 | 473 | } |
mbed_official | 155:8435094ec241 | 474 | |
mbed_official | 155:8435094ec241 | 475 | /** |
mbed_official | 155:8435094ec241 | 476 | * @brief Configures the TIMx Update Request Interrupt source. |
mbed_official | 155:8435094ec241 | 477 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 478 | * @param TIM_UpdateSource: specifies the Update source. |
mbed_official | 155:8435094ec241 | 479 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 480 | * @arg TIM_UpdateSource_Regular: Source of update is the counter |
mbed_official | 155:8435094ec241 | 481 | * overflow/underflow or the setting of UG bit, or an update |
mbed_official | 155:8435094ec241 | 482 | * generation through the slave mode controller. |
mbed_official | 155:8435094ec241 | 483 | * @arg TIM_UpdateSource_Global: Source of update is counter overflow/underflow. |
mbed_official | 155:8435094ec241 | 484 | * @retval None |
mbed_official | 155:8435094ec241 | 485 | */ |
mbed_official | 155:8435094ec241 | 486 | void TIM_UpdateRequestConfig(TIM_TypeDef* TIMx, uint16_t TIM_UpdateSource) |
mbed_official | 155:8435094ec241 | 487 | { |
mbed_official | 155:8435094ec241 | 488 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 489 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 490 | assert_param(IS_TIM_UPDATE_SOURCE(TIM_UpdateSource)); |
mbed_official | 155:8435094ec241 | 491 | |
mbed_official | 155:8435094ec241 | 492 | if (TIM_UpdateSource != TIM_UpdateSource_Global) |
mbed_official | 155:8435094ec241 | 493 | { |
mbed_official | 155:8435094ec241 | 494 | /* Set the URS Bit */ |
mbed_official | 155:8435094ec241 | 495 | TIMx->CR1 |= TIM_CR1_URS; |
mbed_official | 155:8435094ec241 | 496 | } |
mbed_official | 155:8435094ec241 | 497 | else |
mbed_official | 155:8435094ec241 | 498 | { |
mbed_official | 155:8435094ec241 | 499 | /* Reset the URS Bit */ |
mbed_official | 155:8435094ec241 | 500 | TIMx->CR1 &= (uint16_t)~TIM_CR1_URS; |
mbed_official | 155:8435094ec241 | 501 | } |
mbed_official | 155:8435094ec241 | 502 | } |
mbed_official | 155:8435094ec241 | 503 | |
mbed_official | 155:8435094ec241 | 504 | /** |
mbed_official | 155:8435094ec241 | 505 | * @brief Sets or resets the update interrupt flag (UIF)status bit Remapping. |
mbed_official | 155:8435094ec241 | 506 | * when sets, reading TIMx_CNT register returns UIF bit instead of CNT[31] |
mbed_official | 155:8435094ec241 | 507 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 508 | * @param NewState: new state of the UIFREMAP bit. |
mbed_official | 155:8435094ec241 | 509 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 510 | * @retval None |
mbed_official | 155:8435094ec241 | 511 | */ |
mbed_official | 155:8435094ec241 | 512 | void TIM_UIFRemap(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 513 | { |
mbed_official | 155:8435094ec241 | 514 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 515 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 516 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 517 | |
mbed_official | 155:8435094ec241 | 518 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 519 | { |
mbed_official | 155:8435094ec241 | 520 | /* Enable the TIM Counter */ |
mbed_official | 155:8435094ec241 | 521 | TIMx->CR1 |= TIM_CR1_UIFREMAP; |
mbed_official | 155:8435094ec241 | 522 | } |
mbed_official | 155:8435094ec241 | 523 | else |
mbed_official | 155:8435094ec241 | 524 | { |
mbed_official | 155:8435094ec241 | 525 | /* Disable the TIM Counter */ |
mbed_official | 155:8435094ec241 | 526 | TIMx->CR1 &= (uint16_t)~TIM_CR1_UIFREMAP; |
mbed_official | 155:8435094ec241 | 527 | } |
mbed_official | 155:8435094ec241 | 528 | } |
mbed_official | 155:8435094ec241 | 529 | |
mbed_official | 155:8435094ec241 | 530 | /** |
mbed_official | 155:8435094ec241 | 531 | * @brief Enables or disables TIMx peripheral Preload register on ARR. |
mbed_official | 155:8435094ec241 | 532 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 533 | * @param NewState: new state of the TIMx peripheral Preload register |
mbed_official | 155:8435094ec241 | 534 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 535 | * @retval None |
mbed_official | 155:8435094ec241 | 536 | */ |
mbed_official | 155:8435094ec241 | 537 | void TIM_ARRPreloadConfig(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 538 | { |
mbed_official | 155:8435094ec241 | 539 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 540 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 541 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 542 | |
mbed_official | 155:8435094ec241 | 543 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 544 | { |
mbed_official | 155:8435094ec241 | 545 | /* Set the ARR Preload Bit */ |
mbed_official | 155:8435094ec241 | 546 | TIMx->CR1 |= TIM_CR1_ARPE; |
mbed_official | 155:8435094ec241 | 547 | } |
mbed_official | 155:8435094ec241 | 548 | else |
mbed_official | 155:8435094ec241 | 549 | { |
mbed_official | 155:8435094ec241 | 550 | /* Reset the ARR Preload Bit */ |
mbed_official | 155:8435094ec241 | 551 | TIMx->CR1 &= (uint16_t)~TIM_CR1_ARPE; |
mbed_official | 155:8435094ec241 | 552 | } |
mbed_official | 155:8435094ec241 | 553 | } |
mbed_official | 155:8435094ec241 | 554 | |
mbed_official | 155:8435094ec241 | 555 | /** |
mbed_official | 155:8435094ec241 | 556 | * @brief Selects the TIMx's One Pulse Mode. |
mbed_official | 155:8435094ec241 | 557 | * @param TIMx: where x can be 1, 2, 3, 4, 6 ,7 ,8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 558 | * @param TIM_OPMode: specifies the OPM Mode to be used. |
mbed_official | 155:8435094ec241 | 559 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 560 | * @arg TIM_OPMode_Single |
mbed_official | 155:8435094ec241 | 561 | * @arg TIM_OPMode_Repetitive |
mbed_official | 155:8435094ec241 | 562 | * @retval None |
mbed_official | 155:8435094ec241 | 563 | */ |
mbed_official | 155:8435094ec241 | 564 | void TIM_SelectOnePulseMode(TIM_TypeDef* TIMx, uint16_t TIM_OPMode) |
mbed_official | 155:8435094ec241 | 565 | { |
mbed_official | 155:8435094ec241 | 566 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 567 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 568 | assert_param(IS_TIM_OPM_MODE(TIM_OPMode)); |
mbed_official | 155:8435094ec241 | 569 | |
mbed_official | 155:8435094ec241 | 570 | /* Reset the OPM Bit */ |
mbed_official | 155:8435094ec241 | 571 | TIMx->CR1 &= (uint16_t)~TIM_CR1_OPM; |
mbed_official | 155:8435094ec241 | 572 | |
mbed_official | 155:8435094ec241 | 573 | /* Configure the OPM Mode */ |
mbed_official | 155:8435094ec241 | 574 | TIMx->CR1 |= TIM_OPMode; |
mbed_official | 155:8435094ec241 | 575 | } |
mbed_official | 155:8435094ec241 | 576 | |
mbed_official | 155:8435094ec241 | 577 | /** |
mbed_official | 155:8435094ec241 | 578 | * @brief Sets the TIMx Clock Division value. |
mbed_official | 155:8435094ec241 | 579 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17, to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 580 | * @param TIM_CKD: specifies the clock division value. |
mbed_official | 155:8435094ec241 | 581 | * This parameter can be one of the following value: |
mbed_official | 155:8435094ec241 | 582 | * @arg TIM_CKD_DIV1: TDTS = Tck_tim |
mbed_official | 155:8435094ec241 | 583 | * @arg TIM_CKD_DIV2: TDTS = 2*Tck_tim |
mbed_official | 155:8435094ec241 | 584 | * @arg TIM_CKD_DIV4: TDTS = 4*Tck_tim |
mbed_official | 155:8435094ec241 | 585 | * @retval None |
mbed_official | 155:8435094ec241 | 586 | */ |
mbed_official | 155:8435094ec241 | 587 | void TIM_SetClockDivision(TIM_TypeDef* TIMx, uint16_t TIM_CKD) |
mbed_official | 155:8435094ec241 | 588 | { |
mbed_official | 155:8435094ec241 | 589 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 590 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 591 | assert_param(IS_TIM_CKD_DIV(TIM_CKD)); |
mbed_official | 155:8435094ec241 | 592 | |
mbed_official | 155:8435094ec241 | 593 | /* Reset the CKD Bits */ |
mbed_official | 155:8435094ec241 | 594 | TIMx->CR1 &= (uint16_t)(~TIM_CR1_CKD); |
mbed_official | 155:8435094ec241 | 595 | |
mbed_official | 155:8435094ec241 | 596 | /* Set the CKD value */ |
mbed_official | 155:8435094ec241 | 597 | TIMx->CR1 |= TIM_CKD; |
mbed_official | 155:8435094ec241 | 598 | } |
mbed_official | 155:8435094ec241 | 599 | |
mbed_official | 155:8435094ec241 | 600 | /** |
mbed_official | 155:8435094ec241 | 601 | * @brief Enables or disables the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 602 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select |
mbed_official | 155:8435094ec241 | 603 | * the TIMx peripheral. |
mbed_official | 155:8435094ec241 | 604 | * @param NewState: new state of the TIMx peripheral. |
mbed_official | 155:8435094ec241 | 605 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 606 | * @retval None |
mbed_official | 155:8435094ec241 | 607 | */ |
mbed_official | 155:8435094ec241 | 608 | void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 609 | { |
mbed_official | 155:8435094ec241 | 610 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 611 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 612 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 613 | |
mbed_official | 155:8435094ec241 | 614 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 615 | { |
mbed_official | 155:8435094ec241 | 616 | /* Enable the TIM Counter */ |
mbed_official | 155:8435094ec241 | 617 | TIMx->CR1 |= TIM_CR1_CEN; |
mbed_official | 155:8435094ec241 | 618 | } |
mbed_official | 155:8435094ec241 | 619 | else |
mbed_official | 155:8435094ec241 | 620 | { |
mbed_official | 155:8435094ec241 | 621 | /* Disable the TIM Counter */ |
mbed_official | 155:8435094ec241 | 622 | TIMx->CR1 &= (uint16_t)~TIM_CR1_CEN; |
mbed_official | 155:8435094ec241 | 623 | } |
mbed_official | 155:8435094ec241 | 624 | } |
mbed_official | 155:8435094ec241 | 625 | /** |
mbed_official | 155:8435094ec241 | 626 | * @} |
mbed_official | 155:8435094ec241 | 627 | */ |
mbed_official | 155:8435094ec241 | 628 | |
mbed_official | 155:8435094ec241 | 629 | /** @defgroup TIM_Group2 Output Compare management functions |
mbed_official | 155:8435094ec241 | 630 | * @brief Output Compare management functions |
mbed_official | 155:8435094ec241 | 631 | * |
mbed_official | 155:8435094ec241 | 632 | @verbatim |
mbed_official | 155:8435094ec241 | 633 | =============================================================================== |
mbed_official | 155:8435094ec241 | 634 | ##### Output Compare management functions ##### |
mbed_official | 155:8435094ec241 | 635 | =============================================================================== |
mbed_official | 155:8435094ec241 | 636 | |
mbed_official | 155:8435094ec241 | 637 | *** TIM Driver: how to use it in Output Compare Mode *** |
mbed_official | 155:8435094ec241 | 638 | ======================================================== |
mbed_official | 155:8435094ec241 | 639 | [..] |
mbed_official | 155:8435094ec241 | 640 | To use the Timer in Output Compare mode, the following steps are mandatory: |
mbed_official | 155:8435094ec241 | 641 | |
mbed_official | 155:8435094ec241 | 642 | (#) Enable TIM clock using RCC_APBxPeriphClockCmd(RCC_APBxPeriph_TIMx, ENABLE) function |
mbed_official | 155:8435094ec241 | 643 | |
mbed_official | 155:8435094ec241 | 644 | (#) Configure the TIM pins by configuring the corresponding GPIO pins |
mbed_official | 155:8435094ec241 | 645 | |
mbed_official | 155:8435094ec241 | 646 | (#) Configure the Time base unit as described in the first part of this driver, |
mbed_official | 155:8435094ec241 | 647 | if needed, else the Timer will run with the default configuration: |
mbed_official | 155:8435094ec241 | 648 | (++) Autoreload value = 0xFFFF |
mbed_official | 155:8435094ec241 | 649 | (++) Prescaler value = 0x0000 |
mbed_official | 155:8435094ec241 | 650 | (++) Counter mode = Up counting |
mbed_official | 155:8435094ec241 | 651 | (++) Clock Division = TIM_CKD_DIV1 |
mbed_official | 155:8435094ec241 | 652 | (#) Fill the TIM_OCInitStruct with the desired parameters including: |
mbed_official | 155:8435094ec241 | 653 | (++) The TIM Output Compare mode: TIM_OCMode |
mbed_official | 155:8435094ec241 | 654 | (++) TIM Output State: TIM_OutputState |
mbed_official | 155:8435094ec241 | 655 | (++) TIM Pulse value: TIM_Pulse |
mbed_official | 155:8435094ec241 | 656 | (++) TIM Output Compare Polarity : TIM_OCPolarity |
mbed_official | 155:8435094ec241 | 657 | |
mbed_official | 155:8435094ec241 | 658 | (#) Call TIM_OCxInit(TIMx, &TIM_OCInitStruct) to configure the desired channel with the |
mbed_official | 155:8435094ec241 | 659 | corresponding configuration |
mbed_official | 155:8435094ec241 | 660 | |
mbed_official | 155:8435094ec241 | 661 | (#) Call the TIM_Cmd(ENABLE) function to enable the TIM counter. |
mbed_official | 155:8435094ec241 | 662 | [..] |
mbed_official | 155:8435094ec241 | 663 | (@) All other functions can be used separately to modify, if needed, |
mbed_official | 155:8435094ec241 | 664 | a specific feature of the Timer. |
mbed_official | 155:8435094ec241 | 665 | |
mbed_official | 155:8435094ec241 | 666 | (@) In case of PWM mode, this function is mandatory: |
mbed_official | 155:8435094ec241 | 667 | TIM_OCxPreloadConfig(TIMx, TIM_OCPreload_ENABLE); |
mbed_official | 155:8435094ec241 | 668 | |
mbed_official | 155:8435094ec241 | 669 | (@) If the corresponding interrupt or DMA request are needed, the user should: |
mbed_official | 155:8435094ec241 | 670 | (#@) Enable the NVIC (or the DMA) to use the TIM interrupts (or DMA requests). |
mbed_official | 155:8435094ec241 | 671 | (#@) Enable the corresponding interrupt (or DMA request) using the function |
mbed_official | 155:8435094ec241 | 672 | TIM_ITConfig(TIMx, TIM_IT_CCx) (or TIM_DMA_Cmd(TIMx, TIM_DMA_CCx)) |
mbed_official | 155:8435094ec241 | 673 | |
mbed_official | 155:8435094ec241 | 674 | @endverbatim |
mbed_official | 155:8435094ec241 | 675 | * @{ |
mbed_official | 155:8435094ec241 | 676 | */ |
mbed_official | 155:8435094ec241 | 677 | |
mbed_official | 155:8435094ec241 | 678 | /** |
mbed_official | 155:8435094ec241 | 679 | * @brief Initializes the TIMx Channel1 according to the specified parameters in |
mbed_official | 155:8435094ec241 | 680 | * the TIM_OCInitStruct. |
mbed_official | 155:8435094ec241 | 681 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17, to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 682 | * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 683 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 684 | * @retval None |
mbed_official | 155:8435094ec241 | 685 | */ |
mbed_official | 155:8435094ec241 | 686 | void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) |
mbed_official | 155:8435094ec241 | 687 | { |
mbed_official | 155:8435094ec241 | 688 | uint32_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0; |
mbed_official | 155:8435094ec241 | 689 | |
mbed_official | 155:8435094ec241 | 690 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 691 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 692 | assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->TIM_OCMode)); |
mbed_official | 155:8435094ec241 | 693 | assert_param(IS_TIM_OUTPUT_STATE(TIM_OCInitStruct->TIM_OutputState)); |
mbed_official | 155:8435094ec241 | 694 | assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 695 | |
mbed_official | 155:8435094ec241 | 696 | /* Disable the Channel 1: Reset the CC1E Bit */ |
mbed_official | 155:8435094ec241 | 697 | TIMx->CCER &= (uint32_t)~TIM_CCER_CC1E; |
mbed_official | 155:8435094ec241 | 698 | |
mbed_official | 155:8435094ec241 | 699 | /* Get the TIMx CCER register value */ |
mbed_official | 155:8435094ec241 | 700 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 701 | /* Get the TIMx CR2 register value */ |
mbed_official | 155:8435094ec241 | 702 | tmpcr2 = TIMx->CR2; |
mbed_official | 155:8435094ec241 | 703 | |
mbed_official | 155:8435094ec241 | 704 | /* Get the TIMx CCMR1 register value */ |
mbed_official | 155:8435094ec241 | 705 | tmpccmrx = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 706 | |
mbed_official | 155:8435094ec241 | 707 | /* Reset the Output Compare Mode Bits */ |
mbed_official | 155:8435094ec241 | 708 | tmpccmrx &= (uint32_t)~TIM_CCMR1_OC1M; |
mbed_official | 155:8435094ec241 | 709 | tmpccmrx &= (uint32_t)~TIM_CCMR1_CC1S; |
mbed_official | 155:8435094ec241 | 710 | /* Select the Output Compare Mode */ |
mbed_official | 155:8435094ec241 | 711 | tmpccmrx |= TIM_OCInitStruct->TIM_OCMode; |
mbed_official | 155:8435094ec241 | 712 | |
mbed_official | 155:8435094ec241 | 713 | /* Reset the Output Polarity level */ |
mbed_official | 155:8435094ec241 | 714 | tmpccer &= (uint32_t)~TIM_CCER_CC1P; |
mbed_official | 155:8435094ec241 | 715 | /* Set the Output Compare Polarity */ |
mbed_official | 155:8435094ec241 | 716 | tmpccer |= TIM_OCInitStruct->TIM_OCPolarity; |
mbed_official | 155:8435094ec241 | 717 | |
mbed_official | 155:8435094ec241 | 718 | /* Set the Output State */ |
mbed_official | 155:8435094ec241 | 719 | tmpccer |= TIM_OCInitStruct->TIM_OutputState; |
mbed_official | 155:8435094ec241 | 720 | |
mbed_official | 155:8435094ec241 | 721 | if((TIMx == TIM1) || (TIMx == TIM8) || (TIMx == TIM15) || (TIMx == TIM16) || (TIMx == TIM17)) |
mbed_official | 155:8435094ec241 | 722 | { |
mbed_official | 155:8435094ec241 | 723 | assert_param(IS_TIM_OUTPUTN_STATE(TIM_OCInitStruct->TIM_OutputNState)); |
mbed_official | 155:8435094ec241 | 724 | assert_param(IS_TIM_OCN_POLARITY(TIM_OCInitStruct->TIM_OCNPolarity)); |
mbed_official | 155:8435094ec241 | 725 | assert_param(IS_TIM_OCNIDLE_STATE(TIM_OCInitStruct->TIM_OCNIdleState)); |
mbed_official | 155:8435094ec241 | 726 | assert_param(IS_TIM_OCIDLE_STATE(TIM_OCInitStruct->TIM_OCIdleState)); |
mbed_official | 155:8435094ec241 | 727 | |
mbed_official | 155:8435094ec241 | 728 | /* Reset the Output N Polarity level */ |
mbed_official | 155:8435094ec241 | 729 | tmpccer &= (uint32_t)~TIM_CCER_CC1NP; |
mbed_official | 155:8435094ec241 | 730 | /* Set the Output N Polarity */ |
mbed_official | 155:8435094ec241 | 731 | tmpccer |= TIM_OCInitStruct->TIM_OCNPolarity; |
mbed_official | 155:8435094ec241 | 732 | /* Reset the Output N State */ |
mbed_official | 155:8435094ec241 | 733 | tmpccer &= (uint32_t)~TIM_CCER_CC1NE; |
mbed_official | 155:8435094ec241 | 734 | |
mbed_official | 155:8435094ec241 | 735 | /* Set the Output N State */ |
mbed_official | 155:8435094ec241 | 736 | tmpccer |= TIM_OCInitStruct->TIM_OutputNState; |
mbed_official | 155:8435094ec241 | 737 | /* Reset the Output Compare and Output Compare N IDLE State */ |
mbed_official | 155:8435094ec241 | 738 | tmpcr2 &= (uint32_t)~TIM_CR2_OIS1; |
mbed_official | 155:8435094ec241 | 739 | tmpcr2 &= (uint32_t)~TIM_CR2_OIS1N; |
mbed_official | 155:8435094ec241 | 740 | /* Set the Output Idle state */ |
mbed_official | 155:8435094ec241 | 741 | tmpcr2 |= TIM_OCInitStruct->TIM_OCIdleState; |
mbed_official | 155:8435094ec241 | 742 | /* Set the Output N Idle state */ |
mbed_official | 155:8435094ec241 | 743 | tmpcr2 |= TIM_OCInitStruct->TIM_OCNIdleState; |
mbed_official | 155:8435094ec241 | 744 | } |
mbed_official | 155:8435094ec241 | 745 | /* Write to TIMx CR2 */ |
mbed_official | 155:8435094ec241 | 746 | TIMx->CR2 = tmpcr2; |
mbed_official | 155:8435094ec241 | 747 | |
mbed_official | 155:8435094ec241 | 748 | /* Write to TIMx CCMR1 */ |
mbed_official | 155:8435094ec241 | 749 | TIMx->CCMR1 = tmpccmrx; |
mbed_official | 155:8435094ec241 | 750 | |
mbed_official | 155:8435094ec241 | 751 | /* Set the Capture Compare Register value */ |
mbed_official | 155:8435094ec241 | 752 | TIMx->CCR1 = TIM_OCInitStruct->TIM_Pulse; |
mbed_official | 155:8435094ec241 | 753 | |
mbed_official | 155:8435094ec241 | 754 | /* Write to TIMx CCER */ |
mbed_official | 155:8435094ec241 | 755 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 756 | } |
mbed_official | 155:8435094ec241 | 757 | |
mbed_official | 155:8435094ec241 | 758 | /** |
mbed_official | 155:8435094ec241 | 759 | * @brief Initializes the TIMx Channel2 according to the specified parameters |
mbed_official | 155:8435094ec241 | 760 | * in the TIM_OCInitStruct. |
mbed_official | 155:8435094ec241 | 761 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 762 | * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 763 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 764 | * @retval None |
mbed_official | 155:8435094ec241 | 765 | */ |
mbed_official | 155:8435094ec241 | 766 | void TIM_OC2Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) |
mbed_official | 155:8435094ec241 | 767 | { |
mbed_official | 155:8435094ec241 | 768 | uint32_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0; |
mbed_official | 155:8435094ec241 | 769 | |
mbed_official | 155:8435094ec241 | 770 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 771 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 772 | assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->TIM_OCMode)); |
mbed_official | 155:8435094ec241 | 773 | assert_param(IS_TIM_OUTPUT_STATE(TIM_OCInitStruct->TIM_OutputState)); |
mbed_official | 155:8435094ec241 | 774 | assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 775 | |
mbed_official | 155:8435094ec241 | 776 | /* Disable the Channel 2: Reset the CC2E Bit */ |
mbed_official | 155:8435094ec241 | 777 | TIMx->CCER &= (uint32_t)~TIM_CCER_CC2E; |
mbed_official | 155:8435094ec241 | 778 | |
mbed_official | 155:8435094ec241 | 779 | /* Get the TIMx CCER register value */ |
mbed_official | 155:8435094ec241 | 780 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 781 | /* Get the TIMx CR2 register value */ |
mbed_official | 155:8435094ec241 | 782 | tmpcr2 = TIMx->CR2; |
mbed_official | 155:8435094ec241 | 783 | |
mbed_official | 155:8435094ec241 | 784 | /* Get the TIMx CCMR1 register value */ |
mbed_official | 155:8435094ec241 | 785 | tmpccmrx = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 786 | |
mbed_official | 155:8435094ec241 | 787 | /* Reset the Output Compare mode and Capture/Compare selection Bits */ |
mbed_official | 155:8435094ec241 | 788 | tmpccmrx &= (uint32_t)~TIM_CCMR1_OC2M; |
mbed_official | 155:8435094ec241 | 789 | tmpccmrx &= (uint32_t)~TIM_CCMR1_CC2S; |
mbed_official | 155:8435094ec241 | 790 | |
mbed_official | 155:8435094ec241 | 791 | /* Select the Output Compare Mode */ |
mbed_official | 155:8435094ec241 | 792 | tmpccmrx |= (uint32_t)(TIM_OCInitStruct->TIM_OCMode << 8); |
mbed_official | 155:8435094ec241 | 793 | |
mbed_official | 155:8435094ec241 | 794 | /* Reset the Output Polarity level */ |
mbed_official | 155:8435094ec241 | 795 | tmpccer &= (uint32_t)~TIM_CCER_CC2P; |
mbed_official | 155:8435094ec241 | 796 | /* Set the Output Compare Polarity */ |
mbed_official | 155:8435094ec241 | 797 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCPolarity << 4); |
mbed_official | 155:8435094ec241 | 798 | |
mbed_official | 155:8435094ec241 | 799 | /* Set the Output State */ |
mbed_official | 155:8435094ec241 | 800 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OutputState << 4); |
mbed_official | 155:8435094ec241 | 801 | |
mbed_official | 155:8435094ec241 | 802 | if((TIMx == TIM1) || (TIMx == TIM8)) |
mbed_official | 155:8435094ec241 | 803 | { |
mbed_official | 155:8435094ec241 | 804 | assert_param(IS_TIM_OUTPUTN_STATE(TIM_OCInitStruct->TIM_OutputNState)); |
mbed_official | 155:8435094ec241 | 805 | assert_param(IS_TIM_OCN_POLARITY(TIM_OCInitStruct->TIM_OCNPolarity)); |
mbed_official | 155:8435094ec241 | 806 | assert_param(IS_TIM_OCNIDLE_STATE(TIM_OCInitStruct->TIM_OCNIdleState)); |
mbed_official | 155:8435094ec241 | 807 | assert_param(IS_TIM_OCIDLE_STATE(TIM_OCInitStruct->TIM_OCIdleState)); |
mbed_official | 155:8435094ec241 | 808 | |
mbed_official | 155:8435094ec241 | 809 | /* Reset the Output N Polarity level */ |
mbed_official | 155:8435094ec241 | 810 | tmpccer &= (uint32_t)~TIM_CCER_CC2NP; |
mbed_official | 155:8435094ec241 | 811 | /* Set the Output N Polarity */ |
mbed_official | 155:8435094ec241 | 812 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCNPolarity << 4); |
mbed_official | 155:8435094ec241 | 813 | /* Reset the Output N State */ |
mbed_official | 155:8435094ec241 | 814 | tmpccer &= (uint32_t)~TIM_CCER_CC2NE; |
mbed_official | 155:8435094ec241 | 815 | |
mbed_official | 155:8435094ec241 | 816 | /* Set the Output N State */ |
mbed_official | 155:8435094ec241 | 817 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OutputNState << 4); |
mbed_official | 155:8435094ec241 | 818 | /* Reset the Output Compare and Output Compare N IDLE State */ |
mbed_official | 155:8435094ec241 | 819 | tmpcr2 &= (uint32_t)~TIM_CR2_OIS2; |
mbed_official | 155:8435094ec241 | 820 | tmpcr2 &= (uint32_t)~TIM_CR2_OIS2N; |
mbed_official | 155:8435094ec241 | 821 | /* Set the Output Idle state */ |
mbed_official | 155:8435094ec241 | 822 | tmpcr2 |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCIdleState << 2); |
mbed_official | 155:8435094ec241 | 823 | /* Set the Output N Idle state */ |
mbed_official | 155:8435094ec241 | 824 | tmpcr2 |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCNIdleState << 2); |
mbed_official | 155:8435094ec241 | 825 | } |
mbed_official | 155:8435094ec241 | 826 | /* Write to TIMx CR2 */ |
mbed_official | 155:8435094ec241 | 827 | TIMx->CR2 = tmpcr2; |
mbed_official | 155:8435094ec241 | 828 | |
mbed_official | 155:8435094ec241 | 829 | /* Write to TIMx CCMR1 */ |
mbed_official | 155:8435094ec241 | 830 | TIMx->CCMR1 = tmpccmrx; |
mbed_official | 155:8435094ec241 | 831 | |
mbed_official | 155:8435094ec241 | 832 | /* Set the Capture Compare Register value */ |
mbed_official | 155:8435094ec241 | 833 | TIMx->CCR2 = TIM_OCInitStruct->TIM_Pulse; |
mbed_official | 155:8435094ec241 | 834 | |
mbed_official | 155:8435094ec241 | 835 | /* Write to TIMx CCER */ |
mbed_official | 155:8435094ec241 | 836 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 837 | } |
mbed_official | 155:8435094ec241 | 838 | |
mbed_official | 155:8435094ec241 | 839 | /** |
mbed_official | 155:8435094ec241 | 840 | * @brief Initializes the TIMx Channel3 according to the specified parameters |
mbed_official | 155:8435094ec241 | 841 | * in the TIM_OCInitStruct. |
mbed_official | 155:8435094ec241 | 842 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 843 | * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 844 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 845 | * @retval None |
mbed_official | 155:8435094ec241 | 846 | */ |
mbed_official | 155:8435094ec241 | 847 | void TIM_OC3Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) |
mbed_official | 155:8435094ec241 | 848 | { |
mbed_official | 155:8435094ec241 | 849 | uint32_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0; |
mbed_official | 155:8435094ec241 | 850 | |
mbed_official | 155:8435094ec241 | 851 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 852 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 853 | assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->TIM_OCMode)); |
mbed_official | 155:8435094ec241 | 854 | assert_param(IS_TIM_OUTPUT_STATE(TIM_OCInitStruct->TIM_OutputState)); |
mbed_official | 155:8435094ec241 | 855 | assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 856 | |
mbed_official | 155:8435094ec241 | 857 | /* Disable the Channel 3: Reset the CC2E Bit */ |
mbed_official | 155:8435094ec241 | 858 | TIMx->CCER &= (uint32_t)~TIM_CCER_CC3E; |
mbed_official | 155:8435094ec241 | 859 | |
mbed_official | 155:8435094ec241 | 860 | /* Get the TIMx CCER register value */ |
mbed_official | 155:8435094ec241 | 861 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 862 | /* Get the TIMx CR2 register value */ |
mbed_official | 155:8435094ec241 | 863 | tmpcr2 = TIMx->CR2; |
mbed_official | 155:8435094ec241 | 864 | |
mbed_official | 155:8435094ec241 | 865 | /* Get the TIMx CCMR2 register value */ |
mbed_official | 155:8435094ec241 | 866 | tmpccmrx = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 867 | |
mbed_official | 155:8435094ec241 | 868 | /* Reset the Output Compare mode and Capture/Compare selection Bits */ |
mbed_official | 155:8435094ec241 | 869 | tmpccmrx &= (uint32_t)~TIM_CCMR2_OC3M; |
mbed_official | 155:8435094ec241 | 870 | tmpccmrx &= (uint32_t)~TIM_CCMR2_CC3S; |
mbed_official | 155:8435094ec241 | 871 | /* Select the Output Compare Mode */ |
mbed_official | 155:8435094ec241 | 872 | tmpccmrx |= TIM_OCInitStruct->TIM_OCMode; |
mbed_official | 155:8435094ec241 | 873 | |
mbed_official | 155:8435094ec241 | 874 | /* Reset the Output Polarity level */ |
mbed_official | 155:8435094ec241 | 875 | tmpccer &= (uint32_t)~TIM_CCER_CC3P; |
mbed_official | 155:8435094ec241 | 876 | /* Set the Output Compare Polarity */ |
mbed_official | 155:8435094ec241 | 877 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCPolarity << 8); |
mbed_official | 155:8435094ec241 | 878 | |
mbed_official | 155:8435094ec241 | 879 | /* Set the Output State */ |
mbed_official | 155:8435094ec241 | 880 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OutputState << 8); |
mbed_official | 155:8435094ec241 | 881 | |
mbed_official | 155:8435094ec241 | 882 | if((TIMx == TIM1) || (TIMx == TIM8)) |
mbed_official | 155:8435094ec241 | 883 | { |
mbed_official | 155:8435094ec241 | 884 | assert_param(IS_TIM_OUTPUTN_STATE(TIM_OCInitStruct->TIM_OutputNState)); |
mbed_official | 155:8435094ec241 | 885 | assert_param(IS_TIM_OCN_POLARITY(TIM_OCInitStruct->TIM_OCNPolarity)); |
mbed_official | 155:8435094ec241 | 886 | assert_param(IS_TIM_OCNIDLE_STATE(TIM_OCInitStruct->TIM_OCNIdleState)); |
mbed_official | 155:8435094ec241 | 887 | assert_param(IS_TIM_OCIDLE_STATE(TIM_OCInitStruct->TIM_OCIdleState)); |
mbed_official | 155:8435094ec241 | 888 | |
mbed_official | 155:8435094ec241 | 889 | /* Reset the Output N Polarity level */ |
mbed_official | 155:8435094ec241 | 890 | tmpccer &= (uint32_t)~TIM_CCER_CC3NP; |
mbed_official | 155:8435094ec241 | 891 | /* Set the Output N Polarity */ |
mbed_official | 155:8435094ec241 | 892 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCNPolarity << 8); |
mbed_official | 155:8435094ec241 | 893 | /* Reset the Output N State */ |
mbed_official | 155:8435094ec241 | 894 | tmpccer &= (uint32_t)~TIM_CCER_CC3NE; |
mbed_official | 155:8435094ec241 | 895 | |
mbed_official | 155:8435094ec241 | 896 | /* Set the Output N State */ |
mbed_official | 155:8435094ec241 | 897 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OutputNState << 8); |
mbed_official | 155:8435094ec241 | 898 | /* Reset the Output Compare and Output Compare N IDLE State */ |
mbed_official | 155:8435094ec241 | 899 | tmpcr2 &= (uint32_t)~TIM_CR2_OIS3; |
mbed_official | 155:8435094ec241 | 900 | tmpcr2 &= (uint32_t)~TIM_CR2_OIS3N; |
mbed_official | 155:8435094ec241 | 901 | /* Set the Output Idle state */ |
mbed_official | 155:8435094ec241 | 902 | tmpcr2 |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCIdleState << 4); |
mbed_official | 155:8435094ec241 | 903 | /* Set the Output N Idle state */ |
mbed_official | 155:8435094ec241 | 904 | tmpcr2 |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCNIdleState << 4); |
mbed_official | 155:8435094ec241 | 905 | } |
mbed_official | 155:8435094ec241 | 906 | /* Write to TIMx CR2 */ |
mbed_official | 155:8435094ec241 | 907 | TIMx->CR2 = tmpcr2; |
mbed_official | 155:8435094ec241 | 908 | |
mbed_official | 155:8435094ec241 | 909 | /* Write to TIMx CCMR2 */ |
mbed_official | 155:8435094ec241 | 910 | TIMx->CCMR2 = tmpccmrx; |
mbed_official | 155:8435094ec241 | 911 | |
mbed_official | 155:8435094ec241 | 912 | /* Set the Capture Compare Register value */ |
mbed_official | 155:8435094ec241 | 913 | TIMx->CCR3 = TIM_OCInitStruct->TIM_Pulse; |
mbed_official | 155:8435094ec241 | 914 | |
mbed_official | 155:8435094ec241 | 915 | /* Write to TIMx CCER */ |
mbed_official | 155:8435094ec241 | 916 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 917 | } |
mbed_official | 155:8435094ec241 | 918 | |
mbed_official | 155:8435094ec241 | 919 | /** |
mbed_official | 155:8435094ec241 | 920 | * @brief Initializes the TIMx Channel4 according to the specified parameters |
mbed_official | 155:8435094ec241 | 921 | * in the TIM_OCInitStruct. |
mbed_official | 155:8435094ec241 | 922 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 923 | * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 924 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 925 | * @retval None |
mbed_official | 155:8435094ec241 | 926 | */ |
mbed_official | 155:8435094ec241 | 927 | void TIM_OC4Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) |
mbed_official | 155:8435094ec241 | 928 | { |
mbed_official | 155:8435094ec241 | 929 | uint32_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0; |
mbed_official | 155:8435094ec241 | 930 | |
mbed_official | 155:8435094ec241 | 931 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 932 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 933 | assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->TIM_OCMode)); |
mbed_official | 155:8435094ec241 | 934 | assert_param(IS_TIM_OUTPUT_STATE(TIM_OCInitStruct->TIM_OutputState)); |
mbed_official | 155:8435094ec241 | 935 | assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 936 | |
mbed_official | 155:8435094ec241 | 937 | /* Disable the Channel 4: Reset the CC4E Bit */ |
mbed_official | 155:8435094ec241 | 938 | TIMx->CCER &= (uint32_t)~TIM_CCER_CC4E; |
mbed_official | 155:8435094ec241 | 939 | |
mbed_official | 155:8435094ec241 | 940 | /* Get the TIMx CCER register value */ |
mbed_official | 155:8435094ec241 | 941 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 942 | /* Get the TIMx CR2 register value */ |
mbed_official | 155:8435094ec241 | 943 | tmpcr2 = TIMx->CR2; |
mbed_official | 155:8435094ec241 | 944 | |
mbed_official | 155:8435094ec241 | 945 | /* Get the TIMx CCMR2 register value */ |
mbed_official | 155:8435094ec241 | 946 | tmpccmrx = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 947 | |
mbed_official | 155:8435094ec241 | 948 | /* Reset the Output Compare mode and Capture/Compare selection Bits */ |
mbed_official | 155:8435094ec241 | 949 | tmpccmrx &= (uint32_t)~TIM_CCMR2_OC4M; |
mbed_official | 155:8435094ec241 | 950 | tmpccmrx &= (uint32_t)~TIM_CCMR2_CC4S; |
mbed_official | 155:8435094ec241 | 951 | |
mbed_official | 155:8435094ec241 | 952 | /* Select the Output Compare Mode */ |
mbed_official | 155:8435094ec241 | 953 | tmpccmrx |= (uint32_t)(TIM_OCInitStruct->TIM_OCMode << 8); |
mbed_official | 155:8435094ec241 | 954 | |
mbed_official | 155:8435094ec241 | 955 | /* Reset the Output Polarity level */ |
mbed_official | 155:8435094ec241 | 956 | tmpccer &= (uint32_t)~TIM_CCER_CC4P; |
mbed_official | 155:8435094ec241 | 957 | /* Set the Output Compare Polarity */ |
mbed_official | 155:8435094ec241 | 958 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCPolarity << 12); |
mbed_official | 155:8435094ec241 | 959 | |
mbed_official | 155:8435094ec241 | 960 | /* Set the Output State */ |
mbed_official | 155:8435094ec241 | 961 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OutputState << 12); |
mbed_official | 155:8435094ec241 | 962 | |
mbed_official | 155:8435094ec241 | 963 | if((TIMx == TIM1) || (TIMx == TIM8)) |
mbed_official | 155:8435094ec241 | 964 | { |
mbed_official | 155:8435094ec241 | 965 | assert_param(IS_TIM_OCIDLE_STATE(TIM_OCInitStruct->TIM_OCIdleState)); |
mbed_official | 155:8435094ec241 | 966 | /* Reset the Output Compare IDLE State */ |
mbed_official | 155:8435094ec241 | 967 | tmpcr2 &=(uint32_t) ~TIM_CR2_OIS4; |
mbed_official | 155:8435094ec241 | 968 | /* Set the Output Idle state */ |
mbed_official | 155:8435094ec241 | 969 | tmpcr2 |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCIdleState << 6); |
mbed_official | 155:8435094ec241 | 970 | } |
mbed_official | 155:8435094ec241 | 971 | /* Write to TIMx CR2 */ |
mbed_official | 155:8435094ec241 | 972 | TIMx->CR2 = tmpcr2; |
mbed_official | 155:8435094ec241 | 973 | |
mbed_official | 155:8435094ec241 | 974 | /* Write to TIMx CCMR2 */ |
mbed_official | 155:8435094ec241 | 975 | TIMx->CCMR2 = tmpccmrx; |
mbed_official | 155:8435094ec241 | 976 | |
mbed_official | 155:8435094ec241 | 977 | /* Set the Capture Compare Register value */ |
mbed_official | 155:8435094ec241 | 978 | TIMx->CCR4 = TIM_OCInitStruct->TIM_Pulse; |
mbed_official | 155:8435094ec241 | 979 | |
mbed_official | 155:8435094ec241 | 980 | /* Write to TIMx CCER */ |
mbed_official | 155:8435094ec241 | 981 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 982 | } |
mbed_official | 155:8435094ec241 | 983 | |
mbed_official | 155:8435094ec241 | 984 | /** |
mbed_official | 155:8435094ec241 | 985 | * @brief Initializes the TIMx Channel5 according to the specified parameters |
mbed_official | 155:8435094ec241 | 986 | * in the TIM_OCInitStruct. |
mbed_official | 155:8435094ec241 | 987 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 988 | * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 989 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 990 | * @retval None |
mbed_official | 155:8435094ec241 | 991 | */ |
mbed_official | 155:8435094ec241 | 992 | void TIM_OC5Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) |
mbed_official | 155:8435094ec241 | 993 | { |
mbed_official | 155:8435094ec241 | 994 | uint32_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0; |
mbed_official | 155:8435094ec241 | 995 | |
mbed_official | 155:8435094ec241 | 996 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 997 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 998 | assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->TIM_OCMode)); |
mbed_official | 155:8435094ec241 | 999 | assert_param(IS_TIM_OUTPUT_STATE(TIM_OCInitStruct->TIM_OutputState)); |
mbed_official | 155:8435094ec241 | 1000 | assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 1001 | |
mbed_official | 155:8435094ec241 | 1002 | /* Disable the Channel 5: Reset the CC5E Bit */ |
mbed_official | 155:8435094ec241 | 1003 | TIMx->CCER &= (uint32_t)~TIM_CCER_CC5E; /* to be verified*/ |
mbed_official | 155:8435094ec241 | 1004 | |
mbed_official | 155:8435094ec241 | 1005 | /* Get the TIMx CCER register value */ |
mbed_official | 155:8435094ec241 | 1006 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 1007 | /* Get the TIMx CR2 register value */ |
mbed_official | 155:8435094ec241 | 1008 | tmpcr2 = TIMx->CR2; |
mbed_official | 155:8435094ec241 | 1009 | |
mbed_official | 155:8435094ec241 | 1010 | /* Get the TIMx CCMR3 register value */ |
mbed_official | 155:8435094ec241 | 1011 | tmpccmrx = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 1012 | |
mbed_official | 155:8435094ec241 | 1013 | /* Reset the Output Compare mode and Capture/Compare selection Bits */ |
mbed_official | 155:8435094ec241 | 1014 | tmpccmrx &= (uint32_t)~TIM_CCMR3_OC5M; |
mbed_official | 155:8435094ec241 | 1015 | |
mbed_official | 155:8435094ec241 | 1016 | /* Select the Output Compare Mode */ |
mbed_official | 155:8435094ec241 | 1017 | tmpccmrx |= (uint32_t)(TIM_OCInitStruct->TIM_OCMode); |
mbed_official | 155:8435094ec241 | 1018 | |
mbed_official | 155:8435094ec241 | 1019 | /* Reset the Output Polarity level */ |
mbed_official | 155:8435094ec241 | 1020 | tmpccer &= (uint32_t)~TIM_CCER_CC5P; |
mbed_official | 155:8435094ec241 | 1021 | /* Set the Output Compare Polarity */ |
mbed_official | 155:8435094ec241 | 1022 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCPolarity << 16); |
mbed_official | 155:8435094ec241 | 1023 | |
mbed_official | 155:8435094ec241 | 1024 | /* Set the Output State */ |
mbed_official | 155:8435094ec241 | 1025 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OutputState << 16); |
mbed_official | 155:8435094ec241 | 1026 | |
mbed_official | 155:8435094ec241 | 1027 | if((TIMx == TIM1) || (TIMx == TIM8)) |
mbed_official | 155:8435094ec241 | 1028 | { |
mbed_official | 155:8435094ec241 | 1029 | assert_param(IS_TIM_OCIDLE_STATE(TIM_OCInitStruct->TIM_OCIdleState)); |
mbed_official | 155:8435094ec241 | 1030 | /* Reset the Output Compare IDLE State */ |
mbed_official | 155:8435094ec241 | 1031 | tmpcr2 &=(uint32_t) ~TIM_CR2_OIS5; |
mbed_official | 155:8435094ec241 | 1032 | /* Set the Output Idle state */ |
mbed_official | 155:8435094ec241 | 1033 | tmpcr2 |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCIdleState << 16); |
mbed_official | 155:8435094ec241 | 1034 | } |
mbed_official | 155:8435094ec241 | 1035 | /* Write to TIMx CR2 */ |
mbed_official | 155:8435094ec241 | 1036 | TIMx->CR2 = tmpcr2; |
mbed_official | 155:8435094ec241 | 1037 | |
mbed_official | 155:8435094ec241 | 1038 | /* Write to TIMx CCMR2 */ |
mbed_official | 155:8435094ec241 | 1039 | TIMx->CCMR3 = tmpccmrx; |
mbed_official | 155:8435094ec241 | 1040 | |
mbed_official | 155:8435094ec241 | 1041 | /* Set the Capture Compare Register value */ |
mbed_official | 155:8435094ec241 | 1042 | TIMx->CCR5 = TIM_OCInitStruct->TIM_Pulse; |
mbed_official | 155:8435094ec241 | 1043 | |
mbed_official | 155:8435094ec241 | 1044 | /* Write to TIMx CCER */ |
mbed_official | 155:8435094ec241 | 1045 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 1046 | } |
mbed_official | 155:8435094ec241 | 1047 | |
mbed_official | 155:8435094ec241 | 1048 | /** |
mbed_official | 155:8435094ec241 | 1049 | * @brief Initializes the TIMx Channel6 according to the specified parameters |
mbed_official | 155:8435094ec241 | 1050 | * in the TIM_OCInitStruct. |
mbed_official | 155:8435094ec241 | 1051 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1052 | * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 1053 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 1054 | * @retval None |
mbed_official | 155:8435094ec241 | 1055 | */ |
mbed_official | 155:8435094ec241 | 1056 | void TIM_OC6Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) |
mbed_official | 155:8435094ec241 | 1057 | { |
mbed_official | 155:8435094ec241 | 1058 | uint32_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0; |
mbed_official | 155:8435094ec241 | 1059 | |
mbed_official | 155:8435094ec241 | 1060 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1061 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1062 | assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->TIM_OCMode)); |
mbed_official | 155:8435094ec241 | 1063 | assert_param(IS_TIM_OUTPUT_STATE(TIM_OCInitStruct->TIM_OutputState)); |
mbed_official | 155:8435094ec241 | 1064 | assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 1065 | |
mbed_official | 155:8435094ec241 | 1066 | /* Disable the Channel 5: Reset the CC5E Bit */ |
mbed_official | 155:8435094ec241 | 1067 | TIMx->CCER &= (uint32_t)~TIM_CCER_CC6E; /* to be verified*/ |
mbed_official | 155:8435094ec241 | 1068 | |
mbed_official | 155:8435094ec241 | 1069 | /* Get the TIMx CCER register value */ |
mbed_official | 155:8435094ec241 | 1070 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 1071 | /* Get the TIMx CR2 register value */ |
mbed_official | 155:8435094ec241 | 1072 | tmpcr2 = TIMx->CR2; |
mbed_official | 155:8435094ec241 | 1073 | |
mbed_official | 155:8435094ec241 | 1074 | /* Get the TIMx CCMR3 register value */ |
mbed_official | 155:8435094ec241 | 1075 | tmpccmrx = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 1076 | |
mbed_official | 155:8435094ec241 | 1077 | /* Reset the Output Compare mode and Capture/Compare selection Bits */ |
mbed_official | 155:8435094ec241 | 1078 | tmpccmrx &= (uint32_t)~TIM_CCMR3_OC6M; |
mbed_official | 155:8435094ec241 | 1079 | |
mbed_official | 155:8435094ec241 | 1080 | /* Select the Output Compare Mode */ |
mbed_official | 155:8435094ec241 | 1081 | tmpccmrx |= (uint32_t)(TIM_OCInitStruct->TIM_OCMode << 8); |
mbed_official | 155:8435094ec241 | 1082 | |
mbed_official | 155:8435094ec241 | 1083 | /* Reset the Output Polarity level */ |
mbed_official | 155:8435094ec241 | 1084 | tmpccer &= (uint32_t)~TIM_CCER_CC6P; |
mbed_official | 155:8435094ec241 | 1085 | /* Set the Output Compare Polarity */ |
mbed_official | 155:8435094ec241 | 1086 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OCPolarity << 20); |
mbed_official | 155:8435094ec241 | 1087 | |
mbed_official | 155:8435094ec241 | 1088 | /* Set the Output State */ |
mbed_official | 155:8435094ec241 | 1089 | tmpccer |= (uint32_t)((uint32_t)TIM_OCInitStruct->TIM_OutputState << 20); |
mbed_official | 155:8435094ec241 | 1090 | |
mbed_official | 155:8435094ec241 | 1091 | if((TIMx == TIM1) || (TIMx == TIM8)) |
mbed_official | 155:8435094ec241 | 1092 | { |
mbed_official | 155:8435094ec241 | 1093 | assert_param(IS_TIM_OCIDLE_STATE(TIM_OCInitStruct->TIM_OCIdleState)); |
mbed_official | 155:8435094ec241 | 1094 | /* Reset the Output Compare IDLE State */ |
mbed_official | 155:8435094ec241 | 1095 | tmpcr2 &=(uint32_t) ~TIM_CR2_OIS6; |
mbed_official | 155:8435094ec241 | 1096 | /* Set the Output Idle state */ |
mbed_official | 155:8435094ec241 | 1097 | tmpcr2 |= (uint16_t)(TIM_OCInitStruct->TIM_OCIdleState << 18); |
mbed_official | 155:8435094ec241 | 1098 | } |
mbed_official | 155:8435094ec241 | 1099 | /* Write to TIMx CR2 */ |
mbed_official | 155:8435094ec241 | 1100 | TIMx->CR2 = tmpcr2; |
mbed_official | 155:8435094ec241 | 1101 | |
mbed_official | 155:8435094ec241 | 1102 | /* Write to TIMx CCMR2 */ |
mbed_official | 155:8435094ec241 | 1103 | TIMx->CCMR3 = tmpccmrx; |
mbed_official | 155:8435094ec241 | 1104 | |
mbed_official | 155:8435094ec241 | 1105 | /* Set the Capture Compare Register value */ |
mbed_official | 155:8435094ec241 | 1106 | TIMx->CCR6 = TIM_OCInitStruct->TIM_Pulse; |
mbed_official | 155:8435094ec241 | 1107 | |
mbed_official | 155:8435094ec241 | 1108 | /* Write to TIMx CCER */ |
mbed_official | 155:8435094ec241 | 1109 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 1110 | } |
mbed_official | 155:8435094ec241 | 1111 | |
mbed_official | 155:8435094ec241 | 1112 | /** |
mbed_official | 155:8435094ec241 | 1113 | * @brief Selects the TIM Group Channel 5 and Channel 1, |
mbed_official | 155:8435094ec241 | 1114 | OC1REFC is the logical AND of OC1REFC and OC5REF. |
mbed_official | 155:8435094ec241 | 1115 | * @param TIMx: where x can be 1 or 8 to select the TIMx peripheral |
mbed_official | 155:8435094ec241 | 1116 | * @param NewState: new state of the Commutation event. |
mbed_official | 155:8435094ec241 | 1117 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 1118 | * @retval None |
mbed_official | 155:8435094ec241 | 1119 | */ |
mbed_official | 155:8435094ec241 | 1120 | void TIM_SelectGC5C1(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 1121 | { |
mbed_official | 155:8435094ec241 | 1122 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1123 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1124 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 1125 | |
mbed_official | 155:8435094ec241 | 1126 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 1127 | { |
mbed_official | 155:8435094ec241 | 1128 | /* Set the GC5C1 Bit */ |
mbed_official | 155:8435094ec241 | 1129 | TIMx->CCR5 |= TIM_CCR5_GC5C1; |
mbed_official | 155:8435094ec241 | 1130 | } |
mbed_official | 155:8435094ec241 | 1131 | else |
mbed_official | 155:8435094ec241 | 1132 | { |
mbed_official | 155:8435094ec241 | 1133 | /* Reset the GC5C1 Bit */ |
mbed_official | 155:8435094ec241 | 1134 | TIMx->CCR5 &= (uint32_t)~TIM_CCR5_GC5C1; |
mbed_official | 155:8435094ec241 | 1135 | } |
mbed_official | 155:8435094ec241 | 1136 | } |
mbed_official | 155:8435094ec241 | 1137 | |
mbed_official | 155:8435094ec241 | 1138 | /** |
mbed_official | 155:8435094ec241 | 1139 | * @brief Selects the TIM Group Channel 5 and Channel 2, |
mbed_official | 155:8435094ec241 | 1140 | OC2REFC is the logical AND of OC2REFC and OC5REF. |
mbed_official | 155:8435094ec241 | 1141 | * @param TIMx: where x can be 1 or 8 to select the TIMx peripheral |
mbed_official | 155:8435094ec241 | 1142 | * @param NewState: new state of the Commutation event. |
mbed_official | 155:8435094ec241 | 1143 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 1144 | * @retval None |
mbed_official | 155:8435094ec241 | 1145 | */ |
mbed_official | 155:8435094ec241 | 1146 | void TIM_SelectGC5C2(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 1147 | { |
mbed_official | 155:8435094ec241 | 1148 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1149 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1150 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 1151 | |
mbed_official | 155:8435094ec241 | 1152 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 1153 | { |
mbed_official | 155:8435094ec241 | 1154 | /* Set the GC5C2 Bit */ |
mbed_official | 155:8435094ec241 | 1155 | TIMx->CCR5 |= TIM_CCR5_GC5C2; |
mbed_official | 155:8435094ec241 | 1156 | } |
mbed_official | 155:8435094ec241 | 1157 | else |
mbed_official | 155:8435094ec241 | 1158 | { |
mbed_official | 155:8435094ec241 | 1159 | /* Reset the GC5C2 Bit */ |
mbed_official | 155:8435094ec241 | 1160 | TIMx->CCR5 &= (uint32_t)~TIM_CCR5_GC5C2; |
mbed_official | 155:8435094ec241 | 1161 | } |
mbed_official | 155:8435094ec241 | 1162 | } |
mbed_official | 155:8435094ec241 | 1163 | |
mbed_official | 155:8435094ec241 | 1164 | |
mbed_official | 155:8435094ec241 | 1165 | /** |
mbed_official | 155:8435094ec241 | 1166 | * @brief Selects the TIM Group Channel 5 and Channel 3, |
mbed_official | 155:8435094ec241 | 1167 | OC3REFC is the logical AND of OC3REFC and OC5REF. |
mbed_official | 155:8435094ec241 | 1168 | * @param TIMx: where x can be 1 or 8 to select the TIMx peripheral |
mbed_official | 155:8435094ec241 | 1169 | * @param NewState: new state of the Commutation event. |
mbed_official | 155:8435094ec241 | 1170 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 1171 | * @retval None |
mbed_official | 155:8435094ec241 | 1172 | */ |
mbed_official | 155:8435094ec241 | 1173 | void TIM_SelectGC5C3(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 1174 | { |
mbed_official | 155:8435094ec241 | 1175 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1176 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1177 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 1178 | |
mbed_official | 155:8435094ec241 | 1179 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 1180 | { |
mbed_official | 155:8435094ec241 | 1181 | /* Set the GC5C3 Bit */ |
mbed_official | 155:8435094ec241 | 1182 | TIMx->CCR5 |= TIM_CCR5_GC5C3; |
mbed_official | 155:8435094ec241 | 1183 | } |
mbed_official | 155:8435094ec241 | 1184 | else |
mbed_official | 155:8435094ec241 | 1185 | { |
mbed_official | 155:8435094ec241 | 1186 | /* Reset the GC5C3 Bit */ |
mbed_official | 155:8435094ec241 | 1187 | TIMx->CCR5 &= (uint32_t)~TIM_CCR5_GC5C3; |
mbed_official | 155:8435094ec241 | 1188 | } |
mbed_official | 155:8435094ec241 | 1189 | } |
mbed_official | 155:8435094ec241 | 1190 | |
mbed_official | 155:8435094ec241 | 1191 | /** |
mbed_official | 155:8435094ec241 | 1192 | * @brief Fills each TIM_OCInitStruct member with its default value. |
mbed_official | 155:8435094ec241 | 1193 | * @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure which will |
mbed_official | 155:8435094ec241 | 1194 | * be initialized. |
mbed_official | 155:8435094ec241 | 1195 | * @retval None |
mbed_official | 155:8435094ec241 | 1196 | */ |
mbed_official | 155:8435094ec241 | 1197 | void TIM_OCStructInit(TIM_OCInitTypeDef* TIM_OCInitStruct) |
mbed_official | 155:8435094ec241 | 1198 | { |
mbed_official | 155:8435094ec241 | 1199 | /* Set the default configuration */ |
mbed_official | 155:8435094ec241 | 1200 | TIM_OCInitStruct->TIM_OCMode = TIM_OCMode_Timing; |
mbed_official | 155:8435094ec241 | 1201 | TIM_OCInitStruct->TIM_OutputState = TIM_OutputState_Disable; |
mbed_official | 155:8435094ec241 | 1202 | TIM_OCInitStruct->TIM_OutputNState = TIM_OutputNState_Disable; |
mbed_official | 155:8435094ec241 | 1203 | TIM_OCInitStruct->TIM_Pulse = 0x00000000; |
mbed_official | 155:8435094ec241 | 1204 | TIM_OCInitStruct->TIM_OCPolarity = TIM_OCPolarity_High; |
mbed_official | 155:8435094ec241 | 1205 | TIM_OCInitStruct->TIM_OCNPolarity = TIM_OCPolarity_High; |
mbed_official | 155:8435094ec241 | 1206 | TIM_OCInitStruct->TIM_OCIdleState = TIM_OCIdleState_Reset; |
mbed_official | 155:8435094ec241 | 1207 | TIM_OCInitStruct->TIM_OCNIdleState = TIM_OCNIdleState_Reset; |
mbed_official | 155:8435094ec241 | 1208 | } |
mbed_official | 155:8435094ec241 | 1209 | |
mbed_official | 155:8435094ec241 | 1210 | /** |
mbed_official | 155:8435094ec241 | 1211 | * @brief Selects the TIM Output Compare Mode. |
mbed_official | 155:8435094ec241 | 1212 | * @note This function disables the selected channel before changing the Output |
mbed_official | 155:8435094ec241 | 1213 | * Compare Mode. If needed, user has to enable this channel using |
mbed_official | 155:8435094ec241 | 1214 | * TIM_CCxCmd() and TIM_CCxNCmd() functions. |
mbed_official | 155:8435094ec241 | 1215 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1216 | * @param TIM_Channel: specifies the TIM Channel |
mbed_official | 155:8435094ec241 | 1217 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1218 | * @arg TIM_Channel_1: TIM Channel 1 |
mbed_official | 155:8435094ec241 | 1219 | * @arg TIM_Channel_2: TIM Channel 2 |
mbed_official | 155:8435094ec241 | 1220 | * @arg TIM_Channel_3: TIM Channel 3 |
mbed_official | 155:8435094ec241 | 1221 | * @arg TIM_Channel_4: TIM Channel 4 |
mbed_official | 155:8435094ec241 | 1222 | * @param TIM_OCMode: specifies the TIM Output Compare Mode. |
mbed_official | 155:8435094ec241 | 1223 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1224 | * @arg TIM_OCMode_Timing |
mbed_official | 155:8435094ec241 | 1225 | * @arg TIM_OCMode_Active |
mbed_official | 155:8435094ec241 | 1226 | * @arg TIM_OCMode_Toggle |
mbed_official | 155:8435094ec241 | 1227 | * @arg TIM_OCMode_PWM1 |
mbed_official | 155:8435094ec241 | 1228 | * @arg TIM_OCMode_PWM2 |
mbed_official | 155:8435094ec241 | 1229 | * @arg TIM_ForcedAction_Active |
mbed_official | 155:8435094ec241 | 1230 | * @arg TIM_ForcedAction_InActive |
mbed_official | 155:8435094ec241 | 1231 | * @arg TIM_OCMode_Retrigerrable_OPM1 |
mbed_official | 155:8435094ec241 | 1232 | * @arg TIM_OCMode_Retrigerrable_OPM2 |
mbed_official | 155:8435094ec241 | 1233 | * @arg TIM_OCMode_Combined_PWM1 |
mbed_official | 155:8435094ec241 | 1234 | * @arg TIM_OCMode_Combined_PWM2 |
mbed_official | 155:8435094ec241 | 1235 | * @arg TIM_OCMode_Asymmetric_PWM1 |
mbed_official | 155:8435094ec241 | 1236 | * @arg TIM_OCMode_Asymmetric_PWM2 |
mbed_official | 155:8435094ec241 | 1237 | * @retval None |
mbed_official | 155:8435094ec241 | 1238 | */ |
mbed_official | 155:8435094ec241 | 1239 | void TIM_SelectOCxM(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint32_t TIM_OCMode) |
mbed_official | 155:8435094ec241 | 1240 | { |
mbed_official | 155:8435094ec241 | 1241 | uint32_t tmp = 0; |
mbed_official | 155:8435094ec241 | 1242 | uint16_t tmp1 = 0; |
mbed_official | 155:8435094ec241 | 1243 | |
mbed_official | 155:8435094ec241 | 1244 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1245 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1246 | assert_param(IS_TIM_CHANNEL(TIM_Channel)); |
mbed_official | 155:8435094ec241 | 1247 | assert_param(IS_TIM_OCM(TIM_OCMode)); |
mbed_official | 155:8435094ec241 | 1248 | |
mbed_official | 155:8435094ec241 | 1249 | tmp = (uint32_t) TIMx; |
mbed_official | 155:8435094ec241 | 1250 | tmp += CCMR_OFFSET; |
mbed_official | 155:8435094ec241 | 1251 | |
mbed_official | 155:8435094ec241 | 1252 | tmp1 = CCER_CCE_SET << (uint16_t)TIM_Channel; |
mbed_official | 155:8435094ec241 | 1253 | |
mbed_official | 155:8435094ec241 | 1254 | /* Disable the Channel: Reset the CCxE Bit */ |
mbed_official | 155:8435094ec241 | 1255 | TIMx->CCER &= (uint16_t) ~tmp1; |
mbed_official | 155:8435094ec241 | 1256 | |
mbed_official | 155:8435094ec241 | 1257 | if((TIM_Channel == TIM_Channel_1) ||(TIM_Channel == TIM_Channel_3)) |
mbed_official | 155:8435094ec241 | 1258 | { |
mbed_official | 155:8435094ec241 | 1259 | tmp += (TIM_Channel>>1); |
mbed_official | 155:8435094ec241 | 1260 | |
mbed_official | 155:8435094ec241 | 1261 | /* Reset the OCxM bits in the CCMRx register */ |
mbed_official | 155:8435094ec241 | 1262 | *(__IO uint32_t *) tmp &= CCMR_OC13M_MASK; |
mbed_official | 155:8435094ec241 | 1263 | |
mbed_official | 155:8435094ec241 | 1264 | /* Configure the OCxM bits in the CCMRx register */ |
mbed_official | 155:8435094ec241 | 1265 | *(__IO uint32_t *) tmp |= TIM_OCMode; |
mbed_official | 155:8435094ec241 | 1266 | } |
mbed_official | 155:8435094ec241 | 1267 | else |
mbed_official | 155:8435094ec241 | 1268 | { |
mbed_official | 155:8435094ec241 | 1269 | tmp += (uint32_t)(TIM_Channel - (uint32_t)4)>> (uint32_t)1; |
mbed_official | 155:8435094ec241 | 1270 | |
mbed_official | 155:8435094ec241 | 1271 | /* Reset the OCxM bits in the CCMRx register */ |
mbed_official | 155:8435094ec241 | 1272 | *(__IO uint32_t *) tmp &= CCMR_OC24M_MASK; |
mbed_official | 155:8435094ec241 | 1273 | |
mbed_official | 155:8435094ec241 | 1274 | /* Configure the OCxM bits in the CCMRx register */ |
mbed_official | 155:8435094ec241 | 1275 | *(__IO uint32_t *) tmp |= (uint32_t)(TIM_OCMode << 8); |
mbed_official | 155:8435094ec241 | 1276 | } |
mbed_official | 155:8435094ec241 | 1277 | } |
mbed_official | 155:8435094ec241 | 1278 | |
mbed_official | 155:8435094ec241 | 1279 | /** |
mbed_official | 155:8435094ec241 | 1280 | * @brief Sets the TIMx Capture Compare1 Register value |
mbed_official | 155:8435094ec241 | 1281 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1282 | * @param Compare1: specifies the Capture Compare1 register new value. |
mbed_official | 155:8435094ec241 | 1283 | * @retval None |
mbed_official | 155:8435094ec241 | 1284 | */ |
mbed_official | 155:8435094ec241 | 1285 | void TIM_SetCompare1(TIM_TypeDef* TIMx, uint32_t Compare1) |
mbed_official | 155:8435094ec241 | 1286 | { |
mbed_official | 155:8435094ec241 | 1287 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1288 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1289 | |
mbed_official | 155:8435094ec241 | 1290 | /* Set the Capture Compare1 Register value */ |
mbed_official | 155:8435094ec241 | 1291 | TIMx->CCR1 = Compare1; |
mbed_official | 155:8435094ec241 | 1292 | } |
mbed_official | 155:8435094ec241 | 1293 | |
mbed_official | 155:8435094ec241 | 1294 | /** |
mbed_official | 155:8435094ec241 | 1295 | * @brief Sets the TIMx Capture Compare2 Register value |
mbed_official | 155:8435094ec241 | 1296 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 1297 | * peripheral. |
mbed_official | 155:8435094ec241 | 1298 | * @param Compare2: specifies the Capture Compare2 register new value. |
mbed_official | 155:8435094ec241 | 1299 | * @retval None |
mbed_official | 155:8435094ec241 | 1300 | */ |
mbed_official | 155:8435094ec241 | 1301 | void TIM_SetCompare2(TIM_TypeDef* TIMx, uint32_t Compare2) |
mbed_official | 155:8435094ec241 | 1302 | { |
mbed_official | 155:8435094ec241 | 1303 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1304 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1305 | |
mbed_official | 155:8435094ec241 | 1306 | /* Set the Capture Compare2 Register value */ |
mbed_official | 155:8435094ec241 | 1307 | TIMx->CCR2 = Compare2; |
mbed_official | 155:8435094ec241 | 1308 | } |
mbed_official | 155:8435094ec241 | 1309 | |
mbed_official | 155:8435094ec241 | 1310 | /** |
mbed_official | 155:8435094ec241 | 1311 | * @brief Sets the TIMx Capture Compare3 Register value |
mbed_official | 155:8435094ec241 | 1312 | * @param TIMx: where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1313 | * @param Compare3: specifies the Capture Compare3 register new value. |
mbed_official | 155:8435094ec241 | 1314 | * @retval None |
mbed_official | 155:8435094ec241 | 1315 | */ |
mbed_official | 155:8435094ec241 | 1316 | void TIM_SetCompare3(TIM_TypeDef* TIMx, uint32_t Compare3) |
mbed_official | 155:8435094ec241 | 1317 | { |
mbed_official | 155:8435094ec241 | 1318 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1319 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1320 | |
mbed_official | 155:8435094ec241 | 1321 | /* Set the Capture Compare3 Register value */ |
mbed_official | 155:8435094ec241 | 1322 | TIMx->CCR3 = Compare3; |
mbed_official | 155:8435094ec241 | 1323 | } |
mbed_official | 155:8435094ec241 | 1324 | |
mbed_official | 155:8435094ec241 | 1325 | /** |
mbed_official | 155:8435094ec241 | 1326 | * @brief Sets the TIMx Capture Compare4 Register value |
mbed_official | 155:8435094ec241 | 1327 | * @param TIMx: where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1328 | * @param Compare4: specifies the Capture Compare4 register new value. |
mbed_official | 155:8435094ec241 | 1329 | * @retval None |
mbed_official | 155:8435094ec241 | 1330 | */ |
mbed_official | 155:8435094ec241 | 1331 | void TIM_SetCompare4(TIM_TypeDef* TIMx, uint32_t Compare4) |
mbed_official | 155:8435094ec241 | 1332 | { |
mbed_official | 155:8435094ec241 | 1333 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1334 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1335 | |
mbed_official | 155:8435094ec241 | 1336 | /* Set the Capture Compare4 Register value */ |
mbed_official | 155:8435094ec241 | 1337 | TIMx->CCR4 = Compare4; |
mbed_official | 155:8435094ec241 | 1338 | } |
mbed_official | 155:8435094ec241 | 1339 | |
mbed_official | 155:8435094ec241 | 1340 | /** |
mbed_official | 155:8435094ec241 | 1341 | * @brief Sets the TIMx Capture Compare5 Register value |
mbed_official | 155:8435094ec241 | 1342 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1343 | * @param Compare5: specifies the Capture Compare5 register new value. |
mbed_official | 155:8435094ec241 | 1344 | * @retval None |
mbed_official | 155:8435094ec241 | 1345 | */ |
mbed_official | 155:8435094ec241 | 1346 | void TIM_SetCompare5(TIM_TypeDef* TIMx, uint32_t Compare5) |
mbed_official | 155:8435094ec241 | 1347 | { |
mbed_official | 155:8435094ec241 | 1348 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1349 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1350 | |
mbed_official | 155:8435094ec241 | 1351 | /* Set the Capture Compare5 Register value */ |
mbed_official | 155:8435094ec241 | 1352 | TIMx->CCR5 = Compare5; |
mbed_official | 155:8435094ec241 | 1353 | } |
mbed_official | 155:8435094ec241 | 1354 | |
mbed_official | 155:8435094ec241 | 1355 | /** |
mbed_official | 155:8435094ec241 | 1356 | * @brief Sets the TIMx Capture Compare6 Register value |
mbed_official | 155:8435094ec241 | 1357 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1358 | * @param Compare6: specifies the Capture Compare5 register new value. |
mbed_official | 155:8435094ec241 | 1359 | * @retval None |
mbed_official | 155:8435094ec241 | 1360 | */ |
mbed_official | 155:8435094ec241 | 1361 | void TIM_SetCompare6(TIM_TypeDef* TIMx, uint32_t Compare6) |
mbed_official | 155:8435094ec241 | 1362 | { |
mbed_official | 155:8435094ec241 | 1363 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1364 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1365 | |
mbed_official | 155:8435094ec241 | 1366 | /* Set the Capture Compare6 Register value */ |
mbed_official | 155:8435094ec241 | 1367 | TIMx->CCR6 = Compare6; |
mbed_official | 155:8435094ec241 | 1368 | } |
mbed_official | 155:8435094ec241 | 1369 | |
mbed_official | 155:8435094ec241 | 1370 | /** |
mbed_official | 155:8435094ec241 | 1371 | * @brief Forces the TIMx output 1 waveform to active or inactive level. |
mbed_official | 155:8435094ec241 | 1372 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1373 | * @param TIM_ForcedAction: specifies the forced Action to be set to the output waveform. |
mbed_official | 155:8435094ec241 | 1374 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1375 | * @arg TIM_ForcedAction_Active: Force active level on OC1REF |
mbed_official | 155:8435094ec241 | 1376 | * @arg TIM_ForcedAction_InActive: Force inactive level on OC1REF. |
mbed_official | 155:8435094ec241 | 1377 | * @retval None |
mbed_official | 155:8435094ec241 | 1378 | */ |
mbed_official | 155:8435094ec241 | 1379 | void TIM_ForcedOC1Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction) |
mbed_official | 155:8435094ec241 | 1380 | { |
mbed_official | 155:8435094ec241 | 1381 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1382 | |
mbed_official | 155:8435094ec241 | 1383 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1384 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1385 | assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); |
mbed_official | 155:8435094ec241 | 1386 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1387 | |
mbed_official | 155:8435094ec241 | 1388 | /* Reset the OC1M Bits */ |
mbed_official | 155:8435094ec241 | 1389 | tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC1M; |
mbed_official | 155:8435094ec241 | 1390 | |
mbed_official | 155:8435094ec241 | 1391 | /* Configure The Forced output Mode */ |
mbed_official | 155:8435094ec241 | 1392 | tmpccmr1 |= TIM_ForcedAction; |
mbed_official | 155:8435094ec241 | 1393 | |
mbed_official | 155:8435094ec241 | 1394 | /* Write to TIMx CCMR1 register */ |
mbed_official | 155:8435094ec241 | 1395 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1396 | } |
mbed_official | 155:8435094ec241 | 1397 | |
mbed_official | 155:8435094ec241 | 1398 | /** |
mbed_official | 155:8435094ec241 | 1399 | * @brief Forces the TIMx output 2 waveform to active or inactive level. |
mbed_official | 155:8435094ec241 | 1400 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 1401 | * peripheral. |
mbed_official | 155:8435094ec241 | 1402 | * @param TIM_ForcedAction: specifies the forced Action to be set to the output waveform. |
mbed_official | 155:8435094ec241 | 1403 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1404 | * @arg TIM_ForcedAction_Active: Force active level on OC2REF |
mbed_official | 155:8435094ec241 | 1405 | * @arg TIM_ForcedAction_InActive: Force inactive level on OC2REF. |
mbed_official | 155:8435094ec241 | 1406 | * @retval None |
mbed_official | 155:8435094ec241 | 1407 | */ |
mbed_official | 155:8435094ec241 | 1408 | void TIM_ForcedOC2Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction) |
mbed_official | 155:8435094ec241 | 1409 | { |
mbed_official | 155:8435094ec241 | 1410 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1411 | |
mbed_official | 155:8435094ec241 | 1412 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1413 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1414 | assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); |
mbed_official | 155:8435094ec241 | 1415 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1416 | |
mbed_official | 155:8435094ec241 | 1417 | /* Reset the OC2M Bits */ |
mbed_official | 155:8435094ec241 | 1418 | tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC2M; |
mbed_official | 155:8435094ec241 | 1419 | |
mbed_official | 155:8435094ec241 | 1420 | /* Configure The Forced output Mode */ |
mbed_official | 155:8435094ec241 | 1421 | tmpccmr1 |= ((uint32_t)TIM_ForcedAction << 8); |
mbed_official | 155:8435094ec241 | 1422 | |
mbed_official | 155:8435094ec241 | 1423 | /* Write to TIMx CCMR1 register */ |
mbed_official | 155:8435094ec241 | 1424 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1425 | } |
mbed_official | 155:8435094ec241 | 1426 | |
mbed_official | 155:8435094ec241 | 1427 | /** |
mbed_official | 155:8435094ec241 | 1428 | * @brief Forces the TIMx output 3 waveform to active or inactive level. |
mbed_official | 155:8435094ec241 | 1429 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1430 | * @param TIM_ForcedAction: specifies the forced Action to be set to the output waveform. |
mbed_official | 155:8435094ec241 | 1431 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1432 | * @arg TIM_ForcedAction_Active: Force active level on OC3REF |
mbed_official | 155:8435094ec241 | 1433 | * @arg TIM_ForcedAction_InActive: Force inactive level on OC3REF. |
mbed_official | 155:8435094ec241 | 1434 | * @retval None |
mbed_official | 155:8435094ec241 | 1435 | */ |
mbed_official | 155:8435094ec241 | 1436 | void TIM_ForcedOC3Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction) |
mbed_official | 155:8435094ec241 | 1437 | { |
mbed_official | 155:8435094ec241 | 1438 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1439 | |
mbed_official | 155:8435094ec241 | 1440 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1441 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1442 | assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); |
mbed_official | 155:8435094ec241 | 1443 | |
mbed_official | 155:8435094ec241 | 1444 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1445 | |
mbed_official | 155:8435094ec241 | 1446 | /* Reset the OC1M Bits */ |
mbed_official | 155:8435094ec241 | 1447 | tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC3M; |
mbed_official | 155:8435094ec241 | 1448 | |
mbed_official | 155:8435094ec241 | 1449 | /* Configure The Forced output Mode */ |
mbed_official | 155:8435094ec241 | 1450 | tmpccmr2 |= TIM_ForcedAction; |
mbed_official | 155:8435094ec241 | 1451 | |
mbed_official | 155:8435094ec241 | 1452 | /* Write to TIMx CCMR2 register */ |
mbed_official | 155:8435094ec241 | 1453 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1454 | } |
mbed_official | 155:8435094ec241 | 1455 | |
mbed_official | 155:8435094ec241 | 1456 | /** |
mbed_official | 155:8435094ec241 | 1457 | * @brief Forces the TIMx output 4 waveform to active or inactive level. |
mbed_official | 155:8435094ec241 | 1458 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1459 | * @param TIM_ForcedAction: specifies the forced Action to be set to the output waveform. |
mbed_official | 155:8435094ec241 | 1460 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1461 | * @arg TIM_ForcedAction_Active: Force active level on OC4REF |
mbed_official | 155:8435094ec241 | 1462 | * @arg TIM_ForcedAction_InActive: Force inactive level on OC4REF. |
mbed_official | 155:8435094ec241 | 1463 | * @retval None |
mbed_official | 155:8435094ec241 | 1464 | */ |
mbed_official | 155:8435094ec241 | 1465 | void TIM_ForcedOC4Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction) |
mbed_official | 155:8435094ec241 | 1466 | { |
mbed_official | 155:8435094ec241 | 1467 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1468 | |
mbed_official | 155:8435094ec241 | 1469 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1470 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1471 | assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); |
mbed_official | 155:8435094ec241 | 1472 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1473 | |
mbed_official | 155:8435094ec241 | 1474 | /* Reset the OC2M Bits */ |
mbed_official | 155:8435094ec241 | 1475 | tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC4M; |
mbed_official | 155:8435094ec241 | 1476 | |
mbed_official | 155:8435094ec241 | 1477 | /* Configure The Forced output Mode */ |
mbed_official | 155:8435094ec241 | 1478 | tmpccmr2 |= ((uint32_t)TIM_ForcedAction << 8); |
mbed_official | 155:8435094ec241 | 1479 | |
mbed_official | 155:8435094ec241 | 1480 | /* Write to TIMx CCMR2 register */ |
mbed_official | 155:8435094ec241 | 1481 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1482 | } |
mbed_official | 155:8435094ec241 | 1483 | |
mbed_official | 155:8435094ec241 | 1484 | /** |
mbed_official | 155:8435094ec241 | 1485 | * @brief Forces the TIMx output 5 waveform to active or inactive level. |
mbed_official | 155:8435094ec241 | 1486 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1487 | * @param TIM_ForcedAction: specifies the forced Action to be set to the output waveform. |
mbed_official | 155:8435094ec241 | 1488 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1489 | * @arg TIM_ForcedAction_Active: Force active level on OC5REF |
mbed_official | 155:8435094ec241 | 1490 | * @arg TIM_ForcedAction_InActive: Force inactive level on OC5REF. |
mbed_official | 155:8435094ec241 | 1491 | * @retval None |
mbed_official | 155:8435094ec241 | 1492 | */ |
mbed_official | 155:8435094ec241 | 1493 | void TIM_ForcedOC5Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction) |
mbed_official | 155:8435094ec241 | 1494 | { |
mbed_official | 155:8435094ec241 | 1495 | uint32_t tmpccmr3 = 0; |
mbed_official | 155:8435094ec241 | 1496 | |
mbed_official | 155:8435094ec241 | 1497 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1498 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1499 | assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); |
mbed_official | 155:8435094ec241 | 1500 | tmpccmr3 = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 1501 | |
mbed_official | 155:8435094ec241 | 1502 | /* Reset the OC5M Bits */ |
mbed_official | 155:8435094ec241 | 1503 | tmpccmr3 &= (uint32_t)~TIM_CCMR3_OC5M; |
mbed_official | 155:8435094ec241 | 1504 | |
mbed_official | 155:8435094ec241 | 1505 | /* Configure The Forced output Mode */ |
mbed_official | 155:8435094ec241 | 1506 | tmpccmr3 |= (uint32_t)(TIM_ForcedAction); |
mbed_official | 155:8435094ec241 | 1507 | |
mbed_official | 155:8435094ec241 | 1508 | /* Write to TIMx CCMR3 register */ |
mbed_official | 155:8435094ec241 | 1509 | TIMx->CCMR3 = tmpccmr3; |
mbed_official | 155:8435094ec241 | 1510 | } |
mbed_official | 155:8435094ec241 | 1511 | |
mbed_official | 155:8435094ec241 | 1512 | /** |
mbed_official | 155:8435094ec241 | 1513 | * @brief Forces the TIMx output 6 waveform to active or inactive level. |
mbed_official | 155:8435094ec241 | 1514 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1515 | * @param TIM_ForcedAction: specifies the forced Action to be set to the output waveform. |
mbed_official | 155:8435094ec241 | 1516 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1517 | * @arg TIM_ForcedAction_Active: Force active level on OC5REF |
mbed_official | 155:8435094ec241 | 1518 | * @arg TIM_ForcedAction_InActive: Force inactive level on OC5REF. |
mbed_official | 155:8435094ec241 | 1519 | * @retval None |
mbed_official | 155:8435094ec241 | 1520 | */ |
mbed_official | 155:8435094ec241 | 1521 | void TIM_ForcedOC6Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction) |
mbed_official | 155:8435094ec241 | 1522 | { |
mbed_official | 155:8435094ec241 | 1523 | uint32_t tmpccmr3 = 0; |
mbed_official | 155:8435094ec241 | 1524 | |
mbed_official | 155:8435094ec241 | 1525 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1526 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1527 | assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); |
mbed_official | 155:8435094ec241 | 1528 | tmpccmr3 = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 1529 | |
mbed_official | 155:8435094ec241 | 1530 | /* Reset the OC6M Bits */ |
mbed_official | 155:8435094ec241 | 1531 | tmpccmr3 &= (uint32_t)~TIM_CCMR3_OC6M; |
mbed_official | 155:8435094ec241 | 1532 | |
mbed_official | 155:8435094ec241 | 1533 | /* Configure The Forced output Mode */ |
mbed_official | 155:8435094ec241 | 1534 | tmpccmr3 |= ((uint32_t)TIM_ForcedAction << 8); |
mbed_official | 155:8435094ec241 | 1535 | |
mbed_official | 155:8435094ec241 | 1536 | /* Write to TIMx CCMR3 register */ |
mbed_official | 155:8435094ec241 | 1537 | TIMx->CCMR3 = tmpccmr3; |
mbed_official | 155:8435094ec241 | 1538 | } |
mbed_official | 155:8435094ec241 | 1539 | |
mbed_official | 155:8435094ec241 | 1540 | /** |
mbed_official | 155:8435094ec241 | 1541 | * @brief Enables or disables the TIMx peripheral Preload register on CCR1. |
mbed_official | 155:8435094ec241 | 1542 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1543 | * @param TIM_OCPreload: new state of the TIMx peripheral Preload register |
mbed_official | 155:8435094ec241 | 1544 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1545 | * @arg TIM_OCPreload_Enable |
mbed_official | 155:8435094ec241 | 1546 | * @arg TIM_OCPreload_Disable |
mbed_official | 155:8435094ec241 | 1547 | * @retval None |
mbed_official | 155:8435094ec241 | 1548 | */ |
mbed_official | 155:8435094ec241 | 1549 | void TIM_OC1PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload) |
mbed_official | 155:8435094ec241 | 1550 | { |
mbed_official | 155:8435094ec241 | 1551 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1552 | |
mbed_official | 155:8435094ec241 | 1553 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1554 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1555 | assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); |
mbed_official | 155:8435094ec241 | 1556 | |
mbed_official | 155:8435094ec241 | 1557 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1558 | |
mbed_official | 155:8435094ec241 | 1559 | /* Reset the OC1PE Bit */ |
mbed_official | 155:8435094ec241 | 1560 | tmpccmr1 &= (uint32_t)(~TIM_CCMR1_OC1PE); |
mbed_official | 155:8435094ec241 | 1561 | |
mbed_official | 155:8435094ec241 | 1562 | /* Enable or Disable the Output Compare Preload feature */ |
mbed_official | 155:8435094ec241 | 1563 | tmpccmr1 |= TIM_OCPreload; |
mbed_official | 155:8435094ec241 | 1564 | |
mbed_official | 155:8435094ec241 | 1565 | /* Write to TIMx CCMR1 register */ |
mbed_official | 155:8435094ec241 | 1566 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1567 | } |
mbed_official | 155:8435094ec241 | 1568 | |
mbed_official | 155:8435094ec241 | 1569 | /** |
mbed_official | 155:8435094ec241 | 1570 | * @brief Enables or disables the TIMx peripheral Preload register on CCR2. |
mbed_official | 155:8435094ec241 | 1571 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 1572 | * peripheral. |
mbed_official | 155:8435094ec241 | 1573 | * @param TIM_OCPreload: new state of the TIMx peripheral Preload register |
mbed_official | 155:8435094ec241 | 1574 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1575 | * @arg TIM_OCPreload_Enable |
mbed_official | 155:8435094ec241 | 1576 | * @arg TIM_OCPreload_Disable |
mbed_official | 155:8435094ec241 | 1577 | * @retval None |
mbed_official | 155:8435094ec241 | 1578 | */ |
mbed_official | 155:8435094ec241 | 1579 | void TIM_OC2PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload) |
mbed_official | 155:8435094ec241 | 1580 | { |
mbed_official | 155:8435094ec241 | 1581 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1582 | |
mbed_official | 155:8435094ec241 | 1583 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1584 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1585 | assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); |
mbed_official | 155:8435094ec241 | 1586 | |
mbed_official | 155:8435094ec241 | 1587 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1588 | |
mbed_official | 155:8435094ec241 | 1589 | /* Reset the OC2PE Bit */ |
mbed_official | 155:8435094ec241 | 1590 | tmpccmr1 &= (uint32_t)(~TIM_CCMR1_OC2PE); |
mbed_official | 155:8435094ec241 | 1591 | |
mbed_official | 155:8435094ec241 | 1592 | /* Enable or Disable the Output Compare Preload feature */ |
mbed_official | 155:8435094ec241 | 1593 | tmpccmr1 |= ((uint32_t)TIM_OCPreload << 8); |
mbed_official | 155:8435094ec241 | 1594 | |
mbed_official | 155:8435094ec241 | 1595 | /* Write to TIMx CCMR1 register */ |
mbed_official | 155:8435094ec241 | 1596 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1597 | } |
mbed_official | 155:8435094ec241 | 1598 | |
mbed_official | 155:8435094ec241 | 1599 | /** |
mbed_official | 155:8435094ec241 | 1600 | * @brief Enables or disables the TIMx peripheral Preload register on CCR3. |
mbed_official | 155:8435094ec241 | 1601 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1602 | * @param TIM_OCPreload: new state of the TIMx peripheral Preload register |
mbed_official | 155:8435094ec241 | 1603 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1604 | * @arg TIM_OCPreload_Enable |
mbed_official | 155:8435094ec241 | 1605 | * @arg TIM_OCPreload_Disable |
mbed_official | 155:8435094ec241 | 1606 | * @retval None |
mbed_official | 155:8435094ec241 | 1607 | */ |
mbed_official | 155:8435094ec241 | 1608 | void TIM_OC3PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload) |
mbed_official | 155:8435094ec241 | 1609 | { |
mbed_official | 155:8435094ec241 | 1610 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1611 | |
mbed_official | 155:8435094ec241 | 1612 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1613 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1614 | assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); |
mbed_official | 155:8435094ec241 | 1615 | |
mbed_official | 155:8435094ec241 | 1616 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1617 | |
mbed_official | 155:8435094ec241 | 1618 | /* Reset the OC3PE Bit */ |
mbed_official | 155:8435094ec241 | 1619 | tmpccmr2 &= (uint32_t)(~TIM_CCMR2_OC3PE); |
mbed_official | 155:8435094ec241 | 1620 | |
mbed_official | 155:8435094ec241 | 1621 | /* Enable or Disable the Output Compare Preload feature */ |
mbed_official | 155:8435094ec241 | 1622 | tmpccmr2 |= TIM_OCPreload; |
mbed_official | 155:8435094ec241 | 1623 | |
mbed_official | 155:8435094ec241 | 1624 | /* Write to TIMx CCMR2 register */ |
mbed_official | 155:8435094ec241 | 1625 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1626 | } |
mbed_official | 155:8435094ec241 | 1627 | |
mbed_official | 155:8435094ec241 | 1628 | /** |
mbed_official | 155:8435094ec241 | 1629 | * @brief Enables or disables the TIMx peripheral Preload register on CCR4. |
mbed_official | 155:8435094ec241 | 1630 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1631 | * @param TIM_OCPreload: new state of the TIMx peripheral Preload register |
mbed_official | 155:8435094ec241 | 1632 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1633 | * @arg TIM_OCPreload_Enable |
mbed_official | 155:8435094ec241 | 1634 | * @arg TIM_OCPreload_Disable |
mbed_official | 155:8435094ec241 | 1635 | * @retval None |
mbed_official | 155:8435094ec241 | 1636 | */ |
mbed_official | 155:8435094ec241 | 1637 | void TIM_OC4PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload) |
mbed_official | 155:8435094ec241 | 1638 | { |
mbed_official | 155:8435094ec241 | 1639 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1640 | |
mbed_official | 155:8435094ec241 | 1641 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1642 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1643 | assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); |
mbed_official | 155:8435094ec241 | 1644 | |
mbed_official | 155:8435094ec241 | 1645 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1646 | |
mbed_official | 155:8435094ec241 | 1647 | /* Reset the OC4PE Bit */ |
mbed_official | 155:8435094ec241 | 1648 | tmpccmr2 &= (uint32_t)(~TIM_CCMR2_OC4PE); |
mbed_official | 155:8435094ec241 | 1649 | |
mbed_official | 155:8435094ec241 | 1650 | /* Enable or Disable the Output Compare Preload feature */ |
mbed_official | 155:8435094ec241 | 1651 | tmpccmr2 |= ((uint32_t)TIM_OCPreload << 8); |
mbed_official | 155:8435094ec241 | 1652 | |
mbed_official | 155:8435094ec241 | 1653 | /* Write to TIMx CCMR2 register */ |
mbed_official | 155:8435094ec241 | 1654 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1655 | } |
mbed_official | 155:8435094ec241 | 1656 | |
mbed_official | 155:8435094ec241 | 1657 | /** |
mbed_official | 155:8435094ec241 | 1658 | * @brief Enables or disables the TIMx peripheral Preload register on CCR5. |
mbed_official | 155:8435094ec241 | 1659 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1660 | * @param TIM_OCPreload: new state of the TIMx peripheral Preload register |
mbed_official | 155:8435094ec241 | 1661 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1662 | * @arg TIM_OCPreload_Enable |
mbed_official | 155:8435094ec241 | 1663 | * @arg TIM_OCPreload_Disable |
mbed_official | 155:8435094ec241 | 1664 | * @retval None |
mbed_official | 155:8435094ec241 | 1665 | */ |
mbed_official | 155:8435094ec241 | 1666 | void TIM_OC5PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload) |
mbed_official | 155:8435094ec241 | 1667 | { |
mbed_official | 155:8435094ec241 | 1668 | uint32_t tmpccmr3 = 0; |
mbed_official | 155:8435094ec241 | 1669 | |
mbed_official | 155:8435094ec241 | 1670 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1671 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1672 | assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); |
mbed_official | 155:8435094ec241 | 1673 | |
mbed_official | 155:8435094ec241 | 1674 | tmpccmr3 = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 1675 | |
mbed_official | 155:8435094ec241 | 1676 | /* Reset the OC5PE Bit */ |
mbed_official | 155:8435094ec241 | 1677 | tmpccmr3 &= (uint32_t)(~TIM_CCMR3_OC5PE); |
mbed_official | 155:8435094ec241 | 1678 | |
mbed_official | 155:8435094ec241 | 1679 | /* Enable or Disable the Output Compare Preload feature */ |
mbed_official | 155:8435094ec241 | 1680 | tmpccmr3 |= (uint32_t)(TIM_OCPreload); |
mbed_official | 155:8435094ec241 | 1681 | |
mbed_official | 155:8435094ec241 | 1682 | /* Write to TIMx CCMR3 register */ |
mbed_official | 155:8435094ec241 | 1683 | TIMx->CCMR3 = tmpccmr3; |
mbed_official | 155:8435094ec241 | 1684 | } |
mbed_official | 155:8435094ec241 | 1685 | |
mbed_official | 155:8435094ec241 | 1686 | /** |
mbed_official | 155:8435094ec241 | 1687 | * @brief Enables or disables the TIMx peripheral Preload register on CCR6. |
mbed_official | 155:8435094ec241 | 1688 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1689 | * @param TIM_OCPreload: new state of the TIMx peripheral Preload register |
mbed_official | 155:8435094ec241 | 1690 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1691 | * @arg TIM_OCPreload_Enable |
mbed_official | 155:8435094ec241 | 1692 | * @arg TIM_OCPreload_Disable |
mbed_official | 155:8435094ec241 | 1693 | * @retval None |
mbed_official | 155:8435094ec241 | 1694 | */ |
mbed_official | 155:8435094ec241 | 1695 | void TIM_OC6PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload) |
mbed_official | 155:8435094ec241 | 1696 | { |
mbed_official | 155:8435094ec241 | 1697 | uint32_t tmpccmr3 = 0; |
mbed_official | 155:8435094ec241 | 1698 | |
mbed_official | 155:8435094ec241 | 1699 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1700 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1701 | assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); |
mbed_official | 155:8435094ec241 | 1702 | |
mbed_official | 155:8435094ec241 | 1703 | tmpccmr3 = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 1704 | |
mbed_official | 155:8435094ec241 | 1705 | /* Reset the OC5PE Bit */ |
mbed_official | 155:8435094ec241 | 1706 | tmpccmr3 &= (uint32_t)(~TIM_CCMR3_OC6PE); |
mbed_official | 155:8435094ec241 | 1707 | |
mbed_official | 155:8435094ec241 | 1708 | /* Enable or Disable the Output Compare Preload feature */ |
mbed_official | 155:8435094ec241 | 1709 | tmpccmr3 |= ((uint32_t)TIM_OCPreload << 8); |
mbed_official | 155:8435094ec241 | 1710 | |
mbed_official | 155:8435094ec241 | 1711 | /* Write to TIMx CCMR3 register */ |
mbed_official | 155:8435094ec241 | 1712 | TIMx->CCMR3 = tmpccmr3; |
mbed_official | 155:8435094ec241 | 1713 | } |
mbed_official | 155:8435094ec241 | 1714 | |
mbed_official | 155:8435094ec241 | 1715 | /** |
mbed_official | 155:8435094ec241 | 1716 | * @brief Configures the TIMx Output Compare 1 Fast feature. |
mbed_official | 155:8435094ec241 | 1717 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1718 | * @param TIM_OCFast: new state of the Output Compare Fast Enable Bit. |
mbed_official | 155:8435094ec241 | 1719 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1720 | * @arg TIM_OCFast_Enable: TIM output compare fast enable |
mbed_official | 155:8435094ec241 | 1721 | * @arg TIM_OCFast_Disable: TIM output compare fast disable |
mbed_official | 155:8435094ec241 | 1722 | * @retval None |
mbed_official | 155:8435094ec241 | 1723 | */ |
mbed_official | 155:8435094ec241 | 1724 | void TIM_OC1FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast) |
mbed_official | 155:8435094ec241 | 1725 | { |
mbed_official | 155:8435094ec241 | 1726 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1727 | |
mbed_official | 155:8435094ec241 | 1728 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1729 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1730 | assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); |
mbed_official | 155:8435094ec241 | 1731 | |
mbed_official | 155:8435094ec241 | 1732 | /* Get the TIMx CCMR1 register value */ |
mbed_official | 155:8435094ec241 | 1733 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1734 | |
mbed_official | 155:8435094ec241 | 1735 | /* Reset the OC1FE Bit */ |
mbed_official | 155:8435094ec241 | 1736 | tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC1FE; |
mbed_official | 155:8435094ec241 | 1737 | |
mbed_official | 155:8435094ec241 | 1738 | /* Enable or Disable the Output Compare Fast Bit */ |
mbed_official | 155:8435094ec241 | 1739 | tmpccmr1 |= TIM_OCFast; |
mbed_official | 155:8435094ec241 | 1740 | |
mbed_official | 155:8435094ec241 | 1741 | /* Write to TIMx CCMR1 */ |
mbed_official | 155:8435094ec241 | 1742 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1743 | } |
mbed_official | 155:8435094ec241 | 1744 | |
mbed_official | 155:8435094ec241 | 1745 | /** |
mbed_official | 155:8435094ec241 | 1746 | * @brief Configures the TIMx Output Compare 2 Fast feature. |
mbed_official | 155:8435094ec241 | 1747 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 1748 | * peripheral. |
mbed_official | 155:8435094ec241 | 1749 | * @param TIM_OCFast: new state of the Output Compare Fast Enable Bit. |
mbed_official | 155:8435094ec241 | 1750 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1751 | * @arg TIM_OCFast_Enable: TIM output compare fast enable |
mbed_official | 155:8435094ec241 | 1752 | * @arg TIM_OCFast_Disable: TIM output compare fast disable |
mbed_official | 155:8435094ec241 | 1753 | * @retval None |
mbed_official | 155:8435094ec241 | 1754 | */ |
mbed_official | 155:8435094ec241 | 1755 | void TIM_OC2FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast) |
mbed_official | 155:8435094ec241 | 1756 | { |
mbed_official | 155:8435094ec241 | 1757 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1758 | |
mbed_official | 155:8435094ec241 | 1759 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1760 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1761 | assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); |
mbed_official | 155:8435094ec241 | 1762 | |
mbed_official | 155:8435094ec241 | 1763 | /* Get the TIMx CCMR1 register value */ |
mbed_official | 155:8435094ec241 | 1764 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1765 | |
mbed_official | 155:8435094ec241 | 1766 | /* Reset the OC2FE Bit */ |
mbed_official | 155:8435094ec241 | 1767 | tmpccmr1 &= (uint32_t)(~TIM_CCMR1_OC2FE); |
mbed_official | 155:8435094ec241 | 1768 | |
mbed_official | 155:8435094ec241 | 1769 | /* Enable or Disable the Output Compare Fast Bit */ |
mbed_official | 155:8435094ec241 | 1770 | tmpccmr1 |= ((uint32_t)TIM_OCFast << 8); |
mbed_official | 155:8435094ec241 | 1771 | |
mbed_official | 155:8435094ec241 | 1772 | /* Write to TIMx CCMR1 */ |
mbed_official | 155:8435094ec241 | 1773 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1774 | } |
mbed_official | 155:8435094ec241 | 1775 | |
mbed_official | 155:8435094ec241 | 1776 | /** |
mbed_official | 155:8435094ec241 | 1777 | * @brief Configures the TIMx Output Compare 3 Fast feature. |
mbed_official | 155:8435094ec241 | 1778 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1779 | * @param TIM_OCFast: new state of the Output Compare Fast Enable Bit. |
mbed_official | 155:8435094ec241 | 1780 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1781 | * @arg TIM_OCFast_Enable: TIM output compare fast enable |
mbed_official | 155:8435094ec241 | 1782 | * @arg TIM_OCFast_Disable: TIM output compare fast disable |
mbed_official | 155:8435094ec241 | 1783 | * @retval None |
mbed_official | 155:8435094ec241 | 1784 | */ |
mbed_official | 155:8435094ec241 | 1785 | void TIM_OC3FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast) |
mbed_official | 155:8435094ec241 | 1786 | { |
mbed_official | 155:8435094ec241 | 1787 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1788 | |
mbed_official | 155:8435094ec241 | 1789 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1790 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1791 | assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); |
mbed_official | 155:8435094ec241 | 1792 | |
mbed_official | 155:8435094ec241 | 1793 | /* Get the TIMx CCMR2 register value */ |
mbed_official | 155:8435094ec241 | 1794 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1795 | |
mbed_official | 155:8435094ec241 | 1796 | /* Reset the OC3FE Bit */ |
mbed_official | 155:8435094ec241 | 1797 | tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC3FE; |
mbed_official | 155:8435094ec241 | 1798 | |
mbed_official | 155:8435094ec241 | 1799 | /* Enable or Disable the Output Compare Fast Bit */ |
mbed_official | 155:8435094ec241 | 1800 | tmpccmr2 |= TIM_OCFast; |
mbed_official | 155:8435094ec241 | 1801 | |
mbed_official | 155:8435094ec241 | 1802 | /* Write to TIMx CCMR2 */ |
mbed_official | 155:8435094ec241 | 1803 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1804 | } |
mbed_official | 155:8435094ec241 | 1805 | |
mbed_official | 155:8435094ec241 | 1806 | /** |
mbed_official | 155:8435094ec241 | 1807 | * @brief Configures the TIMx Output Compare 4 Fast feature. |
mbed_official | 155:8435094ec241 | 1808 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1809 | * @param TIM_OCFast: new state of the Output Compare Fast Enable Bit. |
mbed_official | 155:8435094ec241 | 1810 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1811 | * @arg TIM_OCFast_Enable: TIM output compare fast enable |
mbed_official | 155:8435094ec241 | 1812 | * @arg TIM_OCFast_Disable: TIM output compare fast disable |
mbed_official | 155:8435094ec241 | 1813 | * @retval None |
mbed_official | 155:8435094ec241 | 1814 | */ |
mbed_official | 155:8435094ec241 | 1815 | void TIM_OC4FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast) |
mbed_official | 155:8435094ec241 | 1816 | { |
mbed_official | 155:8435094ec241 | 1817 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1818 | |
mbed_official | 155:8435094ec241 | 1819 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1820 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1821 | assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); |
mbed_official | 155:8435094ec241 | 1822 | |
mbed_official | 155:8435094ec241 | 1823 | /* Get the TIMx CCMR2 register value */ |
mbed_official | 155:8435094ec241 | 1824 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1825 | |
mbed_official | 155:8435094ec241 | 1826 | /* Reset the OC4FE Bit */ |
mbed_official | 155:8435094ec241 | 1827 | tmpccmr2 &= (uint32_t)(~TIM_CCMR2_OC4FE); |
mbed_official | 155:8435094ec241 | 1828 | |
mbed_official | 155:8435094ec241 | 1829 | /* Enable or Disable the Output Compare Fast Bit */ |
mbed_official | 155:8435094ec241 | 1830 | tmpccmr2 |= ((uint32_t)TIM_OCFast << 8); |
mbed_official | 155:8435094ec241 | 1831 | |
mbed_official | 155:8435094ec241 | 1832 | /* Write to TIMx CCMR2 */ |
mbed_official | 155:8435094ec241 | 1833 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1834 | } |
mbed_official | 155:8435094ec241 | 1835 | |
mbed_official | 155:8435094ec241 | 1836 | /** |
mbed_official | 155:8435094ec241 | 1837 | * @brief Clears or safeguards the OCREF1 signal on an external event |
mbed_official | 155:8435094ec241 | 1838 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1839 | * @param TIM_OCClear: new state of the Output Compare Clear Enable Bit. |
mbed_official | 155:8435094ec241 | 1840 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1841 | * @arg TIM_OCClear_Enable: TIM Output clear enable |
mbed_official | 155:8435094ec241 | 1842 | * @arg TIM_OCClear_Disable: TIM Output clear disable |
mbed_official | 155:8435094ec241 | 1843 | * @retval None |
mbed_official | 155:8435094ec241 | 1844 | */ |
mbed_official | 155:8435094ec241 | 1845 | void TIM_ClearOC1Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear) |
mbed_official | 155:8435094ec241 | 1846 | { |
mbed_official | 155:8435094ec241 | 1847 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1848 | |
mbed_official | 155:8435094ec241 | 1849 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1850 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1851 | assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); |
mbed_official | 155:8435094ec241 | 1852 | |
mbed_official | 155:8435094ec241 | 1853 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1854 | |
mbed_official | 155:8435094ec241 | 1855 | /* Reset the OC1CE Bit */ |
mbed_official | 155:8435094ec241 | 1856 | tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC1CE; |
mbed_official | 155:8435094ec241 | 1857 | |
mbed_official | 155:8435094ec241 | 1858 | /* Enable or Disable the Output Compare Clear Bit */ |
mbed_official | 155:8435094ec241 | 1859 | tmpccmr1 |= TIM_OCClear; |
mbed_official | 155:8435094ec241 | 1860 | |
mbed_official | 155:8435094ec241 | 1861 | /* Write to TIMx CCMR1 register */ |
mbed_official | 155:8435094ec241 | 1862 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1863 | } |
mbed_official | 155:8435094ec241 | 1864 | |
mbed_official | 155:8435094ec241 | 1865 | /** |
mbed_official | 155:8435094ec241 | 1866 | * @brief Clears or safeguards the OCREF2 signal on an external event |
mbed_official | 155:8435094ec241 | 1867 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 1868 | * peripheral. |
mbed_official | 155:8435094ec241 | 1869 | * @param TIM_OCClear: new state of the Output Compare Clear Enable Bit. |
mbed_official | 155:8435094ec241 | 1870 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1871 | * @arg TIM_OCClear_Enable: TIM Output clear enable |
mbed_official | 155:8435094ec241 | 1872 | * @arg TIM_OCClear_Disable: TIM Output clear disable |
mbed_official | 155:8435094ec241 | 1873 | * @retval None |
mbed_official | 155:8435094ec241 | 1874 | */ |
mbed_official | 155:8435094ec241 | 1875 | void TIM_ClearOC2Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear) |
mbed_official | 155:8435094ec241 | 1876 | { |
mbed_official | 155:8435094ec241 | 1877 | uint32_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 1878 | |
mbed_official | 155:8435094ec241 | 1879 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1880 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1881 | assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); |
mbed_official | 155:8435094ec241 | 1882 | |
mbed_official | 155:8435094ec241 | 1883 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 1884 | |
mbed_official | 155:8435094ec241 | 1885 | /* Reset the OC2CE Bit */ |
mbed_official | 155:8435094ec241 | 1886 | tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC2CE; |
mbed_official | 155:8435094ec241 | 1887 | |
mbed_official | 155:8435094ec241 | 1888 | /* Enable or Disable the Output Compare Clear Bit */ |
mbed_official | 155:8435094ec241 | 1889 | tmpccmr1 |= ((uint32_t)TIM_OCClear << 8); |
mbed_official | 155:8435094ec241 | 1890 | |
mbed_official | 155:8435094ec241 | 1891 | /* Write to TIMx CCMR1 register */ |
mbed_official | 155:8435094ec241 | 1892 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 1893 | } |
mbed_official | 155:8435094ec241 | 1894 | |
mbed_official | 155:8435094ec241 | 1895 | /** |
mbed_official | 155:8435094ec241 | 1896 | * @brief Clears or safeguards the OCREF3 signal on an external event |
mbed_official | 155:8435094ec241 | 1897 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1898 | * @param TIM_OCClear: new state of the Output Compare Clear Enable Bit. |
mbed_official | 155:8435094ec241 | 1899 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1900 | * @arg TIM_OCClear_Enable: TIM Output clear enable |
mbed_official | 155:8435094ec241 | 1901 | * @arg TIM_OCClear_Disable: TIM Output clear disable |
mbed_official | 155:8435094ec241 | 1902 | * @retval None |
mbed_official | 155:8435094ec241 | 1903 | */ |
mbed_official | 155:8435094ec241 | 1904 | void TIM_ClearOC3Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear) |
mbed_official | 155:8435094ec241 | 1905 | { |
mbed_official | 155:8435094ec241 | 1906 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1907 | |
mbed_official | 155:8435094ec241 | 1908 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1909 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1910 | assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); |
mbed_official | 155:8435094ec241 | 1911 | |
mbed_official | 155:8435094ec241 | 1912 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1913 | |
mbed_official | 155:8435094ec241 | 1914 | /* Reset the OC3CE Bit */ |
mbed_official | 155:8435094ec241 | 1915 | tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC3CE; |
mbed_official | 155:8435094ec241 | 1916 | |
mbed_official | 155:8435094ec241 | 1917 | /* Enable or Disable the Output Compare Clear Bit */ |
mbed_official | 155:8435094ec241 | 1918 | tmpccmr2 |= TIM_OCClear; |
mbed_official | 155:8435094ec241 | 1919 | |
mbed_official | 155:8435094ec241 | 1920 | /* Write to TIMx CCMR2 register */ |
mbed_official | 155:8435094ec241 | 1921 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1922 | } |
mbed_official | 155:8435094ec241 | 1923 | |
mbed_official | 155:8435094ec241 | 1924 | /** |
mbed_official | 155:8435094ec241 | 1925 | * @brief Clears or safeguards the OCREF4 signal on an external event |
mbed_official | 155:8435094ec241 | 1926 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1927 | * @param TIM_OCClear: new state of the Output Compare Clear Enable Bit. |
mbed_official | 155:8435094ec241 | 1928 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1929 | * @arg TIM_OCClear_Enable: TIM Output clear enable |
mbed_official | 155:8435094ec241 | 1930 | * @arg TIM_OCClear_Disable: TIM Output clear disable |
mbed_official | 155:8435094ec241 | 1931 | * @retval None |
mbed_official | 155:8435094ec241 | 1932 | */ |
mbed_official | 155:8435094ec241 | 1933 | void TIM_ClearOC4Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear) |
mbed_official | 155:8435094ec241 | 1934 | { |
mbed_official | 155:8435094ec241 | 1935 | uint32_t tmpccmr2 = 0; |
mbed_official | 155:8435094ec241 | 1936 | |
mbed_official | 155:8435094ec241 | 1937 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1938 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1939 | assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); |
mbed_official | 155:8435094ec241 | 1940 | |
mbed_official | 155:8435094ec241 | 1941 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 1942 | |
mbed_official | 155:8435094ec241 | 1943 | /* Reset the OC4CE Bit */ |
mbed_official | 155:8435094ec241 | 1944 | tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC4CE; |
mbed_official | 155:8435094ec241 | 1945 | |
mbed_official | 155:8435094ec241 | 1946 | /* Enable or Disable the Output Compare Clear Bit */ |
mbed_official | 155:8435094ec241 | 1947 | tmpccmr2 |= ((uint32_t)TIM_OCClear << 8); |
mbed_official | 155:8435094ec241 | 1948 | |
mbed_official | 155:8435094ec241 | 1949 | /* Write to TIMx CCMR2 register */ |
mbed_official | 155:8435094ec241 | 1950 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 1951 | } |
mbed_official | 155:8435094ec241 | 1952 | |
mbed_official | 155:8435094ec241 | 1953 | /** |
mbed_official | 155:8435094ec241 | 1954 | * @brief Clears or safeguards the OCREF5 signal on an external event |
mbed_official | 155:8435094ec241 | 1955 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1956 | * @param TIM_OCClear: new state of the Output Compare Clear Enable Bit. |
mbed_official | 155:8435094ec241 | 1957 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1958 | * @arg TIM_OCClear_Enable: TIM Output clear enable |
mbed_official | 155:8435094ec241 | 1959 | * @arg TIM_OCClear_Disable: TIM Output clear disable |
mbed_official | 155:8435094ec241 | 1960 | * @retval None |
mbed_official | 155:8435094ec241 | 1961 | */ |
mbed_official | 155:8435094ec241 | 1962 | void TIM_ClearOC5Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear) |
mbed_official | 155:8435094ec241 | 1963 | { |
mbed_official | 155:8435094ec241 | 1964 | uint32_t tmpccmr3 = 0; |
mbed_official | 155:8435094ec241 | 1965 | |
mbed_official | 155:8435094ec241 | 1966 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1967 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1968 | assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); |
mbed_official | 155:8435094ec241 | 1969 | |
mbed_official | 155:8435094ec241 | 1970 | tmpccmr3 = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 1971 | |
mbed_official | 155:8435094ec241 | 1972 | /* Reset the OC5CE Bit */ |
mbed_official | 155:8435094ec241 | 1973 | tmpccmr3 &= (uint32_t)~TIM_CCMR3_OC5CE; |
mbed_official | 155:8435094ec241 | 1974 | |
mbed_official | 155:8435094ec241 | 1975 | /* Enable or Disable the Output Compare Clear Bit */ |
mbed_official | 155:8435094ec241 | 1976 | tmpccmr3 |= (uint32_t)(TIM_OCClear); |
mbed_official | 155:8435094ec241 | 1977 | |
mbed_official | 155:8435094ec241 | 1978 | /* Write to TIMx CCMR3 register */ |
mbed_official | 155:8435094ec241 | 1979 | TIMx->CCMR3 = tmpccmr3; |
mbed_official | 155:8435094ec241 | 1980 | } |
mbed_official | 155:8435094ec241 | 1981 | |
mbed_official | 155:8435094ec241 | 1982 | /** |
mbed_official | 155:8435094ec241 | 1983 | * @brief Clears or safeguards the OCREF6 signal on an external event |
mbed_official | 155:8435094ec241 | 1984 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 1985 | * @param TIM_OCClear: new state of the Output Compare Clear Enable Bit. |
mbed_official | 155:8435094ec241 | 1986 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 1987 | * @arg TIM_OCClear_Enable: TIM Output clear enable |
mbed_official | 155:8435094ec241 | 1988 | * @arg TIM_OCClear_Disable: TIM Output clear disable |
mbed_official | 155:8435094ec241 | 1989 | * @retval None |
mbed_official | 155:8435094ec241 | 1990 | */ |
mbed_official | 155:8435094ec241 | 1991 | void TIM_ClearOC6Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear) |
mbed_official | 155:8435094ec241 | 1992 | { |
mbed_official | 155:8435094ec241 | 1993 | uint32_t tmpccmr3 = 0; |
mbed_official | 155:8435094ec241 | 1994 | |
mbed_official | 155:8435094ec241 | 1995 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 1996 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 1997 | assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); |
mbed_official | 155:8435094ec241 | 1998 | |
mbed_official | 155:8435094ec241 | 1999 | tmpccmr3 = TIMx->CCMR3; |
mbed_official | 155:8435094ec241 | 2000 | |
mbed_official | 155:8435094ec241 | 2001 | /* Reset the OC5CE Bit */ |
mbed_official | 155:8435094ec241 | 2002 | tmpccmr3 &= (uint32_t)~TIM_CCMR3_OC6CE; |
mbed_official | 155:8435094ec241 | 2003 | |
mbed_official | 155:8435094ec241 | 2004 | /* Enable or Disable the Output Compare Clear Bit */ |
mbed_official | 155:8435094ec241 | 2005 | tmpccmr3 |= ((uint32_t)TIM_OCClear << 8); |
mbed_official | 155:8435094ec241 | 2006 | |
mbed_official | 155:8435094ec241 | 2007 | /* Write to TIMx CCMR3 register */ |
mbed_official | 155:8435094ec241 | 2008 | TIMx->CCMR3 = tmpccmr3; |
mbed_official | 155:8435094ec241 | 2009 | } |
mbed_official | 155:8435094ec241 | 2010 | |
mbed_official | 155:8435094ec241 | 2011 | /** |
mbed_official | 155:8435094ec241 | 2012 | * @brief Selects the OCReference Clear source. |
mbed_official | 155:8435094ec241 | 2013 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2014 | * @param TIM_OCReferenceClear: specifies the OCReference Clear source. |
mbed_official | 155:8435094ec241 | 2015 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2016 | * @arg TIM_OCReferenceClear_ETRF: The internal OCreference clear input is connected to ETRF. |
mbed_official | 155:8435094ec241 | 2017 | * @arg TIM_OCReferenceClear_OCREFCLR: The internal OCreference clear input is connected to OCREF_CLR input. |
mbed_official | 155:8435094ec241 | 2018 | * @retval None |
mbed_official | 155:8435094ec241 | 2019 | */ |
mbed_official | 155:8435094ec241 | 2020 | void TIM_SelectOCREFClear(TIM_TypeDef* TIMx, uint16_t TIM_OCReferenceClear) |
mbed_official | 155:8435094ec241 | 2021 | { |
mbed_official | 155:8435094ec241 | 2022 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2023 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2024 | assert_param(TIM_OCREFERENCECECLEAR_SOURCE(TIM_OCReferenceClear)); |
mbed_official | 155:8435094ec241 | 2025 | |
mbed_official | 155:8435094ec241 | 2026 | /* Set the TIM_OCReferenceClear source */ |
mbed_official | 155:8435094ec241 | 2027 | TIMx->SMCR &= (uint16_t)~((uint16_t)TIM_SMCR_OCCS); |
mbed_official | 155:8435094ec241 | 2028 | TIMx->SMCR |= TIM_OCReferenceClear; |
mbed_official | 155:8435094ec241 | 2029 | } |
mbed_official | 155:8435094ec241 | 2030 | |
mbed_official | 155:8435094ec241 | 2031 | /** |
mbed_official | 155:8435094ec241 | 2032 | * @brief Configures the TIMx channel 1 polarity. |
mbed_official | 155:8435094ec241 | 2033 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2034 | * @param TIM_OCPolarity: specifies the OC1 Polarity |
mbed_official | 155:8435094ec241 | 2035 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2036 | * @arg TIM_OCPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2037 | * @arg TIM_OCPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2038 | * @retval None |
mbed_official | 155:8435094ec241 | 2039 | */ |
mbed_official | 155:8435094ec241 | 2040 | void TIM_OC1PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity) |
mbed_official | 155:8435094ec241 | 2041 | { |
mbed_official | 155:8435094ec241 | 2042 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2043 | |
mbed_official | 155:8435094ec241 | 2044 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2045 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2046 | assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 2047 | |
mbed_official | 155:8435094ec241 | 2048 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2049 | |
mbed_official | 155:8435094ec241 | 2050 | /* Set or Reset the CC1P Bit */ |
mbed_official | 155:8435094ec241 | 2051 | tmpccer &= (uint32_t)(~TIM_CCER_CC1P); |
mbed_official | 155:8435094ec241 | 2052 | tmpccer |= TIM_OCPolarity; |
mbed_official | 155:8435094ec241 | 2053 | |
mbed_official | 155:8435094ec241 | 2054 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2055 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2056 | } |
mbed_official | 155:8435094ec241 | 2057 | |
mbed_official | 155:8435094ec241 | 2058 | /** |
mbed_official | 155:8435094ec241 | 2059 | * @brief Configures the TIMx Channel 1N polarity. |
mbed_official | 155:8435094ec241 | 2060 | * @param TIMx: where x can be 1, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2061 | * @param TIM_OCNPolarity: specifies the OC1N Polarity |
mbed_official | 155:8435094ec241 | 2062 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2063 | * @arg TIM_OCNPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2064 | * @arg TIM_OCNPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2065 | * @retval None |
mbed_official | 155:8435094ec241 | 2066 | */ |
mbed_official | 155:8435094ec241 | 2067 | void TIM_OC1NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity) |
mbed_official | 155:8435094ec241 | 2068 | { |
mbed_official | 155:8435094ec241 | 2069 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2070 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2071 | assert_param(IS_TIM_LIST6_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2072 | assert_param(IS_TIM_OCN_POLARITY(TIM_OCNPolarity)); |
mbed_official | 155:8435094ec241 | 2073 | |
mbed_official | 155:8435094ec241 | 2074 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2075 | |
mbed_official | 155:8435094ec241 | 2076 | /* Set or Reset the CC1NP Bit */ |
mbed_official | 155:8435094ec241 | 2077 | tmpccer &= (uint32_t)~TIM_CCER_CC1NP; |
mbed_official | 155:8435094ec241 | 2078 | tmpccer |= TIM_OCNPolarity; |
mbed_official | 155:8435094ec241 | 2079 | |
mbed_official | 155:8435094ec241 | 2080 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2081 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2082 | } |
mbed_official | 155:8435094ec241 | 2083 | |
mbed_official | 155:8435094ec241 | 2084 | /** |
mbed_official | 155:8435094ec241 | 2085 | * @brief Configures the TIMx channel 2 polarity. |
mbed_official | 155:8435094ec241 | 2086 | * @param TIMx: where x can be 1, 2, 3, 4 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 2087 | * peripheral. |
mbed_official | 155:8435094ec241 | 2088 | * @param TIM_OCPolarity: specifies the OC2 Polarity |
mbed_official | 155:8435094ec241 | 2089 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2090 | * @arg TIM_OCPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2091 | * @arg TIM_OCPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2092 | * @retval None |
mbed_official | 155:8435094ec241 | 2093 | */ |
mbed_official | 155:8435094ec241 | 2094 | void TIM_OC2PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity) |
mbed_official | 155:8435094ec241 | 2095 | { |
mbed_official | 155:8435094ec241 | 2096 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2097 | |
mbed_official | 155:8435094ec241 | 2098 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2099 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2100 | assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 2101 | |
mbed_official | 155:8435094ec241 | 2102 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2103 | |
mbed_official | 155:8435094ec241 | 2104 | /* Set or Reset the CC2P Bit */ |
mbed_official | 155:8435094ec241 | 2105 | tmpccer &= (uint32_t)(~TIM_CCER_CC2P); |
mbed_official | 155:8435094ec241 | 2106 | tmpccer |= ((uint32_t)TIM_OCPolarity << 4); |
mbed_official | 155:8435094ec241 | 2107 | |
mbed_official | 155:8435094ec241 | 2108 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2109 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2110 | } |
mbed_official | 155:8435094ec241 | 2111 | |
mbed_official | 155:8435094ec241 | 2112 | /** |
mbed_official | 155:8435094ec241 | 2113 | * @brief Configures the TIMx Channel 2N polarity. |
mbed_official | 155:8435094ec241 | 2114 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2115 | * @param TIM_OCNPolarity: specifies the OC2N Polarity |
mbed_official | 155:8435094ec241 | 2116 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2117 | * @arg TIM_OCNPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2118 | * @arg TIM_OCNPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2119 | * @retval None |
mbed_official | 155:8435094ec241 | 2120 | */ |
mbed_official | 155:8435094ec241 | 2121 | void TIM_OC2NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity) |
mbed_official | 155:8435094ec241 | 2122 | { |
mbed_official | 155:8435094ec241 | 2123 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2124 | |
mbed_official | 155:8435094ec241 | 2125 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2126 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2127 | assert_param(IS_TIM_OCN_POLARITY(TIM_OCNPolarity)); |
mbed_official | 155:8435094ec241 | 2128 | |
mbed_official | 155:8435094ec241 | 2129 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2130 | |
mbed_official | 155:8435094ec241 | 2131 | /* Set or Reset the CC2NP Bit */ |
mbed_official | 155:8435094ec241 | 2132 | tmpccer &= (uint32_t)~TIM_CCER_CC2NP; |
mbed_official | 155:8435094ec241 | 2133 | tmpccer |= ((uint32_t)TIM_OCNPolarity << 4); |
mbed_official | 155:8435094ec241 | 2134 | |
mbed_official | 155:8435094ec241 | 2135 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2136 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2137 | } |
mbed_official | 155:8435094ec241 | 2138 | |
mbed_official | 155:8435094ec241 | 2139 | /** |
mbed_official | 155:8435094ec241 | 2140 | * @brief Configures the TIMx channel 3 polarity. |
mbed_official | 155:8435094ec241 | 2141 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2142 | * @param TIM_OCPolarity: specifies the OC3 Polarity |
mbed_official | 155:8435094ec241 | 2143 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2144 | * @arg TIM_OCPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2145 | * @arg TIM_OCPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2146 | * @retval None |
mbed_official | 155:8435094ec241 | 2147 | */ |
mbed_official | 155:8435094ec241 | 2148 | void TIM_OC3PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity) |
mbed_official | 155:8435094ec241 | 2149 | { |
mbed_official | 155:8435094ec241 | 2150 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2151 | |
mbed_official | 155:8435094ec241 | 2152 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2153 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2154 | assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 2155 | |
mbed_official | 155:8435094ec241 | 2156 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2157 | |
mbed_official | 155:8435094ec241 | 2158 | /* Set or Reset the CC3P Bit */ |
mbed_official | 155:8435094ec241 | 2159 | tmpccer &= (uint32_t)~TIM_CCER_CC3P; |
mbed_official | 155:8435094ec241 | 2160 | tmpccer |= ((uint32_t)TIM_OCPolarity << 8); |
mbed_official | 155:8435094ec241 | 2161 | |
mbed_official | 155:8435094ec241 | 2162 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2163 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2164 | } |
mbed_official | 155:8435094ec241 | 2165 | |
mbed_official | 155:8435094ec241 | 2166 | /** |
mbed_official | 155:8435094ec241 | 2167 | * @brief Configures the TIMx Channel 3N polarity. |
mbed_official | 155:8435094ec241 | 2168 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2169 | * @param TIM_OCNPolarity: specifies the OC3N Polarity |
mbed_official | 155:8435094ec241 | 2170 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2171 | * @arg TIM_OCNPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2172 | * @arg TIM_OCNPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2173 | * @retval None |
mbed_official | 155:8435094ec241 | 2174 | */ |
mbed_official | 155:8435094ec241 | 2175 | void TIM_OC3NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity) |
mbed_official | 155:8435094ec241 | 2176 | { |
mbed_official | 155:8435094ec241 | 2177 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2178 | |
mbed_official | 155:8435094ec241 | 2179 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2180 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2181 | assert_param(IS_TIM_OCN_POLARITY(TIM_OCNPolarity)); |
mbed_official | 155:8435094ec241 | 2182 | |
mbed_official | 155:8435094ec241 | 2183 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2184 | |
mbed_official | 155:8435094ec241 | 2185 | /* Set or Reset the CC3NP Bit */ |
mbed_official | 155:8435094ec241 | 2186 | tmpccer &= (uint32_t)~TIM_CCER_CC3NP; |
mbed_official | 155:8435094ec241 | 2187 | tmpccer |= ((uint32_t)TIM_OCNPolarity << 8); |
mbed_official | 155:8435094ec241 | 2188 | |
mbed_official | 155:8435094ec241 | 2189 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2190 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2191 | } |
mbed_official | 155:8435094ec241 | 2192 | |
mbed_official | 155:8435094ec241 | 2193 | /** |
mbed_official | 155:8435094ec241 | 2194 | * @brief Configures the TIMx channel 4 polarity. |
mbed_official | 155:8435094ec241 | 2195 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2196 | * @param TIM_OCPolarity: specifies the OC4 Polarity |
mbed_official | 155:8435094ec241 | 2197 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2198 | * @arg TIM_OCPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2199 | * @arg TIM_OCPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2200 | * @retval None |
mbed_official | 155:8435094ec241 | 2201 | */ |
mbed_official | 155:8435094ec241 | 2202 | void TIM_OC4PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity) |
mbed_official | 155:8435094ec241 | 2203 | { |
mbed_official | 155:8435094ec241 | 2204 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2205 | |
mbed_official | 155:8435094ec241 | 2206 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2207 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2208 | assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 2209 | |
mbed_official | 155:8435094ec241 | 2210 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2211 | |
mbed_official | 155:8435094ec241 | 2212 | /* Set or Reset the CC4P Bit */ |
mbed_official | 155:8435094ec241 | 2213 | tmpccer &= (uint32_t)~TIM_CCER_CC4P; |
mbed_official | 155:8435094ec241 | 2214 | tmpccer |= ((uint32_t)TIM_OCPolarity << 12); |
mbed_official | 155:8435094ec241 | 2215 | |
mbed_official | 155:8435094ec241 | 2216 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2217 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2218 | } |
mbed_official | 155:8435094ec241 | 2219 | |
mbed_official | 155:8435094ec241 | 2220 | /** |
mbed_official | 155:8435094ec241 | 2221 | * @brief Configures the TIMx channel 5 polarity. |
mbed_official | 155:8435094ec241 | 2222 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2223 | * @param TIM_OCPolarity: specifies the OC5 Polarity |
mbed_official | 155:8435094ec241 | 2224 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2225 | * @arg TIM_OCPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2226 | * @arg TIM_OCPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2227 | * @retval None |
mbed_official | 155:8435094ec241 | 2228 | */ |
mbed_official | 155:8435094ec241 | 2229 | void TIM_OC5PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity) |
mbed_official | 155:8435094ec241 | 2230 | { |
mbed_official | 155:8435094ec241 | 2231 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2232 | |
mbed_official | 155:8435094ec241 | 2233 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2234 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2235 | assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 2236 | |
mbed_official | 155:8435094ec241 | 2237 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2238 | |
mbed_official | 155:8435094ec241 | 2239 | /* Set or Reset the CC5P Bit */ |
mbed_official | 155:8435094ec241 | 2240 | tmpccer &= (uint32_t)~TIM_CCER_CC5P; |
mbed_official | 155:8435094ec241 | 2241 | tmpccer |= ((uint32_t)TIM_OCPolarity << 16); |
mbed_official | 155:8435094ec241 | 2242 | |
mbed_official | 155:8435094ec241 | 2243 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2244 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2245 | } |
mbed_official | 155:8435094ec241 | 2246 | |
mbed_official | 155:8435094ec241 | 2247 | /** |
mbed_official | 155:8435094ec241 | 2248 | * @brief Configures the TIMx channel 6 polarity. |
mbed_official | 155:8435094ec241 | 2249 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2250 | * @param TIM_OCPolarity: specifies the OC6 Polarity |
mbed_official | 155:8435094ec241 | 2251 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2252 | * @arg TIM_OCPolarity_High: Output Compare active high |
mbed_official | 155:8435094ec241 | 2253 | * @arg TIM_OCPolarity_Low: Output Compare active low |
mbed_official | 155:8435094ec241 | 2254 | * @retval None |
mbed_official | 155:8435094ec241 | 2255 | */ |
mbed_official | 155:8435094ec241 | 2256 | void TIM_OC6PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity) |
mbed_official | 155:8435094ec241 | 2257 | { |
mbed_official | 155:8435094ec241 | 2258 | uint32_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 2259 | |
mbed_official | 155:8435094ec241 | 2260 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2261 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2262 | assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity)); |
mbed_official | 155:8435094ec241 | 2263 | |
mbed_official | 155:8435094ec241 | 2264 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 2265 | |
mbed_official | 155:8435094ec241 | 2266 | /* Set or Reset the CC6P Bit */ |
mbed_official | 155:8435094ec241 | 2267 | tmpccer &= (uint32_t)~TIM_CCER_CC6P; |
mbed_official | 155:8435094ec241 | 2268 | tmpccer |= ((uint32_t)TIM_OCPolarity << 20); |
mbed_official | 155:8435094ec241 | 2269 | |
mbed_official | 155:8435094ec241 | 2270 | /* Write to TIMx CCER register */ |
mbed_official | 155:8435094ec241 | 2271 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 2272 | } |
mbed_official | 155:8435094ec241 | 2273 | |
mbed_official | 155:8435094ec241 | 2274 | /** |
mbed_official | 155:8435094ec241 | 2275 | * @brief Enables or disables the TIM Capture Compare Channel x. |
mbed_official | 155:8435094ec241 | 2276 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2277 | * @param TIM_Channel: specifies the TIM Channel |
mbed_official | 155:8435094ec241 | 2278 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2279 | * @arg TIM_Channel_1: TIM Channel 1 |
mbed_official | 155:8435094ec241 | 2280 | * @arg TIM_Channel_2: TIM Channel 2 |
mbed_official | 155:8435094ec241 | 2281 | * @arg TIM_Channel_3: TIM Channel 3 |
mbed_official | 155:8435094ec241 | 2282 | * @arg TIM_Channel_4: TIM Channel 4 |
mbed_official | 155:8435094ec241 | 2283 | * @arg TIM_Channel_5: TIM Channel 5 |
mbed_official | 155:8435094ec241 | 2284 | * @arg TIM_Channel_6: TIM Channel 6 |
mbed_official | 155:8435094ec241 | 2285 | * @param TIM_CCx: specifies the TIM Channel CCxE bit new state. |
mbed_official | 155:8435094ec241 | 2286 | * This parameter can be: TIM_CCx_Enable or TIM_CCx_Disable. |
mbed_official | 155:8435094ec241 | 2287 | * @retval None |
mbed_official | 155:8435094ec241 | 2288 | */ |
mbed_official | 155:8435094ec241 | 2289 | void TIM_CCxCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx) |
mbed_official | 155:8435094ec241 | 2290 | { |
mbed_official | 155:8435094ec241 | 2291 | uint32_t tmp = 0; |
mbed_official | 155:8435094ec241 | 2292 | |
mbed_official | 155:8435094ec241 | 2293 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2294 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2295 | assert_param(IS_TIM_CHANNEL(TIM_Channel)); |
mbed_official | 155:8435094ec241 | 2296 | assert_param(IS_TIM_CCX(TIM_CCx)); |
mbed_official | 155:8435094ec241 | 2297 | |
mbed_official | 155:8435094ec241 | 2298 | tmp = (uint32_t)CCER_CCE_SET << (uint32_t)TIM_Channel; |
mbed_official | 155:8435094ec241 | 2299 | |
mbed_official | 155:8435094ec241 | 2300 | /* Reset the CCxE Bit */ |
mbed_official | 155:8435094ec241 | 2301 | TIMx->CCER &= (uint32_t)(~tmp); |
mbed_official | 155:8435094ec241 | 2302 | |
mbed_official | 155:8435094ec241 | 2303 | /* Set or reset the CCxE Bit */ |
mbed_official | 155:8435094ec241 | 2304 | TIMx->CCER |= ((uint32_t)TIM_CCx << (uint32_t)TIM_Channel); |
mbed_official | 155:8435094ec241 | 2305 | } |
mbed_official | 155:8435094ec241 | 2306 | |
mbed_official | 155:8435094ec241 | 2307 | /** |
mbed_official | 155:8435094ec241 | 2308 | * @brief Enables or disables the TIM Capture Compare Channel xN. |
mbed_official | 155:8435094ec241 | 2309 | * @param TIMx: where x can be 1, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2310 | * @param TIM_Channel: specifies the TIM Channel |
mbed_official | 155:8435094ec241 | 2311 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2312 | * @arg TIM_Channel_1: TIM Channel 1 |
mbed_official | 155:8435094ec241 | 2313 | * @arg TIM_Channel_2: TIM Channel 2 |
mbed_official | 155:8435094ec241 | 2314 | * @arg TIM_Channel_3: TIM Channel 3 |
mbed_official | 155:8435094ec241 | 2315 | * @param TIM_CCxN: specifies the TIM Channel CCxNE bit new state. |
mbed_official | 155:8435094ec241 | 2316 | * This parameter can be: TIM_CCxN_Enable or TIM_CCxN_Disable. |
mbed_official | 155:8435094ec241 | 2317 | * @retval None |
mbed_official | 155:8435094ec241 | 2318 | */ |
mbed_official | 155:8435094ec241 | 2319 | void TIM_CCxNCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN) |
mbed_official | 155:8435094ec241 | 2320 | { |
mbed_official | 155:8435094ec241 | 2321 | uint32_t tmp = 0; |
mbed_official | 155:8435094ec241 | 2322 | |
mbed_official | 155:8435094ec241 | 2323 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2324 | assert_param(IS_TIM_LIST6_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2325 | assert_param(IS_TIM_COMPLEMENTARY_CHANNEL(TIM_Channel)); |
mbed_official | 155:8435094ec241 | 2326 | assert_param(IS_TIM_CCXN(TIM_CCxN)); |
mbed_official | 155:8435094ec241 | 2327 | |
mbed_official | 155:8435094ec241 | 2328 | tmp = (uint32_t)CCER_CCNE_SET << (uint32_t)TIM_Channel; |
mbed_official | 155:8435094ec241 | 2329 | |
mbed_official | 155:8435094ec241 | 2330 | /* Reset the CCxNE Bit */ |
mbed_official | 155:8435094ec241 | 2331 | TIMx->CCER &= (uint32_t) ~tmp; |
mbed_official | 155:8435094ec241 | 2332 | |
mbed_official | 155:8435094ec241 | 2333 | /* Set or reset the CCxNE Bit */ |
mbed_official | 155:8435094ec241 | 2334 | TIMx->CCER |= ((uint32_t)TIM_CCxN << (uint32_t)TIM_Channel); |
mbed_official | 155:8435094ec241 | 2335 | } |
mbed_official | 155:8435094ec241 | 2336 | /** |
mbed_official | 155:8435094ec241 | 2337 | * @} |
mbed_official | 155:8435094ec241 | 2338 | */ |
mbed_official | 155:8435094ec241 | 2339 | |
mbed_official | 155:8435094ec241 | 2340 | /** @defgroup TIM_Group3 Input Capture management functions |
mbed_official | 155:8435094ec241 | 2341 | * @brief Input Capture management functions |
mbed_official | 155:8435094ec241 | 2342 | * |
mbed_official | 155:8435094ec241 | 2343 | @verbatim |
mbed_official | 155:8435094ec241 | 2344 | =============================================================================== |
mbed_official | 155:8435094ec241 | 2345 | ##### Input Capture management functions ##### |
mbed_official | 155:8435094ec241 | 2346 | =============================================================================== |
mbed_official | 155:8435094ec241 | 2347 | |
mbed_official | 155:8435094ec241 | 2348 | *** TIM Driver: how to use it in Input Capture Mode *** |
mbed_official | 155:8435094ec241 | 2349 | ======================================================= |
mbed_official | 155:8435094ec241 | 2350 | [..] |
mbed_official | 155:8435094ec241 | 2351 | To use the Timer in Input Capture mode, the following steps are mandatory: |
mbed_official | 155:8435094ec241 | 2352 | |
mbed_official | 155:8435094ec241 | 2353 | (#) Enable TIM clock using RCC_APBxPeriphClockCmd(RCC_APBxPeriph_TIMx, ENABLE) function |
mbed_official | 155:8435094ec241 | 2354 | |
mbed_official | 155:8435094ec241 | 2355 | (#) Configure the TIM pins by configuring the corresponding GPIO pins |
mbed_official | 155:8435094ec241 | 2356 | |
mbed_official | 155:8435094ec241 | 2357 | (#) Configure the Time base unit as described in the first part of this driver, |
mbed_official | 155:8435094ec241 | 2358 | if needed, else the Timer will run with the default configuration: |
mbed_official | 155:8435094ec241 | 2359 | (++) Autoreload value = 0xFFFF |
mbed_official | 155:8435094ec241 | 2360 | (++) Prescaler value = 0x0000 |
mbed_official | 155:8435094ec241 | 2361 | (++) Counter mode = Up counting |
mbed_official | 155:8435094ec241 | 2362 | (++) Clock Division = TIM_CKD_DIV1 |
mbed_official | 155:8435094ec241 | 2363 | |
mbed_official | 155:8435094ec241 | 2364 | (#) Fill the TIM_ICInitStruct with the desired parameters including: |
mbed_official | 155:8435094ec241 | 2365 | (++) TIM Channel: TIM_Channel |
mbed_official | 155:8435094ec241 | 2366 | (++) TIM Input Capture polarity: TIM_ICPolarity |
mbed_official | 155:8435094ec241 | 2367 | (++) TIM Input Capture selection: TIM_ICSelection |
mbed_official | 155:8435094ec241 | 2368 | (++) TIM Input Capture Prescaler: TIM_ICPrescaler |
mbed_official | 155:8435094ec241 | 2369 | (++) TIM Input CApture filter value: TIM_ICFilter |
mbed_official | 155:8435094ec241 | 2370 | |
mbed_official | 155:8435094ec241 | 2371 | (#) Call TIM_ICInit(TIMx, &TIM_ICInitStruct) to configure the desired channel with the |
mbed_official | 155:8435094ec241 | 2372 | corresponding configuration and to measure only frequency or duty cycle of the input signal, |
mbed_official | 155:8435094ec241 | 2373 | or, |
mbed_official | 155:8435094ec241 | 2374 | Call TIM_PWMIConfig(TIMx, &TIM_ICInitStruct) to configure the desired channels with the |
mbed_official | 155:8435094ec241 | 2375 | corresponding configuration and to measure the frequency and the duty cycle of the input signal |
mbed_official | 155:8435094ec241 | 2376 | |
mbed_official | 155:8435094ec241 | 2377 | (#) Enable the NVIC or the DMA to read the measured frequency. |
mbed_official | 155:8435094ec241 | 2378 | |
mbed_official | 155:8435094ec241 | 2379 | (#) Enable the corresponding interrupt (or DMA request) to read the Captured value, |
mbed_official | 155:8435094ec241 | 2380 | using the function TIM_ITConfig(TIMx, TIM_IT_CCx) (or TIM_DMA_Cmd(TIMx, TIM_DMA_CCx)) |
mbed_official | 155:8435094ec241 | 2381 | |
mbed_official | 155:8435094ec241 | 2382 | (#) Call the TIM_Cmd(ENABLE) function to enable the TIM counter. |
mbed_official | 155:8435094ec241 | 2383 | |
mbed_official | 155:8435094ec241 | 2384 | (#) Use TIM_GetCapturex(TIMx); to read the captured value. |
mbed_official | 155:8435094ec241 | 2385 | [..] |
mbed_official | 155:8435094ec241 | 2386 | (@) All other functions can be used separately to modify, if needed, |
mbed_official | 155:8435094ec241 | 2387 | a specific feature of the Timer. |
mbed_official | 155:8435094ec241 | 2388 | |
mbed_official | 155:8435094ec241 | 2389 | @endverbatim |
mbed_official | 155:8435094ec241 | 2390 | * @{ |
mbed_official | 155:8435094ec241 | 2391 | */ |
mbed_official | 155:8435094ec241 | 2392 | |
mbed_official | 155:8435094ec241 | 2393 | /** |
mbed_official | 155:8435094ec241 | 2394 | * @brief Initializes the TIM peripheral according to the specified parameters |
mbed_official | 155:8435094ec241 | 2395 | * in the TIM_ICInitStruct. |
mbed_official | 155:8435094ec241 | 2396 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2397 | * @param TIM_ICInitStruct: pointer to a TIM_ICInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 2398 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 2399 | * @retval None |
mbed_official | 155:8435094ec241 | 2400 | */ |
mbed_official | 155:8435094ec241 | 2401 | void TIM_ICInit(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct) |
mbed_official | 155:8435094ec241 | 2402 | { |
mbed_official | 155:8435094ec241 | 2403 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2404 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2405 | assert_param(IS_TIM_IC_POLARITY(TIM_ICInitStruct->TIM_ICPolarity)); |
mbed_official | 155:8435094ec241 | 2406 | assert_param(IS_TIM_IC_SELECTION(TIM_ICInitStruct->TIM_ICSelection)); |
mbed_official | 155:8435094ec241 | 2407 | assert_param(IS_TIM_IC_PRESCALER(TIM_ICInitStruct->TIM_ICPrescaler)); |
mbed_official | 155:8435094ec241 | 2408 | assert_param(IS_TIM_IC_FILTER(TIM_ICInitStruct->TIM_ICFilter)); |
mbed_official | 155:8435094ec241 | 2409 | |
mbed_official | 155:8435094ec241 | 2410 | if (TIM_ICInitStruct->TIM_Channel == TIM_Channel_1) |
mbed_official | 155:8435094ec241 | 2411 | { |
mbed_official | 155:8435094ec241 | 2412 | /* TI1 Configuration */ |
mbed_official | 155:8435094ec241 | 2413 | TI1_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, |
mbed_official | 155:8435094ec241 | 2414 | TIM_ICInitStruct->TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 2415 | TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2416 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2417 | TIM_SetIC1Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2418 | } |
mbed_official | 155:8435094ec241 | 2419 | else if (TIM_ICInitStruct->TIM_Channel == TIM_Channel_2) |
mbed_official | 155:8435094ec241 | 2420 | { |
mbed_official | 155:8435094ec241 | 2421 | /* TI2 Configuration */ |
mbed_official | 155:8435094ec241 | 2422 | TI2_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, |
mbed_official | 155:8435094ec241 | 2423 | TIM_ICInitStruct->TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 2424 | TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2425 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2426 | TIM_SetIC2Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2427 | } |
mbed_official | 155:8435094ec241 | 2428 | else if (TIM_ICInitStruct->TIM_Channel == TIM_Channel_3) |
mbed_official | 155:8435094ec241 | 2429 | { |
mbed_official | 155:8435094ec241 | 2430 | /* TI3 Configuration */ |
mbed_official | 155:8435094ec241 | 2431 | TI3_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, |
mbed_official | 155:8435094ec241 | 2432 | TIM_ICInitStruct->TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 2433 | TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2434 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2435 | TIM_SetIC3Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2436 | } |
mbed_official | 155:8435094ec241 | 2437 | else |
mbed_official | 155:8435094ec241 | 2438 | { |
mbed_official | 155:8435094ec241 | 2439 | /* TI4 Configuration */ |
mbed_official | 155:8435094ec241 | 2440 | TI4_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, |
mbed_official | 155:8435094ec241 | 2441 | TIM_ICInitStruct->TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 2442 | TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2443 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2444 | TIM_SetIC4Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2445 | } |
mbed_official | 155:8435094ec241 | 2446 | } |
mbed_official | 155:8435094ec241 | 2447 | |
mbed_official | 155:8435094ec241 | 2448 | /** |
mbed_official | 155:8435094ec241 | 2449 | * @brief Fills each TIM_ICInitStruct member with its default value. |
mbed_official | 155:8435094ec241 | 2450 | * @param TIM_ICInitStruct: pointer to a TIM_ICInitTypeDef structure which will |
mbed_official | 155:8435094ec241 | 2451 | * be initialized. |
mbed_official | 155:8435094ec241 | 2452 | * @retval None |
mbed_official | 155:8435094ec241 | 2453 | */ |
mbed_official | 155:8435094ec241 | 2454 | void TIM_ICStructInit(TIM_ICInitTypeDef* TIM_ICInitStruct) |
mbed_official | 155:8435094ec241 | 2455 | { |
mbed_official | 155:8435094ec241 | 2456 | /* Set the default configuration */ |
mbed_official | 155:8435094ec241 | 2457 | TIM_ICInitStruct->TIM_Channel = TIM_Channel_1; |
mbed_official | 155:8435094ec241 | 2458 | TIM_ICInitStruct->TIM_ICPolarity = TIM_ICPolarity_Rising; |
mbed_official | 155:8435094ec241 | 2459 | TIM_ICInitStruct->TIM_ICSelection = TIM_ICSelection_DirectTI; |
mbed_official | 155:8435094ec241 | 2460 | TIM_ICInitStruct->TIM_ICPrescaler = TIM_ICPSC_DIV1; |
mbed_official | 155:8435094ec241 | 2461 | TIM_ICInitStruct->TIM_ICFilter = 0x00; |
mbed_official | 155:8435094ec241 | 2462 | } |
mbed_official | 155:8435094ec241 | 2463 | |
mbed_official | 155:8435094ec241 | 2464 | /** |
mbed_official | 155:8435094ec241 | 2465 | * @brief Configures the TIM peripheral according to the specified parameters |
mbed_official | 155:8435094ec241 | 2466 | * in the TIM_ICInitStruct to measure an external PWM signal. |
mbed_official | 155:8435094ec241 | 2467 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 2468 | * peripheral. |
mbed_official | 155:8435094ec241 | 2469 | * @param TIM_ICInitStruct: pointer to a TIM_ICInitTypeDef structure that contains |
mbed_official | 155:8435094ec241 | 2470 | * the configuration information for the specified TIM peripheral. |
mbed_official | 155:8435094ec241 | 2471 | * @retval None |
mbed_official | 155:8435094ec241 | 2472 | */ |
mbed_official | 155:8435094ec241 | 2473 | void TIM_PWMIConfig(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct) |
mbed_official | 155:8435094ec241 | 2474 | { |
mbed_official | 155:8435094ec241 | 2475 | uint16_t icoppositepolarity = TIM_ICPolarity_Rising; |
mbed_official | 155:8435094ec241 | 2476 | uint16_t icoppositeselection = TIM_ICSelection_DirectTI; |
mbed_official | 155:8435094ec241 | 2477 | |
mbed_official | 155:8435094ec241 | 2478 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2479 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2480 | |
mbed_official | 155:8435094ec241 | 2481 | /* Select the Opposite Input Polarity */ |
mbed_official | 155:8435094ec241 | 2482 | if (TIM_ICInitStruct->TIM_ICPolarity == TIM_ICPolarity_Rising) |
mbed_official | 155:8435094ec241 | 2483 | { |
mbed_official | 155:8435094ec241 | 2484 | icoppositepolarity = TIM_ICPolarity_Falling; |
mbed_official | 155:8435094ec241 | 2485 | } |
mbed_official | 155:8435094ec241 | 2486 | else |
mbed_official | 155:8435094ec241 | 2487 | { |
mbed_official | 155:8435094ec241 | 2488 | icoppositepolarity = TIM_ICPolarity_Rising; |
mbed_official | 155:8435094ec241 | 2489 | } |
mbed_official | 155:8435094ec241 | 2490 | /* Select the Opposite Input */ |
mbed_official | 155:8435094ec241 | 2491 | if (TIM_ICInitStruct->TIM_ICSelection == TIM_ICSelection_DirectTI) |
mbed_official | 155:8435094ec241 | 2492 | { |
mbed_official | 155:8435094ec241 | 2493 | icoppositeselection = TIM_ICSelection_IndirectTI; |
mbed_official | 155:8435094ec241 | 2494 | } |
mbed_official | 155:8435094ec241 | 2495 | else |
mbed_official | 155:8435094ec241 | 2496 | { |
mbed_official | 155:8435094ec241 | 2497 | icoppositeselection = TIM_ICSelection_DirectTI; |
mbed_official | 155:8435094ec241 | 2498 | } |
mbed_official | 155:8435094ec241 | 2499 | if (TIM_ICInitStruct->TIM_Channel == TIM_Channel_1) |
mbed_official | 155:8435094ec241 | 2500 | { |
mbed_official | 155:8435094ec241 | 2501 | /* TI1 Configuration */ |
mbed_official | 155:8435094ec241 | 2502 | TI1_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, TIM_ICInitStruct->TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 2503 | TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2504 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2505 | TIM_SetIC1Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2506 | /* TI2 Configuration */ |
mbed_official | 155:8435094ec241 | 2507 | TI2_Config(TIMx, icoppositepolarity, icoppositeselection, TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2508 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2509 | TIM_SetIC2Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2510 | } |
mbed_official | 155:8435094ec241 | 2511 | else |
mbed_official | 155:8435094ec241 | 2512 | { |
mbed_official | 155:8435094ec241 | 2513 | /* TI2 Configuration */ |
mbed_official | 155:8435094ec241 | 2514 | TI2_Config(TIMx, TIM_ICInitStruct->TIM_ICPolarity, TIM_ICInitStruct->TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 2515 | TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2516 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2517 | TIM_SetIC2Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2518 | /* TI1 Configuration */ |
mbed_official | 155:8435094ec241 | 2519 | TI1_Config(TIMx, icoppositepolarity, icoppositeselection, TIM_ICInitStruct->TIM_ICFilter); |
mbed_official | 155:8435094ec241 | 2520 | /* Set the Input Capture Prescaler value */ |
mbed_official | 155:8435094ec241 | 2521 | TIM_SetIC1Prescaler(TIMx, TIM_ICInitStruct->TIM_ICPrescaler); |
mbed_official | 155:8435094ec241 | 2522 | } |
mbed_official | 155:8435094ec241 | 2523 | } |
mbed_official | 155:8435094ec241 | 2524 | |
mbed_official | 155:8435094ec241 | 2525 | /** |
mbed_official | 155:8435094ec241 | 2526 | * @brief Gets the TIMx Input Capture 1 value. |
mbed_official | 155:8435094ec241 | 2527 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2528 | * @retval Capture Compare 1 Register value. |
mbed_official | 155:8435094ec241 | 2529 | */ |
mbed_official | 155:8435094ec241 | 2530 | uint32_t TIM_GetCapture1(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 2531 | { |
mbed_official | 155:8435094ec241 | 2532 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2533 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2534 | |
mbed_official | 155:8435094ec241 | 2535 | /* Get the Capture 1 Register value */ |
mbed_official | 155:8435094ec241 | 2536 | return TIMx->CCR1; |
mbed_official | 155:8435094ec241 | 2537 | } |
mbed_official | 155:8435094ec241 | 2538 | |
mbed_official | 155:8435094ec241 | 2539 | /** |
mbed_official | 155:8435094ec241 | 2540 | * @brief Gets the TIMx Input Capture 2 value. |
mbed_official | 155:8435094ec241 | 2541 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 2542 | * peripheral. |
mbed_official | 155:8435094ec241 | 2543 | * @retval Capture Compare 2 Register value. |
mbed_official | 155:8435094ec241 | 2544 | */ |
mbed_official | 155:8435094ec241 | 2545 | uint32_t TIM_GetCapture2(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 2546 | { |
mbed_official | 155:8435094ec241 | 2547 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2548 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2549 | |
mbed_official | 155:8435094ec241 | 2550 | /* Get the Capture 2 Register value */ |
mbed_official | 155:8435094ec241 | 2551 | return TIMx->CCR2; |
mbed_official | 155:8435094ec241 | 2552 | } |
mbed_official | 155:8435094ec241 | 2553 | |
mbed_official | 155:8435094ec241 | 2554 | /** |
mbed_official | 155:8435094ec241 | 2555 | * @brief Gets the TIMx Input Capture 3 value. |
mbed_official | 155:8435094ec241 | 2556 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2557 | * @retval Capture Compare 3 Register value. |
mbed_official | 155:8435094ec241 | 2558 | */ |
mbed_official | 155:8435094ec241 | 2559 | uint32_t TIM_GetCapture3(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 2560 | { |
mbed_official | 155:8435094ec241 | 2561 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2562 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2563 | |
mbed_official | 155:8435094ec241 | 2564 | /* Get the Capture 3 Register value */ |
mbed_official | 155:8435094ec241 | 2565 | return TIMx->CCR3; |
mbed_official | 155:8435094ec241 | 2566 | } |
mbed_official | 155:8435094ec241 | 2567 | |
mbed_official | 155:8435094ec241 | 2568 | /** |
mbed_official | 155:8435094ec241 | 2569 | * @brief Gets the TIMx Input Capture 4 value. |
mbed_official | 155:8435094ec241 | 2570 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2571 | * @retval Capture Compare 4 Register value. |
mbed_official | 155:8435094ec241 | 2572 | */ |
mbed_official | 155:8435094ec241 | 2573 | uint32_t TIM_GetCapture4(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 2574 | { |
mbed_official | 155:8435094ec241 | 2575 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2576 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2577 | |
mbed_official | 155:8435094ec241 | 2578 | /* Get the Capture 4 Register value */ |
mbed_official | 155:8435094ec241 | 2579 | return TIMx->CCR4; |
mbed_official | 155:8435094ec241 | 2580 | } |
mbed_official | 155:8435094ec241 | 2581 | |
mbed_official | 155:8435094ec241 | 2582 | /** |
mbed_official | 155:8435094ec241 | 2583 | * @brief Sets the TIMx Input Capture 1 prescaler. |
mbed_official | 155:8435094ec241 | 2584 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2585 | * @param TIM_ICPSC: specifies the Input Capture1 prescaler new value. |
mbed_official | 155:8435094ec241 | 2586 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2587 | * @arg TIM_ICPSC_DIV1: no prescaler |
mbed_official | 155:8435094ec241 | 2588 | * @arg TIM_ICPSC_DIV2: capture is done once every 2 events |
mbed_official | 155:8435094ec241 | 2589 | * @arg TIM_ICPSC_DIV4: capture is done once every 4 events |
mbed_official | 155:8435094ec241 | 2590 | * @arg TIM_ICPSC_DIV8: capture is done once every 8 events |
mbed_official | 155:8435094ec241 | 2591 | * @retval None |
mbed_official | 155:8435094ec241 | 2592 | */ |
mbed_official | 155:8435094ec241 | 2593 | void TIM_SetIC1Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC) |
mbed_official | 155:8435094ec241 | 2594 | { |
mbed_official | 155:8435094ec241 | 2595 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2596 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2597 | assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC)); |
mbed_official | 155:8435094ec241 | 2598 | |
mbed_official | 155:8435094ec241 | 2599 | /* Reset the IC1PSC Bits */ |
mbed_official | 155:8435094ec241 | 2600 | TIMx->CCMR1 &= (uint32_t)~TIM_CCMR1_IC1PSC; |
mbed_official | 155:8435094ec241 | 2601 | |
mbed_official | 155:8435094ec241 | 2602 | /* Set the IC1PSC value */ |
mbed_official | 155:8435094ec241 | 2603 | TIMx->CCMR1 |= TIM_ICPSC; |
mbed_official | 155:8435094ec241 | 2604 | } |
mbed_official | 155:8435094ec241 | 2605 | |
mbed_official | 155:8435094ec241 | 2606 | /** |
mbed_official | 155:8435094ec241 | 2607 | * @brief Sets the TIMx Input Capture 2 prescaler. |
mbed_official | 155:8435094ec241 | 2608 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 2609 | * peripheral. |
mbed_official | 155:8435094ec241 | 2610 | * @param TIM_ICPSC: specifies the Input Capture2 prescaler new value. |
mbed_official | 155:8435094ec241 | 2611 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2612 | * @arg TIM_ICPSC_DIV1: no prescaler |
mbed_official | 155:8435094ec241 | 2613 | * @arg TIM_ICPSC_DIV2: capture is done once every 2 events |
mbed_official | 155:8435094ec241 | 2614 | * @arg TIM_ICPSC_DIV4: capture is done once every 4 events |
mbed_official | 155:8435094ec241 | 2615 | * @arg TIM_ICPSC_DIV8: capture is done once every 8 events |
mbed_official | 155:8435094ec241 | 2616 | * @retval None |
mbed_official | 155:8435094ec241 | 2617 | */ |
mbed_official | 155:8435094ec241 | 2618 | void TIM_SetIC2Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC) |
mbed_official | 155:8435094ec241 | 2619 | { |
mbed_official | 155:8435094ec241 | 2620 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2621 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2622 | assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC)); |
mbed_official | 155:8435094ec241 | 2623 | |
mbed_official | 155:8435094ec241 | 2624 | /* Reset the IC2PSC Bits */ |
mbed_official | 155:8435094ec241 | 2625 | TIMx->CCMR1 &= (uint32_t)~TIM_CCMR1_IC2PSC; |
mbed_official | 155:8435094ec241 | 2626 | |
mbed_official | 155:8435094ec241 | 2627 | /* Set the IC2PSC value */ |
mbed_official | 155:8435094ec241 | 2628 | TIMx->CCMR1 |= (uint32_t)((uint32_t)TIM_ICPSC << 8); |
mbed_official | 155:8435094ec241 | 2629 | } |
mbed_official | 155:8435094ec241 | 2630 | |
mbed_official | 155:8435094ec241 | 2631 | /** |
mbed_official | 155:8435094ec241 | 2632 | * @brief Sets the TIMx Input Capture 3 prescaler. |
mbed_official | 155:8435094ec241 | 2633 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2634 | * @param TIM_ICPSC: specifies the Input Capture3 prescaler new value. |
mbed_official | 155:8435094ec241 | 2635 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2636 | * @arg TIM_ICPSC_DIV1: no prescaler |
mbed_official | 155:8435094ec241 | 2637 | * @arg TIM_ICPSC_DIV2: capture is done once every 2 events |
mbed_official | 155:8435094ec241 | 2638 | * @arg TIM_ICPSC_DIV4: capture is done once every 4 events |
mbed_official | 155:8435094ec241 | 2639 | * @arg TIM_ICPSC_DIV8: capture is done once every 8 events |
mbed_official | 155:8435094ec241 | 2640 | * @retval None |
mbed_official | 155:8435094ec241 | 2641 | */ |
mbed_official | 155:8435094ec241 | 2642 | void TIM_SetIC3Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC) |
mbed_official | 155:8435094ec241 | 2643 | { |
mbed_official | 155:8435094ec241 | 2644 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2645 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2646 | assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC)); |
mbed_official | 155:8435094ec241 | 2647 | |
mbed_official | 155:8435094ec241 | 2648 | /* Reset the IC3PSC Bits */ |
mbed_official | 155:8435094ec241 | 2649 | TIMx->CCMR2 &= (uint16_t)~TIM_CCMR2_IC3PSC; |
mbed_official | 155:8435094ec241 | 2650 | |
mbed_official | 155:8435094ec241 | 2651 | /* Set the IC3PSC value */ |
mbed_official | 155:8435094ec241 | 2652 | TIMx->CCMR2 |= TIM_ICPSC; |
mbed_official | 155:8435094ec241 | 2653 | } |
mbed_official | 155:8435094ec241 | 2654 | |
mbed_official | 155:8435094ec241 | 2655 | /** |
mbed_official | 155:8435094ec241 | 2656 | * @brief Sets the TIMx Input Capture 4 prescaler. |
mbed_official | 155:8435094ec241 | 2657 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2658 | * @param TIM_ICPSC: specifies the Input Capture4 prescaler new value. |
mbed_official | 155:8435094ec241 | 2659 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2660 | * @arg TIM_ICPSC_DIV1: no prescaler |
mbed_official | 155:8435094ec241 | 2661 | * @arg TIM_ICPSC_DIV2: capture is done once every 2 events |
mbed_official | 155:8435094ec241 | 2662 | * @arg TIM_ICPSC_DIV4: capture is done once every 4 events |
mbed_official | 155:8435094ec241 | 2663 | * @arg TIM_ICPSC_DIV8: capture is done once every 8 events |
mbed_official | 155:8435094ec241 | 2664 | * @retval None |
mbed_official | 155:8435094ec241 | 2665 | */ |
mbed_official | 155:8435094ec241 | 2666 | void TIM_SetIC4Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC) |
mbed_official | 155:8435094ec241 | 2667 | { |
mbed_official | 155:8435094ec241 | 2668 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2669 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2670 | assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC)); |
mbed_official | 155:8435094ec241 | 2671 | |
mbed_official | 155:8435094ec241 | 2672 | /* Reset the IC4PSC Bits */ |
mbed_official | 155:8435094ec241 | 2673 | TIMx->CCMR2 &= (uint16_t)~TIM_CCMR2_IC4PSC; |
mbed_official | 155:8435094ec241 | 2674 | |
mbed_official | 155:8435094ec241 | 2675 | /* Set the IC4PSC value */ |
mbed_official | 155:8435094ec241 | 2676 | TIMx->CCMR2 |= (uint16_t)(TIM_ICPSC << 8); |
mbed_official | 155:8435094ec241 | 2677 | } |
mbed_official | 155:8435094ec241 | 2678 | /** |
mbed_official | 155:8435094ec241 | 2679 | * @} |
mbed_official | 155:8435094ec241 | 2680 | */ |
mbed_official | 155:8435094ec241 | 2681 | |
mbed_official | 155:8435094ec241 | 2682 | /** @defgroup TIM_Group4 Advanced-control timers (TIM1 and TIM8) specific features |
mbed_official | 155:8435094ec241 | 2683 | * @brief Advanced-control timers (TIM1 and TIM8) specific features |
mbed_official | 155:8435094ec241 | 2684 | * |
mbed_official | 155:8435094ec241 | 2685 | @verbatim |
mbed_official | 155:8435094ec241 | 2686 | =============================================================================== |
mbed_official | 155:8435094ec241 | 2687 | ##### Advanced-control timers (TIM1 and TIM8) specific features ##### |
mbed_official | 155:8435094ec241 | 2688 | =============================================================================== |
mbed_official | 155:8435094ec241 | 2689 | |
mbed_official | 155:8435094ec241 | 2690 | *** TIM Driver: how to use the Break feature *** |
mbed_official | 155:8435094ec241 | 2691 | ================================================ |
mbed_official | 155:8435094ec241 | 2692 | [..] |
mbed_official | 155:8435094ec241 | 2693 | After configuring the Timer channel(s) in the appropriate Output Compare mode: |
mbed_official | 155:8435094ec241 | 2694 | |
mbed_official | 155:8435094ec241 | 2695 | (#) Fill the TIM_BDTRInitStruct with the desired parameters for the Timer |
mbed_official | 155:8435094ec241 | 2696 | Break Polarity, dead time, Lock level, the OSSI/OSSR State and the |
mbed_official | 155:8435094ec241 | 2697 | AOE(automatic output enable). |
mbed_official | 155:8435094ec241 | 2698 | |
mbed_official | 155:8435094ec241 | 2699 | (#) Call TIM_BDTRConfig(TIMx, &TIM_BDTRInitStruct) to configure the Timer |
mbed_official | 155:8435094ec241 | 2700 | |
mbed_official | 155:8435094ec241 | 2701 | (#) Enable the Main Output using TIM_CtrlPWMOutputs(TIM1, ENABLE) |
mbed_official | 155:8435094ec241 | 2702 | |
mbed_official | 155:8435094ec241 | 2703 | (#) Once the break even occurs, the Timer's output signals are put in reset |
mbed_official | 155:8435094ec241 | 2704 | state or in a known state (according to the configuration made in |
mbed_official | 155:8435094ec241 | 2705 | TIM_BDTRConfig() function). |
mbed_official | 155:8435094ec241 | 2706 | |
mbed_official | 155:8435094ec241 | 2707 | @endverbatim |
mbed_official | 155:8435094ec241 | 2708 | * @{ |
mbed_official | 155:8435094ec241 | 2709 | */ |
mbed_official | 155:8435094ec241 | 2710 | |
mbed_official | 155:8435094ec241 | 2711 | /** |
mbed_official | 155:8435094ec241 | 2712 | * @brief Configures the Break feature, dead time, Lock level, OSSI/OSSR State |
mbed_official | 155:8435094ec241 | 2713 | * and the AOE(automatic output enable). |
mbed_official | 155:8435094ec241 | 2714 | * @param TIMx: where x can be 1, 8, 15, 16 or 17 to select the TIM |
mbed_official | 155:8435094ec241 | 2715 | * @param TIM_BDTRInitStruct: pointer to a TIM_BDTRInitTypeDef structure that |
mbed_official | 155:8435094ec241 | 2716 | * contains the BDTR Register configuration information for the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2717 | * @retval None |
mbed_official | 155:8435094ec241 | 2718 | */ |
mbed_official | 155:8435094ec241 | 2719 | void TIM_BDTRConfig(TIM_TypeDef* TIMx, TIM_BDTRInitTypeDef *TIM_BDTRInitStruct) |
mbed_official | 155:8435094ec241 | 2720 | { |
mbed_official | 155:8435094ec241 | 2721 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2722 | assert_param(IS_TIM_LIST6_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2723 | assert_param(IS_TIM_OSSR_STATE(TIM_BDTRInitStruct->TIM_OSSRState)); |
mbed_official | 155:8435094ec241 | 2724 | assert_param(IS_TIM_OSSI_STATE(TIM_BDTRInitStruct->TIM_OSSIState)); |
mbed_official | 155:8435094ec241 | 2725 | assert_param(IS_TIM_LOCK_LEVEL(TIM_BDTRInitStruct->TIM_LOCKLevel)); |
mbed_official | 155:8435094ec241 | 2726 | assert_param(IS_TIM_BREAK_STATE(TIM_BDTRInitStruct->TIM_Break)); |
mbed_official | 155:8435094ec241 | 2727 | assert_param(IS_TIM_BREAK_POLARITY(TIM_BDTRInitStruct->TIM_BreakPolarity)); |
mbed_official | 155:8435094ec241 | 2728 | assert_param(IS_TIM_AUTOMATIC_OUTPUT_STATE(TIM_BDTRInitStruct->TIM_AutomaticOutput)); |
mbed_official | 155:8435094ec241 | 2729 | |
mbed_official | 155:8435094ec241 | 2730 | /* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State, |
mbed_official | 155:8435094ec241 | 2731 | the OSSI State, the dead time value and the Automatic Output Enable Bit */ |
mbed_official | 155:8435094ec241 | 2732 | TIMx->BDTR = (uint32_t)TIM_BDTRInitStruct->TIM_OSSRState | TIM_BDTRInitStruct->TIM_OSSIState | |
mbed_official | 155:8435094ec241 | 2733 | TIM_BDTRInitStruct->TIM_LOCKLevel | TIM_BDTRInitStruct->TIM_DeadTime | |
mbed_official | 155:8435094ec241 | 2734 | TIM_BDTRInitStruct->TIM_Break | TIM_BDTRInitStruct->TIM_BreakPolarity | |
mbed_official | 155:8435094ec241 | 2735 | TIM_BDTRInitStruct->TIM_AutomaticOutput; |
mbed_official | 155:8435094ec241 | 2736 | } |
mbed_official | 155:8435094ec241 | 2737 | |
mbed_official | 155:8435094ec241 | 2738 | /** |
mbed_official | 155:8435094ec241 | 2739 | * @brief Configures the Break1 feature. |
mbed_official | 155:8435094ec241 | 2740 | * @param TIMx: where x can be 1 or 8 to select the TIM |
mbed_official | 155:8435094ec241 | 2741 | * @param TIM_Break1Polarity: specifies the Break1 polarity. |
mbed_official | 155:8435094ec241 | 2742 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2743 | * @arg TIM_Break1Polarity_Low: Break1 input is active low |
mbed_official | 155:8435094ec241 | 2744 | * @arg TIM_Break1Polarity_High: Break1 input is active high |
mbed_official | 155:8435094ec241 | 2745 | * @param TIM_Break1Filter: specifies the Break1 filter value. |
mbed_official | 155:8435094ec241 | 2746 | * This parameter must be a value between 0x00 and 0x0F |
mbed_official | 155:8435094ec241 | 2747 | * @retval None |
mbed_official | 155:8435094ec241 | 2748 | */ |
mbed_official | 155:8435094ec241 | 2749 | void TIM_Break1Config(TIM_TypeDef* TIMx, uint32_t TIM_Break1Polarity, uint8_t TIM_Break1Filter) |
mbed_official | 155:8435094ec241 | 2750 | { /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2751 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2752 | assert_param(IS_TIM_BREAK1_FILTER(TIM_Break1Filter)); |
mbed_official | 155:8435094ec241 | 2753 | |
mbed_official | 155:8435094ec241 | 2754 | /* Reset the BKP and BKF Bits */ |
mbed_official | 155:8435094ec241 | 2755 | TIMx->BDTR &= (uint32_t)~ (TIM_BDTR_BKP | TIM_BDTR_BKF); |
mbed_official | 155:8435094ec241 | 2756 | /* Configure the Break1 polarity and filter */ |
mbed_official | 155:8435094ec241 | 2757 | TIMx->BDTR |= TIM_Break1Polarity |((uint32_t)TIM_Break1Filter << 16); |
mbed_official | 155:8435094ec241 | 2758 | } |
mbed_official | 155:8435094ec241 | 2759 | |
mbed_official | 155:8435094ec241 | 2760 | /** |
mbed_official | 155:8435094ec241 | 2761 | * @brief Configures the Break2 feature. |
mbed_official | 155:8435094ec241 | 2762 | * @param TIMx: where x can be 1 or 8 to select the TIM |
mbed_official | 155:8435094ec241 | 2763 | * @param TIM_Break2Polarity: specifies the Break2 polarity. |
mbed_official | 155:8435094ec241 | 2764 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 2765 | * @arg TIM_Break2Polarity_Low: Break2 input is active low |
mbed_official | 155:8435094ec241 | 2766 | * @arg TIM_Break2Polarity_High: Break2 input is active high |
mbed_official | 155:8435094ec241 | 2767 | * @param TIM_Break2Filter: specifies the Break2 filter value. |
mbed_official | 155:8435094ec241 | 2768 | * This parameter must be a value between 0x00 and 0x0F |
mbed_official | 155:8435094ec241 | 2769 | * @retval None |
mbed_official | 155:8435094ec241 | 2770 | */ |
mbed_official | 155:8435094ec241 | 2771 | void TIM_Break2Config(TIM_TypeDef* TIMx, uint32_t TIM_Break2Polarity, uint8_t TIM_Break2Filter) |
mbed_official | 155:8435094ec241 | 2772 | { |
mbed_official | 155:8435094ec241 | 2773 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2774 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2775 | assert_param(IS_TIM_BREAK2_FILTER(TIM_Break2Filter)); |
mbed_official | 155:8435094ec241 | 2776 | |
mbed_official | 155:8435094ec241 | 2777 | /* Reset the BKP and BKF Bits */ |
mbed_official | 155:8435094ec241 | 2778 | TIMx->BDTR &= (uint32_t)~ (TIM_BDTR_BK2P | TIM_BDTR_BK2F); |
mbed_official | 155:8435094ec241 | 2779 | |
mbed_official | 155:8435094ec241 | 2780 | /* Configure the Break1 polarity and filter */ |
mbed_official | 155:8435094ec241 | 2781 | TIMx->BDTR |= TIM_Break2Polarity |((uint32_t)TIM_Break2Filter << 20); |
mbed_official | 155:8435094ec241 | 2782 | } |
mbed_official | 155:8435094ec241 | 2783 | |
mbed_official | 155:8435094ec241 | 2784 | /** |
mbed_official | 155:8435094ec241 | 2785 | * @brief Enables or disables the TIM Break1 input. |
mbed_official | 155:8435094ec241 | 2786 | * @param TIMx: where x can be 1, 8, 1, 16 or 17 to select the TIMx peripheral. |
mbed_official | 155:8435094ec241 | 2787 | * @param NewState: new state of the TIM Break1 input. |
mbed_official | 155:8435094ec241 | 2788 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 2789 | * @retval None |
mbed_official | 155:8435094ec241 | 2790 | */ |
mbed_official | 155:8435094ec241 | 2791 | void TIM_Break1Cmd(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 2792 | { |
mbed_official | 155:8435094ec241 | 2793 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2794 | assert_param(IS_TIM_LIST6_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2795 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 2796 | |
mbed_official | 155:8435094ec241 | 2797 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 2798 | { |
mbed_official | 155:8435094ec241 | 2799 | /* Enable the Break1 */ |
mbed_official | 155:8435094ec241 | 2800 | TIMx->BDTR |= TIM_BDTR_BKE; |
mbed_official | 155:8435094ec241 | 2801 | } |
mbed_official | 155:8435094ec241 | 2802 | else |
mbed_official | 155:8435094ec241 | 2803 | { |
mbed_official | 155:8435094ec241 | 2804 | /* Disable the Break1 */ |
mbed_official | 155:8435094ec241 | 2805 | TIMx->BDTR &= (uint32_t)~TIM_BDTR_BKE; |
mbed_official | 155:8435094ec241 | 2806 | } |
mbed_official | 155:8435094ec241 | 2807 | } |
mbed_official | 155:8435094ec241 | 2808 | |
mbed_official | 155:8435094ec241 | 2809 | /** |
mbed_official | 155:8435094ec241 | 2810 | * @brief Enables or disables the TIM Break2 input. |
mbed_official | 155:8435094ec241 | 2811 | * @param TIMx: where x can be 1 or 8 to select the TIMx peripheral. |
mbed_official | 155:8435094ec241 | 2812 | * @param NewState: new state of the TIM Break2 input. |
mbed_official | 155:8435094ec241 | 2813 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 2814 | * @retval None |
mbed_official | 155:8435094ec241 | 2815 | */ |
mbed_official | 155:8435094ec241 | 2816 | void TIM_Break2Cmd(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 2817 | { |
mbed_official | 155:8435094ec241 | 2818 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2819 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2820 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 2821 | |
mbed_official | 155:8435094ec241 | 2822 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 2823 | { |
mbed_official | 155:8435094ec241 | 2824 | /* Enable the Break1 */ |
mbed_official | 155:8435094ec241 | 2825 | TIMx->BDTR |= TIM_BDTR_BK2E; |
mbed_official | 155:8435094ec241 | 2826 | } |
mbed_official | 155:8435094ec241 | 2827 | else |
mbed_official | 155:8435094ec241 | 2828 | { |
mbed_official | 155:8435094ec241 | 2829 | /* Disable the Break1 */ |
mbed_official | 155:8435094ec241 | 2830 | TIMx->BDTR &= (uint32_t)~TIM_BDTR_BK2E; |
mbed_official | 155:8435094ec241 | 2831 | } |
mbed_official | 155:8435094ec241 | 2832 | } |
mbed_official | 155:8435094ec241 | 2833 | |
mbed_official | 155:8435094ec241 | 2834 | /** |
mbed_official | 155:8435094ec241 | 2835 | * @brief Fills each TIM_BDTRInitStruct member with its default value. |
mbed_official | 155:8435094ec241 | 2836 | * @param TIM_BDTRInitStruct: pointer to a TIM_BDTRInitTypeDef structure which |
mbed_official | 155:8435094ec241 | 2837 | * will be initialized. |
mbed_official | 155:8435094ec241 | 2838 | * @retval None |
mbed_official | 155:8435094ec241 | 2839 | */ |
mbed_official | 155:8435094ec241 | 2840 | void TIM_BDTRStructInit(TIM_BDTRInitTypeDef* TIM_BDTRInitStruct) |
mbed_official | 155:8435094ec241 | 2841 | { |
mbed_official | 155:8435094ec241 | 2842 | /* Set the default configuration */ |
mbed_official | 155:8435094ec241 | 2843 | TIM_BDTRInitStruct->TIM_OSSRState = TIM_OSSRState_Disable; |
mbed_official | 155:8435094ec241 | 2844 | TIM_BDTRInitStruct->TIM_OSSIState = TIM_OSSIState_Disable; |
mbed_official | 155:8435094ec241 | 2845 | TIM_BDTRInitStruct->TIM_LOCKLevel = TIM_LOCKLevel_OFF; |
mbed_official | 155:8435094ec241 | 2846 | TIM_BDTRInitStruct->TIM_DeadTime = 0x00; |
mbed_official | 155:8435094ec241 | 2847 | TIM_BDTRInitStruct->TIM_Break = TIM_Break_Disable; |
mbed_official | 155:8435094ec241 | 2848 | TIM_BDTRInitStruct->TIM_BreakPolarity = TIM_BreakPolarity_Low; |
mbed_official | 155:8435094ec241 | 2849 | TIM_BDTRInitStruct->TIM_AutomaticOutput = TIM_AutomaticOutput_Disable; |
mbed_official | 155:8435094ec241 | 2850 | } |
mbed_official | 155:8435094ec241 | 2851 | |
mbed_official | 155:8435094ec241 | 2852 | /** |
mbed_official | 155:8435094ec241 | 2853 | * @brief Enables or disables the TIM peripheral Main Outputs. |
mbed_official | 155:8435094ec241 | 2854 | * @param TIMx: where x can be 1, 8, 15, 16 or 17 to select the TIMx peripheral. |
mbed_official | 155:8435094ec241 | 2855 | * @param NewState: new state of the TIM peripheral Main Outputs. |
mbed_official | 155:8435094ec241 | 2856 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 2857 | * @retval None |
mbed_official | 155:8435094ec241 | 2858 | */ |
mbed_official | 155:8435094ec241 | 2859 | void TIM_CtrlPWMOutputs(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 2860 | { |
mbed_official | 155:8435094ec241 | 2861 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2862 | assert_param(IS_TIM_LIST6_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2863 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 2864 | |
mbed_official | 155:8435094ec241 | 2865 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 2866 | { |
mbed_official | 155:8435094ec241 | 2867 | /* Enable the TIM Main Output */ |
mbed_official | 155:8435094ec241 | 2868 | TIMx->BDTR |= TIM_BDTR_MOE; |
mbed_official | 155:8435094ec241 | 2869 | } |
mbed_official | 155:8435094ec241 | 2870 | else |
mbed_official | 155:8435094ec241 | 2871 | { |
mbed_official | 155:8435094ec241 | 2872 | /* Disable the TIM Main Output */ |
mbed_official | 155:8435094ec241 | 2873 | TIMx->BDTR &= (uint16_t)~TIM_BDTR_MOE; |
mbed_official | 155:8435094ec241 | 2874 | } |
mbed_official | 155:8435094ec241 | 2875 | } |
mbed_official | 155:8435094ec241 | 2876 | |
mbed_official | 155:8435094ec241 | 2877 | /** |
mbed_official | 155:8435094ec241 | 2878 | * @brief Selects the TIM peripheral Commutation event. |
mbed_official | 155:8435094ec241 | 2879 | * @param TIMx: where x can be 1, 8, 15, 16 or 17 to select the TIMx peripheral |
mbed_official | 155:8435094ec241 | 2880 | * @param NewState: new state of the Commutation event. |
mbed_official | 155:8435094ec241 | 2881 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 2882 | * @retval None |
mbed_official | 155:8435094ec241 | 2883 | */ |
mbed_official | 155:8435094ec241 | 2884 | void TIM_SelectCOM(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 2885 | { |
mbed_official | 155:8435094ec241 | 2886 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2887 | assert_param(IS_TIM_LIST6_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2888 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 2889 | |
mbed_official | 155:8435094ec241 | 2890 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 2891 | { |
mbed_official | 155:8435094ec241 | 2892 | /* Set the COM Bit */ |
mbed_official | 155:8435094ec241 | 2893 | TIMx->CR2 |= TIM_CR2_CCUS; |
mbed_official | 155:8435094ec241 | 2894 | } |
mbed_official | 155:8435094ec241 | 2895 | else |
mbed_official | 155:8435094ec241 | 2896 | { |
mbed_official | 155:8435094ec241 | 2897 | /* Reset the COM Bit */ |
mbed_official | 155:8435094ec241 | 2898 | TIMx->CR2 &= (uint16_t)~TIM_CR2_CCUS; |
mbed_official | 155:8435094ec241 | 2899 | } |
mbed_official | 155:8435094ec241 | 2900 | } |
mbed_official | 155:8435094ec241 | 2901 | |
mbed_official | 155:8435094ec241 | 2902 | /** |
mbed_official | 155:8435094ec241 | 2903 | * @brief Sets or Resets the TIM peripheral Capture Compare Preload Control bit. |
mbed_official | 155:8435094ec241 | 2904 | * @param TIMx: where x can be 1 or 8 to select the TIMx peripheral |
mbed_official | 155:8435094ec241 | 2905 | * @param NewState: new state of the Capture Compare Preload Control bit |
mbed_official | 155:8435094ec241 | 2906 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 2907 | * @retval None |
mbed_official | 155:8435094ec241 | 2908 | */ |
mbed_official | 155:8435094ec241 | 2909 | void TIM_CCPreloadControl(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 2910 | { |
mbed_official | 155:8435094ec241 | 2911 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2912 | assert_param(IS_TIM_LIST6_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2913 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 2914 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 2915 | { |
mbed_official | 155:8435094ec241 | 2916 | /* Set the CCPC Bit */ |
mbed_official | 155:8435094ec241 | 2917 | TIMx->CR2 |= TIM_CR2_CCPC; |
mbed_official | 155:8435094ec241 | 2918 | } |
mbed_official | 155:8435094ec241 | 2919 | else |
mbed_official | 155:8435094ec241 | 2920 | { |
mbed_official | 155:8435094ec241 | 2921 | /* Reset the CCPC Bit */ |
mbed_official | 155:8435094ec241 | 2922 | TIMx->CR2 &= (uint16_t)~TIM_CR2_CCPC; |
mbed_official | 155:8435094ec241 | 2923 | } |
mbed_official | 155:8435094ec241 | 2924 | } |
mbed_official | 155:8435094ec241 | 2925 | /** |
mbed_official | 155:8435094ec241 | 2926 | * @} |
mbed_official | 155:8435094ec241 | 2927 | */ |
mbed_official | 155:8435094ec241 | 2928 | |
mbed_official | 155:8435094ec241 | 2929 | /** @defgroup TIM_Group5 Interrupts DMA and flags management functions |
mbed_official | 155:8435094ec241 | 2930 | * @brief Interrupts, DMA and flags management functions |
mbed_official | 155:8435094ec241 | 2931 | * |
mbed_official | 155:8435094ec241 | 2932 | @verbatim |
mbed_official | 155:8435094ec241 | 2933 | =============================================================================== |
mbed_official | 155:8435094ec241 | 2934 | ##### Interrupts, DMA and flags management functions ##### |
mbed_official | 155:8435094ec241 | 2935 | =============================================================================== |
mbed_official | 155:8435094ec241 | 2936 | |
mbed_official | 155:8435094ec241 | 2937 | @endverbatim |
mbed_official | 155:8435094ec241 | 2938 | * @{ |
mbed_official | 155:8435094ec241 | 2939 | */ |
mbed_official | 155:8435094ec241 | 2940 | |
mbed_official | 155:8435094ec241 | 2941 | /** |
mbed_official | 155:8435094ec241 | 2942 | * @brief Enables or disables the specified TIM interrupts. |
mbed_official | 155:8435094ec241 | 2943 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select the TIMx peripheral. |
mbed_official | 155:8435094ec241 | 2944 | * @param TIM_IT: specifies the TIM interrupts sources to be enabled or disabled. |
mbed_official | 155:8435094ec241 | 2945 | * This parameter can be any combination of the following values: |
mbed_official | 155:8435094ec241 | 2946 | * @arg TIM_IT_Update: TIM update Interrupt source |
mbed_official | 155:8435094ec241 | 2947 | * @arg TIM_IT_CC1: TIM Capture Compare 1 Interrupt source |
mbed_official | 155:8435094ec241 | 2948 | * @arg TIM_IT_CC2: TIM Capture Compare 2 Interrupt source |
mbed_official | 155:8435094ec241 | 2949 | * @arg TIM_IT_CC3: TIM Capture Compare 3 Interrupt source |
mbed_official | 155:8435094ec241 | 2950 | * @arg TIM_IT_CC4: TIM Capture Compare 4 Interrupt source |
mbed_official | 155:8435094ec241 | 2951 | * @arg TIM_IT_COM: TIM Commutation Interrupt source |
mbed_official | 155:8435094ec241 | 2952 | * @arg TIM_IT_Trigger: TIM Trigger Interrupt source |
mbed_official | 155:8435094ec241 | 2953 | * @arg TIM_IT_Break: TIM Break Interrupt source |
mbed_official | 155:8435094ec241 | 2954 | * |
mbed_official | 155:8435094ec241 | 2955 | * @note For TIM6 and TIM7 only the parameter TIM_IT_Update can be used |
mbed_official | 155:8435094ec241 | 2956 | * @note For TIM9 and TIM12 only one of the following parameters can be used: TIM_IT_Update, |
mbed_official | 155:8435094ec241 | 2957 | * TIM_IT_CC1, TIM_IT_CC2 or TIM_IT_Trigger. |
mbed_official | 155:8435094ec241 | 2958 | * @note For TIM10, TIM11, TIM13 and TIM14 only one of the following parameters can |
mbed_official | 155:8435094ec241 | 2959 | * be used: TIM_IT_Update or TIM_IT_CC1 |
mbed_official | 155:8435094ec241 | 2960 | * @note TIM_IT_COM and TIM_IT_Break can be used only with TIM1 and TIM8 |
mbed_official | 155:8435094ec241 | 2961 | * |
mbed_official | 155:8435094ec241 | 2962 | * @param NewState: new state of the TIM interrupts. |
mbed_official | 155:8435094ec241 | 2963 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 2964 | * @retval None |
mbed_official | 155:8435094ec241 | 2965 | */ |
mbed_official | 155:8435094ec241 | 2966 | void TIM_ITConfig(TIM_TypeDef* TIMx, uint16_t TIM_IT, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 2967 | { |
mbed_official | 155:8435094ec241 | 2968 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 2969 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 2970 | assert_param(IS_TIM_IT(TIM_IT)); |
mbed_official | 155:8435094ec241 | 2971 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 2972 | |
mbed_official | 155:8435094ec241 | 2973 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 2974 | { |
mbed_official | 155:8435094ec241 | 2975 | /* Enable the Interrupt sources */ |
mbed_official | 155:8435094ec241 | 2976 | TIMx->DIER |= TIM_IT; |
mbed_official | 155:8435094ec241 | 2977 | } |
mbed_official | 155:8435094ec241 | 2978 | else |
mbed_official | 155:8435094ec241 | 2979 | { |
mbed_official | 155:8435094ec241 | 2980 | /* Disable the Interrupt sources */ |
mbed_official | 155:8435094ec241 | 2981 | TIMx->DIER &= (uint16_t)~TIM_IT; |
mbed_official | 155:8435094ec241 | 2982 | } |
mbed_official | 155:8435094ec241 | 2983 | } |
mbed_official | 155:8435094ec241 | 2984 | |
mbed_official | 155:8435094ec241 | 2985 | /** |
mbed_official | 155:8435094ec241 | 2986 | * @brief Configures the TIMx event to be generate by software. |
mbed_official | 155:8435094ec241 | 2987 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 2988 | * @param TIM_EventSource: specifies the event source. |
mbed_official | 155:8435094ec241 | 2989 | * This parameter can be one or more of the following values: |
mbed_official | 155:8435094ec241 | 2990 | * @arg TIM_EventSource_Update: Timer update Event source |
mbed_official | 155:8435094ec241 | 2991 | * @arg TIM_EventSource_CC1: Timer Capture Compare 1 Event source |
mbed_official | 155:8435094ec241 | 2992 | * @arg TIM_EventSource_CC2: Timer Capture Compare 2 Event source |
mbed_official | 155:8435094ec241 | 2993 | * @arg TIM_EventSource_CC3: Timer Capture Compare 3 Event source |
mbed_official | 155:8435094ec241 | 2994 | * @arg TIM_EventSource_CC4: Timer Capture Compare 4 Event source |
mbed_official | 155:8435094ec241 | 2995 | * @arg TIM_EventSource_COM: Timer COM event source |
mbed_official | 155:8435094ec241 | 2996 | * @arg TIM_EventSource_Trigger: Timer Trigger Event source |
mbed_official | 155:8435094ec241 | 2997 | * @arg TIM_EventSource_Break: Timer Break event source |
mbed_official | 155:8435094ec241 | 2998 | * |
mbed_official | 155:8435094ec241 | 2999 | * @note TIM6 and TIM7 can only generate an update event. |
mbed_official | 155:8435094ec241 | 3000 | * @note TIM_EventSource_COM and TIM_EventSource_Break are used only with TIM1 and TIM8. |
mbed_official | 155:8435094ec241 | 3001 | * |
mbed_official | 155:8435094ec241 | 3002 | * @retval None |
mbed_official | 155:8435094ec241 | 3003 | */ |
mbed_official | 155:8435094ec241 | 3004 | void TIM_GenerateEvent(TIM_TypeDef* TIMx, uint16_t TIM_EventSource) |
mbed_official | 155:8435094ec241 | 3005 | { |
mbed_official | 155:8435094ec241 | 3006 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3007 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3008 | assert_param(IS_TIM_EVENT_SOURCE(TIM_EventSource)); |
mbed_official | 155:8435094ec241 | 3009 | |
mbed_official | 155:8435094ec241 | 3010 | /* Set the event sources */ |
mbed_official | 155:8435094ec241 | 3011 | TIMx->EGR = TIM_EventSource; |
mbed_official | 155:8435094ec241 | 3012 | } |
mbed_official | 155:8435094ec241 | 3013 | |
mbed_official | 155:8435094ec241 | 3014 | /** |
mbed_official | 155:8435094ec241 | 3015 | * @brief Checks whether the specified TIM flag is set or not. |
mbed_official | 155:8435094ec241 | 3016 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3017 | * @param TIM_FLAG: specifies the flag to check. |
mbed_official | 155:8435094ec241 | 3018 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3019 | * @arg TIM_FLAG_Update: TIM update Flag |
mbed_official | 155:8435094ec241 | 3020 | * @arg TIM_FLAG_CC1: TIM Capture Compare 1 Flag |
mbed_official | 155:8435094ec241 | 3021 | * @arg TIM_FLAG_CC2: TIM Capture Compare 2 Flag |
mbed_official | 155:8435094ec241 | 3022 | * @arg TIM_FLAG_CC3: TIM Capture Compare 3 Flag |
mbed_official | 155:8435094ec241 | 3023 | * @arg TIM_FLAG_CC4: TIM Capture Compare 4 Flag |
mbed_official | 155:8435094ec241 | 3024 | * @arg TIM_FLAG_CC5: TIM Capture Compare 5 Flag |
mbed_official | 155:8435094ec241 | 3025 | * @arg TIM_FLAG_CC6: TIM Capture Compare 6 Flag |
mbed_official | 155:8435094ec241 | 3026 | * @arg TIM_FLAG_COM: TIM Commutation Flag |
mbed_official | 155:8435094ec241 | 3027 | * @arg TIM_FLAG_Trigger: TIM Trigger Flag |
mbed_official | 155:8435094ec241 | 3028 | * @arg TIM_FLAG_Break: TIM Break Flag |
mbed_official | 155:8435094ec241 | 3029 | * @arg TIM_FLAG_CC1OF: TIM Capture Compare 1 over capture Flag |
mbed_official | 155:8435094ec241 | 3030 | * @arg TIM_FLAG_CC2OF: TIM Capture Compare 2 over capture Flag |
mbed_official | 155:8435094ec241 | 3031 | * @arg TIM_FLAG_CC3OF: TIM Capture Compare 3 over capture Flag |
mbed_official | 155:8435094ec241 | 3032 | * @arg TIM_FLAG_CC4OF: TIM Capture Compare 4 over capture Flag |
mbed_official | 155:8435094ec241 | 3033 | * |
mbed_official | 155:8435094ec241 | 3034 | * @note TIM6 and TIM7 can have only one update flag. |
mbed_official | 155:8435094ec241 | 3035 | * @note TIM_FLAG_COM and TIM_FLAG_Break are used only with TIM1 and TIM8. |
mbed_official | 155:8435094ec241 | 3036 | * |
mbed_official | 155:8435094ec241 | 3037 | * @retval The new state of TIM_FLAG (SET or RESET). |
mbed_official | 155:8435094ec241 | 3038 | */ |
mbed_official | 155:8435094ec241 | 3039 | FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, uint32_t TIM_FLAG) |
mbed_official | 155:8435094ec241 | 3040 | { |
mbed_official | 155:8435094ec241 | 3041 | ITStatus bitstatus = RESET; |
mbed_official | 155:8435094ec241 | 3042 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3043 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3044 | assert_param(IS_TIM_GET_FLAG(TIM_FLAG)); |
mbed_official | 155:8435094ec241 | 3045 | |
mbed_official | 155:8435094ec241 | 3046 | |
mbed_official | 155:8435094ec241 | 3047 | if ((TIMx->SR & TIM_FLAG) != RESET) |
mbed_official | 155:8435094ec241 | 3048 | { |
mbed_official | 155:8435094ec241 | 3049 | bitstatus = SET; |
mbed_official | 155:8435094ec241 | 3050 | } |
mbed_official | 155:8435094ec241 | 3051 | else |
mbed_official | 155:8435094ec241 | 3052 | { |
mbed_official | 155:8435094ec241 | 3053 | bitstatus = RESET; |
mbed_official | 155:8435094ec241 | 3054 | } |
mbed_official | 155:8435094ec241 | 3055 | return bitstatus; |
mbed_official | 155:8435094ec241 | 3056 | } |
mbed_official | 155:8435094ec241 | 3057 | |
mbed_official | 155:8435094ec241 | 3058 | /** |
mbed_official | 155:8435094ec241 | 3059 | * @brief Clears the TIMx's pending flags. |
mbed_official | 155:8435094ec241 | 3060 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3061 | * @param TIM_FLAG: specifies the flag bit to clear. |
mbed_official | 155:8435094ec241 | 3062 | * This parameter can be any combination of the following values: |
mbed_official | 155:8435094ec241 | 3063 | * @arg TIM_FLAG_Update: TIM update Flag |
mbed_official | 155:8435094ec241 | 3064 | * @arg TIM_FLAG_CC1: TIM Capture Compare 1 Flag |
mbed_official | 155:8435094ec241 | 3065 | * @arg TIM_FLAG_CC2: TIM Capture Compare 2 Flag |
mbed_official | 155:8435094ec241 | 3066 | * @arg TIM_FLAG_CC3: TIM Capture Compare 3 Flag |
mbed_official | 155:8435094ec241 | 3067 | * @arg TIM_FLAG_CC4: TIM Capture Compare 4 Flag |
mbed_official | 155:8435094ec241 | 3068 | * @arg TIM_FLAG_CC5: TIM Capture Compare 5 Flag |
mbed_official | 155:8435094ec241 | 3069 | * @arg TIM_FLAG_CC6: TIM Capture Compare 6 Flag |
mbed_official | 155:8435094ec241 | 3070 | * @arg TIM_FLAG_COM: TIM Commutation Flag |
mbed_official | 155:8435094ec241 | 3071 | * @arg TIM_FLAG_Trigger: TIM Trigger Flag |
mbed_official | 155:8435094ec241 | 3072 | * @arg TIM_FLAG_Break: TIM Break Flag |
mbed_official | 155:8435094ec241 | 3073 | * @arg TIM_FLAG_CC1OF: TIM Capture Compare 1 over capture Flag |
mbed_official | 155:8435094ec241 | 3074 | * @arg TIM_FLAG_CC2OF: TIM Capture Compare 2 over capture Flag |
mbed_official | 155:8435094ec241 | 3075 | * @arg TIM_FLAG_CC3OF: TIM Capture Compare 3 over capture Flag |
mbed_official | 155:8435094ec241 | 3076 | * @arg TIM_FLAG_CC4OF: TIM Capture Compare 4 over capture Flag |
mbed_official | 155:8435094ec241 | 3077 | * |
mbed_official | 155:8435094ec241 | 3078 | * @note TIM6 and TIM7 can have only one update flag. |
mbed_official | 155:8435094ec241 | 3079 | * @note TIM_FLAG_COM and TIM_FLAG_Break are used only with TIM1 and TIM8. |
mbed_official | 155:8435094ec241 | 3080 | * |
mbed_official | 155:8435094ec241 | 3081 | * @retval None |
mbed_official | 155:8435094ec241 | 3082 | */ |
mbed_official | 155:8435094ec241 | 3083 | void TIM_ClearFlag(TIM_TypeDef* TIMx, uint16_t TIM_FLAG) |
mbed_official | 155:8435094ec241 | 3084 | { |
mbed_official | 155:8435094ec241 | 3085 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3086 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3087 | |
mbed_official | 155:8435094ec241 | 3088 | /* Clear the flags */ |
mbed_official | 155:8435094ec241 | 3089 | TIMx->SR = (uint16_t)~TIM_FLAG; |
mbed_official | 155:8435094ec241 | 3090 | } |
mbed_official | 155:8435094ec241 | 3091 | |
mbed_official | 155:8435094ec241 | 3092 | /** |
mbed_official | 155:8435094ec241 | 3093 | * @brief Checks whether the TIM interrupt has occurred or not. |
mbed_official | 155:8435094ec241 | 3094 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3095 | * @param TIM_IT: specifies the TIM interrupt source to check. |
mbed_official | 155:8435094ec241 | 3096 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3097 | * @arg TIM_IT_Update: TIM update Interrupt source |
mbed_official | 155:8435094ec241 | 3098 | * @arg TIM_IT_CC1: TIM Capture Compare 1 Interrupt source |
mbed_official | 155:8435094ec241 | 3099 | * @arg TIM_IT_CC2: TIM Capture Compare 2 Interrupt source |
mbed_official | 155:8435094ec241 | 3100 | * @arg TIM_IT_CC3: TIM Capture Compare 3 Interrupt source |
mbed_official | 155:8435094ec241 | 3101 | * @arg TIM_IT_CC4: TIM Capture Compare 4 Interrupt source |
mbed_official | 155:8435094ec241 | 3102 | * @arg TIM_IT_COM: TIM Commutation Interrupt source |
mbed_official | 155:8435094ec241 | 3103 | * @arg TIM_IT_Trigger: TIM Trigger Interrupt source |
mbed_official | 155:8435094ec241 | 3104 | * @arg TIM_IT_Break: TIM Break Interrupt source |
mbed_official | 155:8435094ec241 | 3105 | * |
mbed_official | 155:8435094ec241 | 3106 | * @note TIM6 and TIM7 can generate only an update interrupt. |
mbed_official | 155:8435094ec241 | 3107 | * @note TIM_IT_COM and TIM_IT_Break are used only with TIM1 and TIM8. |
mbed_official | 155:8435094ec241 | 3108 | * |
mbed_official | 155:8435094ec241 | 3109 | * @retval The new state of the TIM_IT(SET or RESET). |
mbed_official | 155:8435094ec241 | 3110 | */ |
mbed_official | 155:8435094ec241 | 3111 | ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, uint16_t TIM_IT) |
mbed_official | 155:8435094ec241 | 3112 | { |
mbed_official | 155:8435094ec241 | 3113 | ITStatus bitstatus = RESET; |
mbed_official | 155:8435094ec241 | 3114 | uint16_t itstatus = 0x0, itenable = 0x0; |
mbed_official | 155:8435094ec241 | 3115 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3116 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3117 | assert_param(IS_TIM_GET_IT(TIM_IT)); |
mbed_official | 155:8435094ec241 | 3118 | |
mbed_official | 155:8435094ec241 | 3119 | itstatus = TIMx->SR & TIM_IT; |
mbed_official | 155:8435094ec241 | 3120 | |
mbed_official | 155:8435094ec241 | 3121 | itenable = TIMx->DIER & TIM_IT; |
mbed_official | 155:8435094ec241 | 3122 | if ((itstatus != (uint16_t)RESET) && (itenable != (uint16_t)RESET)) |
mbed_official | 155:8435094ec241 | 3123 | { |
mbed_official | 155:8435094ec241 | 3124 | bitstatus = SET; |
mbed_official | 155:8435094ec241 | 3125 | } |
mbed_official | 155:8435094ec241 | 3126 | else |
mbed_official | 155:8435094ec241 | 3127 | { |
mbed_official | 155:8435094ec241 | 3128 | bitstatus = RESET; |
mbed_official | 155:8435094ec241 | 3129 | } |
mbed_official | 155:8435094ec241 | 3130 | return bitstatus; |
mbed_official | 155:8435094ec241 | 3131 | } |
mbed_official | 155:8435094ec241 | 3132 | |
mbed_official | 155:8435094ec241 | 3133 | /** |
mbed_official | 155:8435094ec241 | 3134 | * @brief Clears the TIMx's interrupt pending bits. |
mbed_official | 155:8435094ec241 | 3135 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3136 | * @param TIM_IT: specifies the pending bit to clear. |
mbed_official | 155:8435094ec241 | 3137 | * This parameter can be any combination of the following values: |
mbed_official | 155:8435094ec241 | 3138 | * @arg TIM_IT_Update: TIM1 update Interrupt source |
mbed_official | 155:8435094ec241 | 3139 | * @arg TIM_IT_CC1: TIM Capture Compare 1 Interrupt source |
mbed_official | 155:8435094ec241 | 3140 | * @arg TIM_IT_CC2: TIM Capture Compare 2 Interrupt source |
mbed_official | 155:8435094ec241 | 3141 | * @arg TIM_IT_CC3: TIM Capture Compare 3 Interrupt source |
mbed_official | 155:8435094ec241 | 3142 | * @arg TIM_IT_CC4: TIM Capture Compare 4 Interrupt source |
mbed_official | 155:8435094ec241 | 3143 | * @arg TIM_IT_COM: TIM Commutation Interrupt source |
mbed_official | 155:8435094ec241 | 3144 | * @arg TIM_IT_Trigger: TIM Trigger Interrupt source |
mbed_official | 155:8435094ec241 | 3145 | * @arg TIM_IT_Break: TIM Break Interrupt source |
mbed_official | 155:8435094ec241 | 3146 | * |
mbed_official | 155:8435094ec241 | 3147 | * @note TIM6 and TIM7 can generate only an update interrupt. |
mbed_official | 155:8435094ec241 | 3148 | * @note TIM_IT_COM and TIM_IT_Break are used only with TIM1 and TIM8. |
mbed_official | 155:8435094ec241 | 3149 | * |
mbed_official | 155:8435094ec241 | 3150 | * @retval None |
mbed_official | 155:8435094ec241 | 3151 | */ |
mbed_official | 155:8435094ec241 | 3152 | void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, uint16_t TIM_IT) |
mbed_official | 155:8435094ec241 | 3153 | { |
mbed_official | 155:8435094ec241 | 3154 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3155 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3156 | |
mbed_official | 155:8435094ec241 | 3157 | /* Clear the IT pending Bit */ |
mbed_official | 155:8435094ec241 | 3158 | TIMx->SR = (uint16_t)~TIM_IT; |
mbed_official | 155:8435094ec241 | 3159 | } |
mbed_official | 155:8435094ec241 | 3160 | |
mbed_official | 155:8435094ec241 | 3161 | /** |
mbed_official | 155:8435094ec241 | 3162 | * @brief Configures the TIMx's DMA interface. |
mbed_official | 155:8435094ec241 | 3163 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3164 | * @param TIM_DMABase: DMA Base address. |
mbed_official | 155:8435094ec241 | 3165 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3166 | * @arg TIM_DMABase_CR1 |
mbed_official | 155:8435094ec241 | 3167 | * @arg TIM_DMABase_CR2 |
mbed_official | 155:8435094ec241 | 3168 | * @arg TIM_DMABase_SMCR |
mbed_official | 155:8435094ec241 | 3169 | * @arg TIM_DMABase_DIER |
mbed_official | 155:8435094ec241 | 3170 | * @arg TIM1_DMABase_SR |
mbed_official | 155:8435094ec241 | 3171 | * @arg TIM_DMABase_EGR |
mbed_official | 155:8435094ec241 | 3172 | * @arg TIM_DMABase_CCMR1 |
mbed_official | 155:8435094ec241 | 3173 | * @arg TIM_DMABase_CCMR2 |
mbed_official | 155:8435094ec241 | 3174 | * @arg TIM_DMABase_CCER |
mbed_official | 155:8435094ec241 | 3175 | * @arg TIM_DMABase_CNT |
mbed_official | 155:8435094ec241 | 3176 | * @arg TIM_DMABase_PSC |
mbed_official | 155:8435094ec241 | 3177 | * @arg TIM_DMABase_ARR |
mbed_official | 155:8435094ec241 | 3178 | * @arg TIM_DMABase_RCR |
mbed_official | 155:8435094ec241 | 3179 | * @arg TIM_DMABase_CCR1 |
mbed_official | 155:8435094ec241 | 3180 | * @arg TIM_DMABase_CCR2 |
mbed_official | 155:8435094ec241 | 3181 | * @arg TIM_DMABase_CCR3 |
mbed_official | 155:8435094ec241 | 3182 | * @arg TIM_DMABase_CCR4 |
mbed_official | 155:8435094ec241 | 3183 | * @arg TIM_DMABase_BDTR |
mbed_official | 155:8435094ec241 | 3184 | * @arg TIM_DMABase_DCR |
mbed_official | 155:8435094ec241 | 3185 | * @param TIM_DMABurstLength: DMA Burst length. This parameter can be one value |
mbed_official | 155:8435094ec241 | 3186 | * between: TIM_DMABurstLength_1Transfer and TIM_DMABurstLength_18Transfers. |
mbed_official | 155:8435094ec241 | 3187 | * @retval None |
mbed_official | 155:8435094ec241 | 3188 | */ |
mbed_official | 155:8435094ec241 | 3189 | void TIM_DMAConfig(TIM_TypeDef* TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength) |
mbed_official | 155:8435094ec241 | 3190 | { |
mbed_official | 155:8435094ec241 | 3191 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3192 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3193 | assert_param(IS_TIM_DMA_BASE(TIM_DMABase)); |
mbed_official | 155:8435094ec241 | 3194 | assert_param(IS_TIM_DMA_LENGTH(TIM_DMABurstLength)); |
mbed_official | 155:8435094ec241 | 3195 | |
mbed_official | 155:8435094ec241 | 3196 | /* Set the DMA Base and the DMA Burst Length */ |
mbed_official | 155:8435094ec241 | 3197 | TIMx->DCR = TIM_DMABase | TIM_DMABurstLength; |
mbed_official | 155:8435094ec241 | 3198 | } |
mbed_official | 155:8435094ec241 | 3199 | |
mbed_official | 155:8435094ec241 | 3200 | /** |
mbed_official | 155:8435094ec241 | 3201 | * @brief Enables or disables the TIMx's DMA Requests. |
mbed_official | 155:8435094ec241 | 3202 | * @param TIMx: where x can be 1, 2, 3, 4, 6, 7, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3203 | * @param TIM_DMASource: specifies the DMA Request sources. |
mbed_official | 155:8435094ec241 | 3204 | * This parameter can be any combination of the following values: |
mbed_official | 155:8435094ec241 | 3205 | * @arg TIM_DMA_Update: TIM update Interrupt source |
mbed_official | 155:8435094ec241 | 3206 | * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source |
mbed_official | 155:8435094ec241 | 3207 | * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source |
mbed_official | 155:8435094ec241 | 3208 | * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source |
mbed_official | 155:8435094ec241 | 3209 | * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source |
mbed_official | 155:8435094ec241 | 3210 | * @arg TIM_DMA_COM: TIM Commutation DMA source |
mbed_official | 155:8435094ec241 | 3211 | * @arg TIM_DMA_Trigger: TIM Trigger DMA source |
mbed_official | 155:8435094ec241 | 3212 | * @param NewState: new state of the DMA Request sources. |
mbed_official | 155:8435094ec241 | 3213 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 3214 | * @retval None |
mbed_official | 155:8435094ec241 | 3215 | */ |
mbed_official | 155:8435094ec241 | 3216 | void TIM_DMACmd(TIM_TypeDef* TIMx, uint16_t TIM_DMASource, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 3217 | { |
mbed_official | 155:8435094ec241 | 3218 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3219 | assert_param(IS_TIM_ALL_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3220 | assert_param(IS_TIM_DMA_SOURCE(TIM_DMASource)); |
mbed_official | 155:8435094ec241 | 3221 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 3222 | |
mbed_official | 155:8435094ec241 | 3223 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 3224 | { |
mbed_official | 155:8435094ec241 | 3225 | /* Enable the DMA sources */ |
mbed_official | 155:8435094ec241 | 3226 | TIMx->DIER |= TIM_DMASource; |
mbed_official | 155:8435094ec241 | 3227 | } |
mbed_official | 155:8435094ec241 | 3228 | else |
mbed_official | 155:8435094ec241 | 3229 | { |
mbed_official | 155:8435094ec241 | 3230 | /* Disable the DMA sources */ |
mbed_official | 155:8435094ec241 | 3231 | TIMx->DIER &= (uint16_t)~TIM_DMASource; |
mbed_official | 155:8435094ec241 | 3232 | } |
mbed_official | 155:8435094ec241 | 3233 | } |
mbed_official | 155:8435094ec241 | 3234 | |
mbed_official | 155:8435094ec241 | 3235 | /** |
mbed_official | 155:8435094ec241 | 3236 | * @brief Selects the TIMx peripheral Capture Compare DMA source. |
mbed_official | 155:8435094ec241 | 3237 | * @param TIMx: where x can be 1, 2, 3, 4, 8, 15, 16 or 17 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3238 | * @param NewState: new state of the Capture Compare DMA source |
mbed_official | 155:8435094ec241 | 3239 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 3240 | * @retval None |
mbed_official | 155:8435094ec241 | 3241 | */ |
mbed_official | 155:8435094ec241 | 3242 | void TIM_SelectCCDMA(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 3243 | { |
mbed_official | 155:8435094ec241 | 3244 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3245 | assert_param(IS_TIM_LIST1_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3246 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 3247 | |
mbed_official | 155:8435094ec241 | 3248 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 3249 | { |
mbed_official | 155:8435094ec241 | 3250 | /* Set the CCDS Bit */ |
mbed_official | 155:8435094ec241 | 3251 | TIMx->CR2 |= TIM_CR2_CCDS; |
mbed_official | 155:8435094ec241 | 3252 | } |
mbed_official | 155:8435094ec241 | 3253 | else |
mbed_official | 155:8435094ec241 | 3254 | { |
mbed_official | 155:8435094ec241 | 3255 | /* Reset the CCDS Bit */ |
mbed_official | 155:8435094ec241 | 3256 | TIMx->CR2 &= (uint16_t)~TIM_CR2_CCDS; |
mbed_official | 155:8435094ec241 | 3257 | } |
mbed_official | 155:8435094ec241 | 3258 | } |
mbed_official | 155:8435094ec241 | 3259 | /** |
mbed_official | 155:8435094ec241 | 3260 | * @} |
mbed_official | 155:8435094ec241 | 3261 | */ |
mbed_official | 155:8435094ec241 | 3262 | |
mbed_official | 155:8435094ec241 | 3263 | /** @defgroup TIM_Group6 Clocks management functions |
mbed_official | 155:8435094ec241 | 3264 | * @brief Clocks management functions |
mbed_official | 155:8435094ec241 | 3265 | * |
mbed_official | 155:8435094ec241 | 3266 | @verbatim |
mbed_official | 155:8435094ec241 | 3267 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3268 | ##### Clocks management functions ##### |
mbed_official | 155:8435094ec241 | 3269 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3270 | |
mbed_official | 155:8435094ec241 | 3271 | @endverbatim |
mbed_official | 155:8435094ec241 | 3272 | * @{ |
mbed_official | 155:8435094ec241 | 3273 | */ |
mbed_official | 155:8435094ec241 | 3274 | |
mbed_official | 155:8435094ec241 | 3275 | /** |
mbed_official | 155:8435094ec241 | 3276 | * @brief Configures the TIMx internal Clock |
mbed_official | 155:8435094ec241 | 3277 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 3278 | * peripheral. |
mbed_official | 155:8435094ec241 | 3279 | * @retval None |
mbed_official | 155:8435094ec241 | 3280 | */ |
mbed_official | 155:8435094ec241 | 3281 | void TIM_InternalClockConfig(TIM_TypeDef* TIMx) |
mbed_official | 155:8435094ec241 | 3282 | { |
mbed_official | 155:8435094ec241 | 3283 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3284 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3285 | |
mbed_official | 155:8435094ec241 | 3286 | /* Disable slave mode to clock the prescaler directly with the internal clock */ |
mbed_official | 155:8435094ec241 | 3287 | TIMx->SMCR &= (uint16_t)~TIM_SMCR_SMS; |
mbed_official | 155:8435094ec241 | 3288 | } |
mbed_official | 155:8435094ec241 | 3289 | |
mbed_official | 155:8435094ec241 | 3290 | /** |
mbed_official | 155:8435094ec241 | 3291 | * @brief Configures the TIMx Internal Trigger as External Clock |
mbed_official | 155:8435094ec241 | 3292 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 3293 | * peripheral. |
mbed_official | 155:8435094ec241 | 3294 | * @param TIM_InputTriggerSource: Trigger source. |
mbed_official | 155:8435094ec241 | 3295 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3296 | * @arg TIM_TS_ITR0: Internal Trigger 0 |
mbed_official | 155:8435094ec241 | 3297 | * @arg TIM_TS_ITR1: Internal Trigger 1 |
mbed_official | 155:8435094ec241 | 3298 | * @arg TIM_TS_ITR2: Internal Trigger 2 |
mbed_official | 155:8435094ec241 | 3299 | * @arg TIM_TS_ITR3: Internal Trigger 3 |
mbed_official | 155:8435094ec241 | 3300 | * @retval None |
mbed_official | 155:8435094ec241 | 3301 | */ |
mbed_official | 155:8435094ec241 | 3302 | void TIM_ITRxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource) |
mbed_official | 155:8435094ec241 | 3303 | { |
mbed_official | 155:8435094ec241 | 3304 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3305 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3306 | assert_param(IS_TIM_INTERNAL_TRIGGER_SELECTION(TIM_InputTriggerSource)); |
mbed_official | 155:8435094ec241 | 3307 | |
mbed_official | 155:8435094ec241 | 3308 | /* Select the Internal Trigger */ |
mbed_official | 155:8435094ec241 | 3309 | TIM_SelectInputTrigger(TIMx, TIM_InputTriggerSource); |
mbed_official | 155:8435094ec241 | 3310 | |
mbed_official | 155:8435094ec241 | 3311 | /* Select the External clock mode1 */ |
mbed_official | 155:8435094ec241 | 3312 | TIMx->SMCR |= TIM_SlaveMode_External1; |
mbed_official | 155:8435094ec241 | 3313 | } |
mbed_official | 155:8435094ec241 | 3314 | |
mbed_official | 155:8435094ec241 | 3315 | /** |
mbed_official | 155:8435094ec241 | 3316 | * @brief Configures the TIMx Trigger as External Clock |
mbed_official | 155:8435094ec241 | 3317 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 |
mbed_official | 155:8435094ec241 | 3318 | * to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3319 | * @param TIM_TIxExternalCLKSource: Trigger source. |
mbed_official | 155:8435094ec241 | 3320 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3321 | * @arg TIM_TIxExternalCLK1Source_TI1ED: TI1 Edge Detector |
mbed_official | 155:8435094ec241 | 3322 | * @arg TIM_TIxExternalCLK1Source_TI1: Filtered Timer Input 1 |
mbed_official | 155:8435094ec241 | 3323 | * @arg TIM_TIxExternalCLK1Source_TI2: Filtered Timer Input 2 |
mbed_official | 155:8435094ec241 | 3324 | * @param TIM_ICPolarity: specifies the TIx Polarity. |
mbed_official | 155:8435094ec241 | 3325 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3326 | * @arg TIM_ICPolarity_Rising |
mbed_official | 155:8435094ec241 | 3327 | * @arg TIM_ICPolarity_Falling |
mbed_official | 155:8435094ec241 | 3328 | * @param ICFilter: specifies the filter value. |
mbed_official | 155:8435094ec241 | 3329 | * This parameter must be a value between 0x0 and 0xF. |
mbed_official | 155:8435094ec241 | 3330 | * @retval None |
mbed_official | 155:8435094ec241 | 3331 | */ |
mbed_official | 155:8435094ec241 | 3332 | void TIM_TIxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_TIxExternalCLKSource, |
mbed_official | 155:8435094ec241 | 3333 | uint16_t TIM_ICPolarity, uint16_t ICFilter) |
mbed_official | 155:8435094ec241 | 3334 | { |
mbed_official | 155:8435094ec241 | 3335 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3336 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3337 | assert_param(IS_TIM_IC_POLARITY(TIM_ICPolarity)); |
mbed_official | 155:8435094ec241 | 3338 | assert_param(IS_TIM_IC_FILTER(ICFilter)); |
mbed_official | 155:8435094ec241 | 3339 | |
mbed_official | 155:8435094ec241 | 3340 | /* Configure the Timer Input Clock Source */ |
mbed_official | 155:8435094ec241 | 3341 | if (TIM_TIxExternalCLKSource == TIM_TIxExternalCLK1Source_TI2) |
mbed_official | 155:8435094ec241 | 3342 | { |
mbed_official | 155:8435094ec241 | 3343 | TI2_Config(TIMx, TIM_ICPolarity, TIM_ICSelection_DirectTI, ICFilter); |
mbed_official | 155:8435094ec241 | 3344 | } |
mbed_official | 155:8435094ec241 | 3345 | else |
mbed_official | 155:8435094ec241 | 3346 | { |
mbed_official | 155:8435094ec241 | 3347 | TI1_Config(TIMx, TIM_ICPolarity, TIM_ICSelection_DirectTI, ICFilter); |
mbed_official | 155:8435094ec241 | 3348 | } |
mbed_official | 155:8435094ec241 | 3349 | /* Select the Trigger source */ |
mbed_official | 155:8435094ec241 | 3350 | TIM_SelectInputTrigger(TIMx, TIM_TIxExternalCLKSource); |
mbed_official | 155:8435094ec241 | 3351 | /* Select the External clock mode1 */ |
mbed_official | 155:8435094ec241 | 3352 | TIMx->SMCR |= TIM_SlaveMode_External1; |
mbed_official | 155:8435094ec241 | 3353 | } |
mbed_official | 155:8435094ec241 | 3354 | |
mbed_official | 155:8435094ec241 | 3355 | /** |
mbed_official | 155:8435094ec241 | 3356 | * @brief Configures the External clock Mode1 |
mbed_official | 155:8435094ec241 | 3357 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3358 | * @param TIM_ExtTRGPrescaler: The external Trigger Prescaler. |
mbed_official | 155:8435094ec241 | 3359 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3360 | * @arg TIM_ExtTRGPSC_OFF: ETRP Prescaler OFF. |
mbed_official | 155:8435094ec241 | 3361 | * @arg TIM_ExtTRGPSC_DIV2: ETRP frequency divided by 2. |
mbed_official | 155:8435094ec241 | 3362 | * @arg TIM_ExtTRGPSC_DIV4: ETRP frequency divided by 4. |
mbed_official | 155:8435094ec241 | 3363 | * @arg TIM_ExtTRGPSC_DIV8: ETRP frequency divided by 8. |
mbed_official | 155:8435094ec241 | 3364 | * @param TIM_ExtTRGPolarity: The external Trigger Polarity. |
mbed_official | 155:8435094ec241 | 3365 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3366 | * @arg TIM_ExtTRGPolarity_Inverted: active low or falling edge active. |
mbed_official | 155:8435094ec241 | 3367 | * @arg TIM_ExtTRGPolarity_NonInverted: active high or rising edge active. |
mbed_official | 155:8435094ec241 | 3368 | * @param ExtTRGFilter: External Trigger Filter. |
mbed_official | 155:8435094ec241 | 3369 | * This parameter must be a value between 0x00 and 0x0F |
mbed_official | 155:8435094ec241 | 3370 | * @retval None |
mbed_official | 155:8435094ec241 | 3371 | */ |
mbed_official | 155:8435094ec241 | 3372 | void TIM_ETRClockMode1Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, |
mbed_official | 155:8435094ec241 | 3373 | uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter) |
mbed_official | 155:8435094ec241 | 3374 | { |
mbed_official | 155:8435094ec241 | 3375 | uint16_t tmpsmcr = 0; |
mbed_official | 155:8435094ec241 | 3376 | |
mbed_official | 155:8435094ec241 | 3377 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3378 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3379 | assert_param(IS_TIM_EXT_PRESCALER(TIM_ExtTRGPrescaler)); |
mbed_official | 155:8435094ec241 | 3380 | assert_param(IS_TIM_EXT_POLARITY(TIM_ExtTRGPolarity)); |
mbed_official | 155:8435094ec241 | 3381 | assert_param(IS_TIM_EXT_FILTER(ExtTRGFilter)); |
mbed_official | 155:8435094ec241 | 3382 | /* Configure the ETR Clock source */ |
mbed_official | 155:8435094ec241 | 3383 | TIM_ETRConfig(TIMx, TIM_ExtTRGPrescaler, TIM_ExtTRGPolarity, ExtTRGFilter); |
mbed_official | 155:8435094ec241 | 3384 | |
mbed_official | 155:8435094ec241 | 3385 | /* Get the TIMx SMCR register value */ |
mbed_official | 155:8435094ec241 | 3386 | tmpsmcr = TIMx->SMCR; |
mbed_official | 155:8435094ec241 | 3387 | |
mbed_official | 155:8435094ec241 | 3388 | /* Reset the SMS Bits */ |
mbed_official | 155:8435094ec241 | 3389 | tmpsmcr &= (uint16_t)~TIM_SMCR_SMS; |
mbed_official | 155:8435094ec241 | 3390 | |
mbed_official | 155:8435094ec241 | 3391 | /* Select the External clock mode1 */ |
mbed_official | 155:8435094ec241 | 3392 | tmpsmcr |= TIM_SlaveMode_External1; |
mbed_official | 155:8435094ec241 | 3393 | |
mbed_official | 155:8435094ec241 | 3394 | /* Select the Trigger selection : ETRF */ |
mbed_official | 155:8435094ec241 | 3395 | tmpsmcr &= (uint16_t)~TIM_SMCR_TS; |
mbed_official | 155:8435094ec241 | 3396 | tmpsmcr |= TIM_TS_ETRF; |
mbed_official | 155:8435094ec241 | 3397 | |
mbed_official | 155:8435094ec241 | 3398 | /* Write to TIMx SMCR */ |
mbed_official | 155:8435094ec241 | 3399 | TIMx->SMCR = tmpsmcr; |
mbed_official | 155:8435094ec241 | 3400 | } |
mbed_official | 155:8435094ec241 | 3401 | |
mbed_official | 155:8435094ec241 | 3402 | /** |
mbed_official | 155:8435094ec241 | 3403 | * @brief Configures the External clock Mode2 |
mbed_official | 155:8435094ec241 | 3404 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3405 | * @param TIM_ExtTRGPrescaler: The external Trigger Prescaler. |
mbed_official | 155:8435094ec241 | 3406 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3407 | * @arg TIM_ExtTRGPSC_OFF: ETRP Prescaler OFF. |
mbed_official | 155:8435094ec241 | 3408 | * @arg TIM_ExtTRGPSC_DIV2: ETRP frequency divided by 2. |
mbed_official | 155:8435094ec241 | 3409 | * @arg TIM_ExtTRGPSC_DIV4: ETRP frequency divided by 4. |
mbed_official | 155:8435094ec241 | 3410 | * @arg TIM_ExtTRGPSC_DIV8: ETRP frequency divided by 8. |
mbed_official | 155:8435094ec241 | 3411 | * @param TIM_ExtTRGPolarity: The external Trigger Polarity. |
mbed_official | 155:8435094ec241 | 3412 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3413 | * @arg TIM_ExtTRGPolarity_Inverted: active low or falling edge active. |
mbed_official | 155:8435094ec241 | 3414 | * @arg TIM_ExtTRGPolarity_NonInverted: active high or rising edge active. |
mbed_official | 155:8435094ec241 | 3415 | * @param ExtTRGFilter: External Trigger Filter. |
mbed_official | 155:8435094ec241 | 3416 | * This parameter must be a value between 0x00 and 0x0F |
mbed_official | 155:8435094ec241 | 3417 | * @retval None |
mbed_official | 155:8435094ec241 | 3418 | */ |
mbed_official | 155:8435094ec241 | 3419 | void TIM_ETRClockMode2Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, |
mbed_official | 155:8435094ec241 | 3420 | uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter) |
mbed_official | 155:8435094ec241 | 3421 | { |
mbed_official | 155:8435094ec241 | 3422 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3423 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3424 | assert_param(IS_TIM_EXT_PRESCALER(TIM_ExtTRGPrescaler)); |
mbed_official | 155:8435094ec241 | 3425 | assert_param(IS_TIM_EXT_POLARITY(TIM_ExtTRGPolarity)); |
mbed_official | 155:8435094ec241 | 3426 | assert_param(IS_TIM_EXT_FILTER(ExtTRGFilter)); |
mbed_official | 155:8435094ec241 | 3427 | |
mbed_official | 155:8435094ec241 | 3428 | /* Configure the ETR Clock source */ |
mbed_official | 155:8435094ec241 | 3429 | TIM_ETRConfig(TIMx, TIM_ExtTRGPrescaler, TIM_ExtTRGPolarity, ExtTRGFilter); |
mbed_official | 155:8435094ec241 | 3430 | |
mbed_official | 155:8435094ec241 | 3431 | /* Enable the External clock mode2 */ |
mbed_official | 155:8435094ec241 | 3432 | TIMx->SMCR |= TIM_SMCR_ECE; |
mbed_official | 155:8435094ec241 | 3433 | } |
mbed_official | 155:8435094ec241 | 3434 | /** |
mbed_official | 155:8435094ec241 | 3435 | * @} |
mbed_official | 155:8435094ec241 | 3436 | */ |
mbed_official | 155:8435094ec241 | 3437 | |
mbed_official | 155:8435094ec241 | 3438 | /** @defgroup TIM_Group7 Synchronization management functions |
mbed_official | 155:8435094ec241 | 3439 | * @brief Synchronization management functions |
mbed_official | 155:8435094ec241 | 3440 | * |
mbed_official | 155:8435094ec241 | 3441 | @verbatim |
mbed_official | 155:8435094ec241 | 3442 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3443 | ##### Synchronization management functions ##### |
mbed_official | 155:8435094ec241 | 3444 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3445 | |
mbed_official | 155:8435094ec241 | 3446 | *** TIM Driver: how to use it in synchronization Mode *** |
mbed_official | 155:8435094ec241 | 3447 | ========================================================= |
mbed_official | 155:8435094ec241 | 3448 | [..] Case of two/several Timers |
mbed_official | 155:8435094ec241 | 3449 | |
mbed_official | 155:8435094ec241 | 3450 | (#) Configure the Master Timers using the following functions: |
mbed_official | 155:8435094ec241 | 3451 | (++) void TIM_SelectOutputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_TRGOSource); |
mbed_official | 155:8435094ec241 | 3452 | (++) void TIM_SelectMasterSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_MasterSlaveMode); |
mbed_official | 155:8435094ec241 | 3453 | (#) Configure the Slave Timers using the following functions: |
mbed_official | 155:8435094ec241 | 3454 | (++) void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource); |
mbed_official | 155:8435094ec241 | 3455 | (++) void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_SlaveMode); |
mbed_official | 155:8435094ec241 | 3456 | |
mbed_official | 155:8435094ec241 | 3457 | [..] Case of Timers and external trigger(ETR pin) |
mbed_official | 155:8435094ec241 | 3458 | |
mbed_official | 155:8435094ec241 | 3459 | (#) Configure the External trigger using this function: |
mbed_official | 155:8435094ec241 | 3460 | (++) void TIM_ETRConfig(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, |
mbed_official | 155:8435094ec241 | 3461 | uint16_t ExtTRGFilter); |
mbed_official | 155:8435094ec241 | 3462 | (#) Configure the Slave Timers using the following functions: |
mbed_official | 155:8435094ec241 | 3463 | (++) void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource); |
mbed_official | 155:8435094ec241 | 3464 | (++) void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_SlaveMode); |
mbed_official | 155:8435094ec241 | 3465 | |
mbed_official | 155:8435094ec241 | 3466 | @endverbatim |
mbed_official | 155:8435094ec241 | 3467 | * @{ |
mbed_official | 155:8435094ec241 | 3468 | */ |
mbed_official | 155:8435094ec241 | 3469 | |
mbed_official | 155:8435094ec241 | 3470 | /** |
mbed_official | 155:8435094ec241 | 3471 | * @brief Selects the Input Trigger source |
mbed_official | 155:8435094ec241 | 3472 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 |
mbed_official | 155:8435094ec241 | 3473 | * to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3474 | * @param TIM_InputTriggerSource: The Input Trigger source. |
mbed_official | 155:8435094ec241 | 3475 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3476 | * @arg TIM_TS_ITR0: Internal Trigger 0 |
mbed_official | 155:8435094ec241 | 3477 | * @arg TIM_TS_ITR1: Internal Trigger 1 |
mbed_official | 155:8435094ec241 | 3478 | * @arg TIM_TS_ITR2: Internal Trigger 2 |
mbed_official | 155:8435094ec241 | 3479 | * @arg TIM_TS_ITR3: Internal Trigger 3 |
mbed_official | 155:8435094ec241 | 3480 | * @arg TIM_TS_TI1F_ED: TI1 Edge Detector |
mbed_official | 155:8435094ec241 | 3481 | * @arg TIM_TS_TI1FP1: Filtered Timer Input 1 |
mbed_official | 155:8435094ec241 | 3482 | * @arg TIM_TS_TI2FP2: Filtered Timer Input 2 |
mbed_official | 155:8435094ec241 | 3483 | * @arg TIM_TS_ETRF: External Trigger input |
mbed_official | 155:8435094ec241 | 3484 | * @retval None |
mbed_official | 155:8435094ec241 | 3485 | */ |
mbed_official | 155:8435094ec241 | 3486 | void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource) |
mbed_official | 155:8435094ec241 | 3487 | { |
mbed_official | 155:8435094ec241 | 3488 | uint16_t tmpsmcr = 0; |
mbed_official | 155:8435094ec241 | 3489 | |
mbed_official | 155:8435094ec241 | 3490 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3491 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3492 | assert_param(IS_TIM_TRIGGER_SELECTION(TIM_InputTriggerSource)); |
mbed_official | 155:8435094ec241 | 3493 | |
mbed_official | 155:8435094ec241 | 3494 | /* Get the TIMx SMCR register value */ |
mbed_official | 155:8435094ec241 | 3495 | tmpsmcr = TIMx->SMCR; |
mbed_official | 155:8435094ec241 | 3496 | |
mbed_official | 155:8435094ec241 | 3497 | /* Reset the TS Bits */ |
mbed_official | 155:8435094ec241 | 3498 | tmpsmcr &= (uint16_t)~TIM_SMCR_TS; |
mbed_official | 155:8435094ec241 | 3499 | |
mbed_official | 155:8435094ec241 | 3500 | /* Set the Input Trigger source */ |
mbed_official | 155:8435094ec241 | 3501 | tmpsmcr |= TIM_InputTriggerSource; |
mbed_official | 155:8435094ec241 | 3502 | |
mbed_official | 155:8435094ec241 | 3503 | /* Write to TIMx SMCR */ |
mbed_official | 155:8435094ec241 | 3504 | TIMx->SMCR = tmpsmcr; |
mbed_official | 155:8435094ec241 | 3505 | } |
mbed_official | 155:8435094ec241 | 3506 | |
mbed_official | 155:8435094ec241 | 3507 | /** |
mbed_official | 155:8435094ec241 | 3508 | * @brief Selects the TIMx Trigger Output Mode. |
mbed_official | 155:8435094ec241 | 3509 | * @param TIMx: where x can be 1, 2, 3, 4, 5, 6, 7, 8 or 15 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3510 | * |
mbed_official | 155:8435094ec241 | 3511 | * @param TIM_TRGOSource: specifies the Trigger Output source. |
mbed_official | 155:8435094ec241 | 3512 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3513 | * |
mbed_official | 155:8435094ec241 | 3514 | * - For all TIMx |
mbed_official | 155:8435094ec241 | 3515 | * @arg TIM_TRGOSource_Reset: The UG bit in the TIM_EGR register is used as the trigger output(TRGO) |
mbed_official | 155:8435094ec241 | 3516 | * @arg TIM_TRGOSource_Enable: The Counter Enable CEN is used as the trigger output(TRGO) |
mbed_official | 155:8435094ec241 | 3517 | * @arg TIM_TRGOSource_Update: The update event is selected as the trigger output(TRGO) |
mbed_official | 155:8435094ec241 | 3518 | * |
mbed_official | 155:8435094ec241 | 3519 | * - For all TIMx except TIM6 and TIM7 |
mbed_official | 155:8435094ec241 | 3520 | * @arg TIM_TRGOSource_OC1: The trigger output sends a positive pulse when the CC1IF flag |
mbed_official | 155:8435094ec241 | 3521 | * is to be set, as soon as a capture or compare match occurs(TRGO) |
mbed_official | 155:8435094ec241 | 3522 | * @arg TIM_TRGOSource_OC1Ref: OC1REF signal is used as the trigger output(TRGO) |
mbed_official | 155:8435094ec241 | 3523 | * @arg TIM_TRGOSource_OC2Ref: OC2REF signal is used as the trigger output(TRGO) |
mbed_official | 155:8435094ec241 | 3524 | * @arg TIM_TRGOSource_OC3Ref: OC3REF signal is used as the trigger output(TRGO) |
mbed_official | 155:8435094ec241 | 3525 | * @arg TIM_TRGOSource_OC4Ref: OC4REF signal is used as the trigger output(TRGO) |
mbed_official | 155:8435094ec241 | 3526 | * |
mbed_official | 155:8435094ec241 | 3527 | * @retval None |
mbed_official | 155:8435094ec241 | 3528 | */ |
mbed_official | 155:8435094ec241 | 3529 | void TIM_SelectOutputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_TRGOSource) |
mbed_official | 155:8435094ec241 | 3530 | { |
mbed_official | 155:8435094ec241 | 3531 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3532 | assert_param(IS_TIM_LIST7_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3533 | assert_param(IS_TIM_TRGO_SOURCE(TIM_TRGOSource)); |
mbed_official | 155:8435094ec241 | 3534 | |
mbed_official | 155:8435094ec241 | 3535 | /* Reset the MMS Bits */ |
mbed_official | 155:8435094ec241 | 3536 | TIMx->CR2 &= (uint16_t)~TIM_CR2_MMS; |
mbed_official | 155:8435094ec241 | 3537 | /* Select the TRGO source */ |
mbed_official | 155:8435094ec241 | 3538 | TIMx->CR2 |= TIM_TRGOSource; |
mbed_official | 155:8435094ec241 | 3539 | } |
mbed_official | 155:8435094ec241 | 3540 | |
mbed_official | 155:8435094ec241 | 3541 | /** |
mbed_official | 155:8435094ec241 | 3542 | * @brief Selects the TIMx Trigger Output Mode2 (TRGO2). |
mbed_official | 155:8435094ec241 | 3543 | * @param TIMx: where x can be 1 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3544 | * |
mbed_official | 155:8435094ec241 | 3545 | * @param TIM_TRGO2Source: specifies the Trigger Output source. |
mbed_official | 155:8435094ec241 | 3546 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3547 | * |
mbed_official | 155:8435094ec241 | 3548 | * - For all TIMx |
mbed_official | 155:8435094ec241 | 3549 | * @arg TIM_TRGOSource_Reset: The UG bit in the TIM_EGR register is used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3550 | * @arg TIM_TRGOSource_Enable: The Counter Enable CEN is used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3551 | * @arg TIM_TRGOSource_Update: The update event is selected as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3552 | * @arg TIM_TRGOSource_OC1: The trigger output sends a positive pulse when the CC1IF flag |
mbed_official | 155:8435094ec241 | 3553 | * is to be set, as soon as a capture or compare match occurs(TRGO2) |
mbed_official | 155:8435094ec241 | 3554 | * @arg TIM_TRGOSource_OC1Ref: OC1REF signal is used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3555 | * @arg TIM_TRGOSource_OC2Ref: OC2REF signal is used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3556 | * @arg TIM_TRGOSource_OC3Ref: OC3REF signal is used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3557 | * @arg TIM_TRGOSource_OC4Ref: OC4REF signal is used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3558 | * @arg TIM_TRGO2Source_OC4Ref_RisingFalling: OC4Ref Rising and Falling are used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3559 | * @arg TIM_TRGO2Source_OC6Ref_RisingFalling: OC6Ref Rising and Falling are used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3560 | * @arg TIM_TRGO2Source_OC4RefRising_OC6RefRising: OC4Ref Rising and OC6Ref Rising are used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3561 | * @arg TIM_TRGO2Source_OC4RefRising_OC6RefFalling: OC4Ref Rising and OC6Ref Falling are used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3562 | * @arg TIM_TRGO2Source_OC5RefRising_OC6RefRising: OC5Ref Rising and OC6Ref Rising are used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3563 | * @arg TIM_TRGO2Source_OC5RefRising_OC6RefFalling: OC5Ref Rising and OC6Ref Falling are used as the trigger output(TRGO2) |
mbed_official | 155:8435094ec241 | 3564 | * |
mbed_official | 155:8435094ec241 | 3565 | * @retval None |
mbed_official | 155:8435094ec241 | 3566 | */ |
mbed_official | 155:8435094ec241 | 3567 | void TIM_SelectOutputTrigger2(TIM_TypeDef* TIMx, uint32_t TIM_TRGO2Source) |
mbed_official | 155:8435094ec241 | 3568 | { |
mbed_official | 155:8435094ec241 | 3569 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3570 | assert_param(IS_TIM_LIST4_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3571 | assert_param(IS_TIM_TRGO2_SOURCE(TIM_TRGO2Source)); |
mbed_official | 155:8435094ec241 | 3572 | |
mbed_official | 155:8435094ec241 | 3573 | /* Reset the MMS Bits */ |
mbed_official | 155:8435094ec241 | 3574 | TIMx->CR2 &= (uint32_t)~TIM_CR2_MMS2; |
mbed_official | 155:8435094ec241 | 3575 | /* Select the TRGO source */ |
mbed_official | 155:8435094ec241 | 3576 | TIMx->CR2 |= TIM_TRGO2Source; |
mbed_official | 155:8435094ec241 | 3577 | } |
mbed_official | 155:8435094ec241 | 3578 | |
mbed_official | 155:8435094ec241 | 3579 | /** |
mbed_official | 155:8435094ec241 | 3580 | * @brief Selects the TIMx Slave Mode. |
mbed_official | 155:8435094ec241 | 3581 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3582 | * @param TIM_SlaveMode: specifies the Timer Slave Mode. |
mbed_official | 155:8435094ec241 | 3583 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3584 | * @arg TIM_SlaveMode_Reset: Rising edge of the selected trigger signal(TRGI) reinitialize |
mbed_official | 155:8435094ec241 | 3585 | * the counter and triggers an update of the registers |
mbed_official | 155:8435094ec241 | 3586 | * @arg TIM_SlaveMode_Gated: The counter clock is enabled when the trigger signal (TRGI) is high |
mbed_official | 155:8435094ec241 | 3587 | * @arg TIM_SlaveMode_Trigger: The counter starts at a rising edge of the trigger TRGI |
mbed_official | 155:8435094ec241 | 3588 | * @arg TIM_SlaveMode_External1: Rising edges of the selected trigger (TRGI) clock the counter |
mbed_official | 155:8435094ec241 | 3589 | * @arg TIM_SlaveMode_Combined_ResetTrigger: Rising edge of the selected trigger input (TRGI) |
mbed_official | 155:8435094ec241 | 3590 | * reinitializes the counter, generates an update |
mbed_official | 155:8435094ec241 | 3591 | * of the registers and starts the counter. |
mbed_official | 155:8435094ec241 | 3592 | * @retval None |
mbed_official | 155:8435094ec241 | 3593 | */ |
mbed_official | 155:8435094ec241 | 3594 | void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint32_t TIM_SlaveMode) |
mbed_official | 155:8435094ec241 | 3595 | { |
mbed_official | 155:8435094ec241 | 3596 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3597 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3598 | assert_param(IS_TIM_SLAVE_MODE(TIM_SlaveMode)); |
mbed_official | 155:8435094ec241 | 3599 | |
mbed_official | 155:8435094ec241 | 3600 | /* Reset the SMS Bits */ |
mbed_official | 155:8435094ec241 | 3601 | TIMx->SMCR &= (uint32_t)~TIM_SMCR_SMS; |
mbed_official | 155:8435094ec241 | 3602 | |
mbed_official | 155:8435094ec241 | 3603 | /* Select the Slave Mode */ |
mbed_official | 155:8435094ec241 | 3604 | TIMx->SMCR |= (uint32_t)TIM_SlaveMode; |
mbed_official | 155:8435094ec241 | 3605 | } |
mbed_official | 155:8435094ec241 | 3606 | |
mbed_official | 155:8435094ec241 | 3607 | /** |
mbed_official | 155:8435094ec241 | 3608 | * @brief Sets or Resets the TIMx Master/Slave Mode. |
mbed_official | 155:8435094ec241 | 3609 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3610 | * @param TIM_MasterSlaveMode: specifies the Timer Master Slave Mode. |
mbed_official | 155:8435094ec241 | 3611 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3612 | * @arg TIM_MasterSlaveMode_Enable: synchronization between the current timer |
mbed_official | 155:8435094ec241 | 3613 | * and its slaves (through TRGO) |
mbed_official | 155:8435094ec241 | 3614 | * @arg TIM_MasterSlaveMode_Disable: No action |
mbed_official | 155:8435094ec241 | 3615 | * @retval None |
mbed_official | 155:8435094ec241 | 3616 | */ |
mbed_official | 155:8435094ec241 | 3617 | void TIM_SelectMasterSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_MasterSlaveMode) |
mbed_official | 155:8435094ec241 | 3618 | { |
mbed_official | 155:8435094ec241 | 3619 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3620 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3621 | assert_param(IS_TIM_MSM_STATE(TIM_MasterSlaveMode)); |
mbed_official | 155:8435094ec241 | 3622 | |
mbed_official | 155:8435094ec241 | 3623 | /* Reset the MSM Bit */ |
mbed_official | 155:8435094ec241 | 3624 | TIMx->SMCR &= (uint16_t)~TIM_SMCR_MSM; |
mbed_official | 155:8435094ec241 | 3625 | |
mbed_official | 155:8435094ec241 | 3626 | /* Set or Reset the MSM Bit */ |
mbed_official | 155:8435094ec241 | 3627 | TIMx->SMCR |= TIM_MasterSlaveMode; |
mbed_official | 155:8435094ec241 | 3628 | } |
mbed_official | 155:8435094ec241 | 3629 | |
mbed_official | 155:8435094ec241 | 3630 | /** |
mbed_official | 155:8435094ec241 | 3631 | * @brief Configures the TIMx External Trigger (ETR). |
mbed_official | 155:8435094ec241 | 3632 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3633 | * @param TIM_ExtTRGPrescaler: The external Trigger Prescaler. |
mbed_official | 155:8435094ec241 | 3634 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3635 | * @arg TIM_ExtTRGPSC_OFF: ETRP Prescaler OFF. |
mbed_official | 155:8435094ec241 | 3636 | * @arg TIM_ExtTRGPSC_DIV2: ETRP frequency divided by 2. |
mbed_official | 155:8435094ec241 | 3637 | * @arg TIM_ExtTRGPSC_DIV4: ETRP frequency divided by 4. |
mbed_official | 155:8435094ec241 | 3638 | * @arg TIM_ExtTRGPSC_DIV8: ETRP frequency divided by 8. |
mbed_official | 155:8435094ec241 | 3639 | * @param TIM_ExtTRGPolarity: The external Trigger Polarity. |
mbed_official | 155:8435094ec241 | 3640 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3641 | * @arg TIM_ExtTRGPolarity_Inverted: active low or falling edge active. |
mbed_official | 155:8435094ec241 | 3642 | * @arg TIM_ExtTRGPolarity_NonInverted: active high or rising edge active. |
mbed_official | 155:8435094ec241 | 3643 | * @param ExtTRGFilter: External Trigger Filter. |
mbed_official | 155:8435094ec241 | 3644 | * This parameter must be a value between 0x00 and 0x0F |
mbed_official | 155:8435094ec241 | 3645 | * @retval None |
mbed_official | 155:8435094ec241 | 3646 | */ |
mbed_official | 155:8435094ec241 | 3647 | void TIM_ETRConfig(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, |
mbed_official | 155:8435094ec241 | 3648 | uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter) |
mbed_official | 155:8435094ec241 | 3649 | { |
mbed_official | 155:8435094ec241 | 3650 | uint16_t tmpsmcr = 0; |
mbed_official | 155:8435094ec241 | 3651 | |
mbed_official | 155:8435094ec241 | 3652 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3653 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3654 | assert_param(IS_TIM_EXT_PRESCALER(TIM_ExtTRGPrescaler)); |
mbed_official | 155:8435094ec241 | 3655 | assert_param(IS_TIM_EXT_POLARITY(TIM_ExtTRGPolarity)); |
mbed_official | 155:8435094ec241 | 3656 | assert_param(IS_TIM_EXT_FILTER(ExtTRGFilter)); |
mbed_official | 155:8435094ec241 | 3657 | |
mbed_official | 155:8435094ec241 | 3658 | tmpsmcr = TIMx->SMCR; |
mbed_official | 155:8435094ec241 | 3659 | |
mbed_official | 155:8435094ec241 | 3660 | /* Reset the ETR Bits */ |
mbed_official | 155:8435094ec241 | 3661 | tmpsmcr &= SMCR_ETR_MASK; |
mbed_official | 155:8435094ec241 | 3662 | |
mbed_official | 155:8435094ec241 | 3663 | /* Set the Prescaler, the Filter value and the Polarity */ |
mbed_official | 155:8435094ec241 | 3664 | tmpsmcr |= (uint16_t)(TIM_ExtTRGPrescaler | (uint16_t)(TIM_ExtTRGPolarity | (uint16_t)(ExtTRGFilter << (uint16_t)8))); |
mbed_official | 155:8435094ec241 | 3665 | |
mbed_official | 155:8435094ec241 | 3666 | /* Write to TIMx SMCR */ |
mbed_official | 155:8435094ec241 | 3667 | TIMx->SMCR = tmpsmcr; |
mbed_official | 155:8435094ec241 | 3668 | } |
mbed_official | 155:8435094ec241 | 3669 | /** |
mbed_official | 155:8435094ec241 | 3670 | * @} |
mbed_official | 155:8435094ec241 | 3671 | */ |
mbed_official | 155:8435094ec241 | 3672 | |
mbed_official | 155:8435094ec241 | 3673 | /** @defgroup TIM_Group8 Specific interface management functions |
mbed_official | 155:8435094ec241 | 3674 | * @brief Specific interface management functions |
mbed_official | 155:8435094ec241 | 3675 | * |
mbed_official | 155:8435094ec241 | 3676 | @verbatim |
mbed_official | 155:8435094ec241 | 3677 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3678 | ##### Specific interface management functions ##### |
mbed_official | 155:8435094ec241 | 3679 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3680 | |
mbed_official | 155:8435094ec241 | 3681 | @endverbatim |
mbed_official | 155:8435094ec241 | 3682 | * @{ |
mbed_official | 155:8435094ec241 | 3683 | */ |
mbed_official | 155:8435094ec241 | 3684 | |
mbed_official | 155:8435094ec241 | 3685 | /** |
mbed_official | 155:8435094ec241 | 3686 | * @brief Configures the TIMx Encoder Interface. |
mbed_official | 155:8435094ec241 | 3687 | * @param TIMx: where x can be 1, 2, 3, 4 or 8 to select the TIM |
mbed_official | 155:8435094ec241 | 3688 | * peripheral. |
mbed_official | 155:8435094ec241 | 3689 | * @param TIM_EncoderMode: specifies the TIMx Encoder Mode. |
mbed_official | 155:8435094ec241 | 3690 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3691 | * @arg TIM_EncoderMode_TI1: Counter counts on TI1FP1 edge depending on TI2FP2 level. |
mbed_official | 155:8435094ec241 | 3692 | * @arg TIM_EncoderMode_TI2: Counter counts on TI2FP2 edge depending on TI1FP1 level. |
mbed_official | 155:8435094ec241 | 3693 | * @arg TIM_EncoderMode_TI12: Counter counts on both TI1FP1 and TI2FP2 edges depending |
mbed_official | 155:8435094ec241 | 3694 | * on the level of the other input. |
mbed_official | 155:8435094ec241 | 3695 | * @param TIM_IC1Polarity: specifies the IC1 Polarity |
mbed_official | 155:8435094ec241 | 3696 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3697 | * @arg TIM_ICPolarity_Falling: IC Falling edge. |
mbed_official | 155:8435094ec241 | 3698 | * @arg TIM_ICPolarity_Rising: IC Rising edge. |
mbed_official | 155:8435094ec241 | 3699 | * @param TIM_IC2Polarity: specifies the IC2 Polarity |
mbed_official | 155:8435094ec241 | 3700 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3701 | * @arg TIM_ICPolarity_Falling: IC Falling edge. |
mbed_official | 155:8435094ec241 | 3702 | * @arg TIM_ICPolarity_Rising: IC Rising edge. |
mbed_official | 155:8435094ec241 | 3703 | * @retval None |
mbed_official | 155:8435094ec241 | 3704 | */ |
mbed_official | 155:8435094ec241 | 3705 | void TIM_EncoderInterfaceConfig(TIM_TypeDef* TIMx, uint16_t TIM_EncoderMode, |
mbed_official | 155:8435094ec241 | 3706 | uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity) |
mbed_official | 155:8435094ec241 | 3707 | { |
mbed_official | 155:8435094ec241 | 3708 | uint16_t tmpsmcr = 0; |
mbed_official | 155:8435094ec241 | 3709 | uint16_t tmpccmr1 = 0; |
mbed_official | 155:8435094ec241 | 3710 | uint16_t tmpccer = 0; |
mbed_official | 155:8435094ec241 | 3711 | |
mbed_official | 155:8435094ec241 | 3712 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3713 | assert_param(IS_TIM_LIST3_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3714 | assert_param(IS_TIM_ENCODER_MODE(TIM_EncoderMode)); |
mbed_official | 155:8435094ec241 | 3715 | assert_param(IS_TIM_IC_POLARITY(TIM_IC1Polarity)); |
mbed_official | 155:8435094ec241 | 3716 | assert_param(IS_TIM_IC_POLARITY(TIM_IC2Polarity)); |
mbed_official | 155:8435094ec241 | 3717 | |
mbed_official | 155:8435094ec241 | 3718 | /* Get the TIMx SMCR register value */ |
mbed_official | 155:8435094ec241 | 3719 | tmpsmcr = TIMx->SMCR; |
mbed_official | 155:8435094ec241 | 3720 | |
mbed_official | 155:8435094ec241 | 3721 | /* Get the TIMx CCMR1 register value */ |
mbed_official | 155:8435094ec241 | 3722 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 3723 | |
mbed_official | 155:8435094ec241 | 3724 | /* Get the TIMx CCER register value */ |
mbed_official | 155:8435094ec241 | 3725 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 3726 | |
mbed_official | 155:8435094ec241 | 3727 | /* Set the encoder Mode */ |
mbed_official | 155:8435094ec241 | 3728 | tmpsmcr &= (uint16_t)~TIM_SMCR_SMS; |
mbed_official | 155:8435094ec241 | 3729 | tmpsmcr |= TIM_EncoderMode; |
mbed_official | 155:8435094ec241 | 3730 | |
mbed_official | 155:8435094ec241 | 3731 | /* Select the Capture Compare 1 and the Capture Compare 2 as input */ |
mbed_official | 155:8435094ec241 | 3732 | tmpccmr1 &= ((uint16_t)~TIM_CCMR1_CC1S) & ((uint16_t)~TIM_CCMR1_CC2S); |
mbed_official | 155:8435094ec241 | 3733 | tmpccmr1 |= TIM_CCMR1_CC1S_0 | TIM_CCMR1_CC2S_0; |
mbed_official | 155:8435094ec241 | 3734 | |
mbed_official | 155:8435094ec241 | 3735 | /* Set the TI1 and the TI2 Polarities */ |
mbed_official | 155:8435094ec241 | 3736 | tmpccer &= ((uint16_t)~TIM_CCER_CC1P) & ((uint16_t)~TIM_CCER_CC2P); |
mbed_official | 155:8435094ec241 | 3737 | tmpccer |= (uint16_t)(TIM_IC1Polarity | (uint16_t)(TIM_IC2Polarity << (uint16_t)4)); |
mbed_official | 155:8435094ec241 | 3738 | |
mbed_official | 155:8435094ec241 | 3739 | /* Write to TIMx SMCR */ |
mbed_official | 155:8435094ec241 | 3740 | TIMx->SMCR = tmpsmcr; |
mbed_official | 155:8435094ec241 | 3741 | |
mbed_official | 155:8435094ec241 | 3742 | /* Write to TIMx CCMR1 */ |
mbed_official | 155:8435094ec241 | 3743 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 3744 | |
mbed_official | 155:8435094ec241 | 3745 | /* Write to TIMx CCER */ |
mbed_official | 155:8435094ec241 | 3746 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 3747 | } |
mbed_official | 155:8435094ec241 | 3748 | |
mbed_official | 155:8435094ec241 | 3749 | /** |
mbed_official | 155:8435094ec241 | 3750 | * @brief Enables or disables the TIMx's Hall sensor interface. |
mbed_official | 155:8435094ec241 | 3751 | * @param TIMx: where x can be 1, 2, 3, 4, 8 or 15 to select the TIM |
mbed_official | 155:8435094ec241 | 3752 | * peripheral. |
mbed_official | 155:8435094ec241 | 3753 | * @param NewState: new state of the TIMx Hall sensor interface. |
mbed_official | 155:8435094ec241 | 3754 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 155:8435094ec241 | 3755 | * @retval None |
mbed_official | 155:8435094ec241 | 3756 | */ |
mbed_official | 155:8435094ec241 | 3757 | void TIM_SelectHallSensor(TIM_TypeDef* TIMx, FunctionalState NewState) |
mbed_official | 155:8435094ec241 | 3758 | { |
mbed_official | 155:8435094ec241 | 3759 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3760 | assert_param(IS_TIM_LIST2_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3761 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 155:8435094ec241 | 3762 | |
mbed_official | 155:8435094ec241 | 3763 | if (NewState != DISABLE) |
mbed_official | 155:8435094ec241 | 3764 | { |
mbed_official | 155:8435094ec241 | 3765 | /* Set the TI1S Bit */ |
mbed_official | 155:8435094ec241 | 3766 | TIMx->CR2 |= TIM_CR2_TI1S; |
mbed_official | 155:8435094ec241 | 3767 | } |
mbed_official | 155:8435094ec241 | 3768 | else |
mbed_official | 155:8435094ec241 | 3769 | { |
mbed_official | 155:8435094ec241 | 3770 | /* Reset the TI1S Bit */ |
mbed_official | 155:8435094ec241 | 3771 | TIMx->CR2 &= (uint16_t)~TIM_CR2_TI1S; |
mbed_official | 155:8435094ec241 | 3772 | } |
mbed_official | 155:8435094ec241 | 3773 | } |
mbed_official | 155:8435094ec241 | 3774 | /** |
mbed_official | 155:8435094ec241 | 3775 | * @} |
mbed_official | 155:8435094ec241 | 3776 | */ |
mbed_official | 155:8435094ec241 | 3777 | |
mbed_official | 155:8435094ec241 | 3778 | /** @defgroup TIM_Group9 Specific remapping management function |
mbed_official | 155:8435094ec241 | 3779 | * @brief Specific remapping management function |
mbed_official | 155:8435094ec241 | 3780 | * |
mbed_official | 155:8435094ec241 | 3781 | @verbatim |
mbed_official | 155:8435094ec241 | 3782 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3783 | ##### Specific remapping management function ##### |
mbed_official | 155:8435094ec241 | 3784 | =============================================================================== |
mbed_official | 155:8435094ec241 | 3785 | |
mbed_official | 155:8435094ec241 | 3786 | @endverbatim |
mbed_official | 155:8435094ec241 | 3787 | * @{ |
mbed_official | 155:8435094ec241 | 3788 | */ |
mbed_official | 155:8435094ec241 | 3789 | |
mbed_official | 155:8435094ec241 | 3790 | /** |
mbed_official | 155:8435094ec241 | 3791 | * @brief Configures the TIM16 Remapping input Capabilities. |
mbed_official | 155:8435094ec241 | 3792 | * @param TIMx: where x can be 1, 8 or 16 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3793 | * @param TIM_Remap: specifies the TIM input reampping source. |
mbed_official | 155:8435094ec241 | 3794 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3795 | * @arg TIM16_GPIO: TIM16 Channel 1 is connected to GPIO. |
mbed_official | 155:8435094ec241 | 3796 | * @arg TIM16_RTC_CLK: TIM16 Channel 1 is connected to RTC input clock. |
mbed_official | 155:8435094ec241 | 3797 | * @arg TIM16_HSE_DIV32: TIM16 Channel 1 is connected to HSE/32 clock. |
mbed_official | 155:8435094ec241 | 3798 | * @arg TIM16_MCO: TIM16 Channel 1 is connected to MCO clock. |
mbed_official | 155:8435094ec241 | 3799 | * @arg TIM1_ADC1_AWDG1: TIM1 ETR is connected to ADC1 AWDG1. |
mbed_official | 155:8435094ec241 | 3800 | * @arg TIM1_ADC1_AWDG2: TIM1 ETR is connected to ADC1 AWDG2. |
mbed_official | 155:8435094ec241 | 3801 | * @arg TIM1_ADC1_AWDG3: TIM1 ETR is connected to ADC1 AWDG3. |
mbed_official | 155:8435094ec241 | 3802 | * @arg TIM1_ADC4_AWDG1: TIM1 ETR is connected to ADC4 AWDG1. |
mbed_official | 155:8435094ec241 | 3803 | * @arg TIM1_ADC4_AWDG2: TIM1 ETR is connected to ADC4 AWDG2. |
mbed_official | 155:8435094ec241 | 3804 | * @arg TIM1_ADC4_AWDG3: TIM1 ETR is connected to ADC4 AWDG3. |
mbed_official | 155:8435094ec241 | 3805 | * @arg TIM8_ADC2_AWDG1: TIM8 ETR is connected to ADC2 AWDG1. |
mbed_official | 155:8435094ec241 | 3806 | * @arg TIM8_ADC2_AWDG2: TIM8 ETR is connected to ADC2 AWDG2. |
mbed_official | 155:8435094ec241 | 3807 | * @arg TIM8_ADC2_AWDG3: TIM8 ETR is connected to ADC2 AWDG3. |
mbed_official | 155:8435094ec241 | 3808 | * @arg TIM8_ADC4_AWDG1: TIM8 ETR is connected to ADC4 AWDG1. |
mbed_official | 155:8435094ec241 | 3809 | * @arg TIM8_ADC4_AWDG2: TIM8 ETR is connected to ADC4 AWDG2. |
mbed_official | 155:8435094ec241 | 3810 | * @arg TIM8_ADC4_AWDG3: TIM8 ETR is connected to ADC4 AWDG3. |
mbed_official | 155:8435094ec241 | 3811 | * @retval : None |
mbed_official | 155:8435094ec241 | 3812 | */ |
mbed_official | 155:8435094ec241 | 3813 | void TIM_RemapConfig(TIM_TypeDef* TIMx, uint16_t TIM_Remap) |
mbed_official | 155:8435094ec241 | 3814 | { |
mbed_official | 155:8435094ec241 | 3815 | /* Check the parameters */ |
mbed_official | 155:8435094ec241 | 3816 | assert_param(IS_TIM_LIST8_PERIPH(TIMx)); |
mbed_official | 155:8435094ec241 | 3817 | assert_param(IS_TIM_REMAP(TIM_Remap)); |
mbed_official | 155:8435094ec241 | 3818 | |
mbed_official | 155:8435094ec241 | 3819 | /* Set the Timer remapping configuration */ |
mbed_official | 155:8435094ec241 | 3820 | TIMx->OR = TIM_Remap; |
mbed_official | 155:8435094ec241 | 3821 | } |
mbed_official | 155:8435094ec241 | 3822 | /** |
mbed_official | 155:8435094ec241 | 3823 | * @} |
mbed_official | 155:8435094ec241 | 3824 | */ |
mbed_official | 155:8435094ec241 | 3825 | |
mbed_official | 155:8435094ec241 | 3826 | /** |
mbed_official | 155:8435094ec241 | 3827 | * @brief Configure the TI1 as Input. |
mbed_official | 155:8435094ec241 | 3828 | * @param TIMx: where x can be 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13 or 14 |
mbed_official | 155:8435094ec241 | 3829 | * to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3830 | * @param TIM_ICPolarity : The Input Polarity. |
mbed_official | 155:8435094ec241 | 3831 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3832 | * @arg TIM_ICPolarity_Rising |
mbed_official | 155:8435094ec241 | 3833 | * @arg TIM_ICPolarity_Falling |
mbed_official | 155:8435094ec241 | 3834 | * @arg TIM_ICPolarity_BothEdge |
mbed_official | 155:8435094ec241 | 3835 | * @param TIM_ICSelection: specifies the input to be used. |
mbed_official | 155:8435094ec241 | 3836 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3837 | * @arg TIM_ICSelection_DirectTI: TIM Input 1 is selected to be connected to IC1. |
mbed_official | 155:8435094ec241 | 3838 | * @arg TIM_ICSelection_IndirectTI: TIM Input 1 is selected to be connected to IC2. |
mbed_official | 155:8435094ec241 | 3839 | * @arg TIM_ICSelection_TRC: TIM Input 1 is selected to be connected to TRC. |
mbed_official | 155:8435094ec241 | 3840 | * @param TIM_ICFilter: Specifies the Input Capture Filter. |
mbed_official | 155:8435094ec241 | 3841 | * This parameter must be a value between 0x00 and 0x0F. |
mbed_official | 155:8435094ec241 | 3842 | * @retval None |
mbed_official | 155:8435094ec241 | 3843 | */ |
mbed_official | 155:8435094ec241 | 3844 | static void TI1_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 3845 | uint16_t TIM_ICFilter) |
mbed_official | 155:8435094ec241 | 3846 | { |
mbed_official | 155:8435094ec241 | 3847 | uint32_t tmpccmr1 = 0, tmpccer = 0; |
mbed_official | 155:8435094ec241 | 3848 | |
mbed_official | 155:8435094ec241 | 3849 | /* Disable the Channel 1: Reset the CC1E Bit */ |
mbed_official | 155:8435094ec241 | 3850 | TIMx->CCER &= (uint32_t)~TIM_CCER_CC1E; |
mbed_official | 155:8435094ec241 | 3851 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 3852 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 3853 | |
mbed_official | 155:8435094ec241 | 3854 | /* Select the Input and set the filter */ |
mbed_official | 155:8435094ec241 | 3855 | tmpccmr1 &= ((uint32_t)~TIM_CCMR1_CC1S) & ((uint32_t)~TIM_CCMR1_IC1F); |
mbed_official | 155:8435094ec241 | 3856 | tmpccmr1 |= (uint32_t)(TIM_ICSelection | (uint32_t)((uint32_t)TIM_ICFilter << 4)); |
mbed_official | 155:8435094ec241 | 3857 | |
mbed_official | 155:8435094ec241 | 3858 | /* Select the Polarity and set the CC1E Bit */ |
mbed_official | 155:8435094ec241 | 3859 | tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP); |
mbed_official | 155:8435094ec241 | 3860 | tmpccer |= (uint32_t)(TIM_ICPolarity | (uint32_t)TIM_CCER_CC1E); |
mbed_official | 155:8435094ec241 | 3861 | |
mbed_official | 155:8435094ec241 | 3862 | /* Write to TIMx CCMR1 and CCER registers */ |
mbed_official | 155:8435094ec241 | 3863 | TIMx->CCMR1 = tmpccmr1; |
mbed_official | 155:8435094ec241 | 3864 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 3865 | } |
mbed_official | 155:8435094ec241 | 3866 | |
mbed_official | 155:8435094ec241 | 3867 | /** |
mbed_official | 155:8435094ec241 | 3868 | * @brief Configure the TI2 as Input. |
mbed_official | 155:8435094ec241 | 3869 | * @param TIMx: where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM |
mbed_official | 155:8435094ec241 | 3870 | * peripheral. |
mbed_official | 155:8435094ec241 | 3871 | * @param TIM_ICPolarity : The Input Polarity. |
mbed_official | 155:8435094ec241 | 3872 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3873 | * @arg TIM_ICPolarity_Rising |
mbed_official | 155:8435094ec241 | 3874 | * @arg TIM_ICPolarity_Falling |
mbed_official | 155:8435094ec241 | 3875 | * @arg TIM_ICPolarity_BothEdge |
mbed_official | 155:8435094ec241 | 3876 | * @param TIM_ICSelection: specifies the input to be used. |
mbed_official | 155:8435094ec241 | 3877 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3878 | * @arg TIM_ICSelection_DirectTI: TIM Input 2 is selected to be connected to IC2. |
mbed_official | 155:8435094ec241 | 3879 | * @arg TIM_ICSelection_IndirectTI: TIM Input 2 is selected to be connected to IC1. |
mbed_official | 155:8435094ec241 | 3880 | * @arg TIM_ICSelection_TRC: TIM Input 2 is selected to be connected to TRC. |
mbed_official | 155:8435094ec241 | 3881 | * @param TIM_ICFilter: Specifies the Input Capture Filter. |
mbed_official | 155:8435094ec241 | 3882 | * This parameter must be a value between 0x00 and 0x0F. |
mbed_official | 155:8435094ec241 | 3883 | * @retval None |
mbed_official | 155:8435094ec241 | 3884 | */ |
mbed_official | 155:8435094ec241 | 3885 | static void TI2_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 3886 | uint16_t TIM_ICFilter) |
mbed_official | 155:8435094ec241 | 3887 | { |
mbed_official | 155:8435094ec241 | 3888 | uint32_t tmpccmr1 = 0, tmpccer = 0, tmp = 0; |
mbed_official | 155:8435094ec241 | 3889 | |
mbed_official | 155:8435094ec241 | 3890 | /* Disable the Channel 2: Reset the CC2E Bit */ |
mbed_official | 155:8435094ec241 | 3891 | TIMx->CCER &= (uint16_t)~TIM_CCER_CC2E; |
mbed_official | 155:8435094ec241 | 3892 | tmpccmr1 = TIMx->CCMR1; |
mbed_official | 155:8435094ec241 | 3893 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 3894 | tmp = (uint16_t)(TIM_ICPolarity << 4); |
mbed_official | 155:8435094ec241 | 3895 | |
mbed_official | 155:8435094ec241 | 3896 | /* Select the Input and set the filter */ |
mbed_official | 155:8435094ec241 | 3897 | tmpccmr1 &= ((uint32_t)~TIM_CCMR1_CC2S) & ((uint32_t)~TIM_CCMR1_IC2F); |
mbed_official | 155:8435094ec241 | 3898 | tmpccmr1 |= (uint32_t)((uint32_t)TIM_ICFilter << 12); |
mbed_official | 155:8435094ec241 | 3899 | tmpccmr1 |= (uint32_t)((uint32_t)TIM_ICSelection << 8); |
mbed_official | 155:8435094ec241 | 3900 | |
mbed_official | 155:8435094ec241 | 3901 | /* Select the Polarity and set the CC2E Bit */ |
mbed_official | 155:8435094ec241 | 3902 | tmpccer &= (uint16_t)~(TIM_CCER_CC2P | TIM_CCER_CC2NP); |
mbed_official | 155:8435094ec241 | 3903 | tmpccer |= (uint16_t)(tmp | (uint16_t)TIM_CCER_CC2E); |
mbed_official | 155:8435094ec241 | 3904 | |
mbed_official | 155:8435094ec241 | 3905 | /* Write to TIMx CCMR1 and CCER registers */ |
mbed_official | 155:8435094ec241 | 3906 | TIMx->CCMR1 = tmpccmr1 ; |
mbed_official | 155:8435094ec241 | 3907 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 3908 | } |
mbed_official | 155:8435094ec241 | 3909 | |
mbed_official | 155:8435094ec241 | 3910 | /** |
mbed_official | 155:8435094ec241 | 3911 | * @brief Configure the TI3 as Input. |
mbed_official | 155:8435094ec241 | 3912 | * @param TIMx: where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3913 | * @param TIM_ICPolarity : The Input Polarity. |
mbed_official | 155:8435094ec241 | 3914 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3915 | * @arg TIM_ICPolarity_Rising |
mbed_official | 155:8435094ec241 | 3916 | * @arg TIM_ICPolarity_Falling |
mbed_official | 155:8435094ec241 | 3917 | * @arg TIM_ICPolarity_BothEdge |
mbed_official | 155:8435094ec241 | 3918 | * @param TIM_ICSelection: specifies the input to be used. |
mbed_official | 155:8435094ec241 | 3919 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3920 | * @arg TIM_ICSelection_DirectTI: TIM Input 3 is selected to be connected to IC3. |
mbed_official | 155:8435094ec241 | 3921 | * @arg TIM_ICSelection_IndirectTI: TIM Input 3 is selected to be connected to IC4. |
mbed_official | 155:8435094ec241 | 3922 | * @arg TIM_ICSelection_TRC: TIM Input 3 is selected to be connected to TRC. |
mbed_official | 155:8435094ec241 | 3923 | * @param TIM_ICFilter: Specifies the Input Capture Filter. |
mbed_official | 155:8435094ec241 | 3924 | * This parameter must be a value between 0x00 and 0x0F. |
mbed_official | 155:8435094ec241 | 3925 | * @retval None |
mbed_official | 155:8435094ec241 | 3926 | */ |
mbed_official | 155:8435094ec241 | 3927 | static void TI3_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 3928 | uint16_t TIM_ICFilter) |
mbed_official | 155:8435094ec241 | 3929 | { |
mbed_official | 155:8435094ec241 | 3930 | uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0; |
mbed_official | 155:8435094ec241 | 3931 | |
mbed_official | 155:8435094ec241 | 3932 | /* Disable the Channel 3: Reset the CC3E Bit */ |
mbed_official | 155:8435094ec241 | 3933 | TIMx->CCER &= (uint16_t)~TIM_CCER_CC3E; |
mbed_official | 155:8435094ec241 | 3934 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 3935 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 3936 | tmp = (uint16_t)(TIM_ICPolarity << 8); |
mbed_official | 155:8435094ec241 | 3937 | |
mbed_official | 155:8435094ec241 | 3938 | /* Select the Input and set the filter */ |
mbed_official | 155:8435094ec241 | 3939 | tmpccmr2 &= ((uint16_t)~TIM_CCMR1_CC1S) & ((uint16_t)~TIM_CCMR2_IC3F); |
mbed_official | 155:8435094ec241 | 3940 | tmpccmr2 |= (uint16_t)(TIM_ICSelection | (uint16_t)(TIM_ICFilter << (uint16_t)4)); |
mbed_official | 155:8435094ec241 | 3941 | |
mbed_official | 155:8435094ec241 | 3942 | /* Select the Polarity and set the CC3E Bit */ |
mbed_official | 155:8435094ec241 | 3943 | tmpccer &= (uint16_t)~(TIM_CCER_CC3P | TIM_CCER_CC3NP); |
mbed_official | 155:8435094ec241 | 3944 | tmpccer |= (uint16_t)(tmp | (uint16_t)TIM_CCER_CC3E); |
mbed_official | 155:8435094ec241 | 3945 | |
mbed_official | 155:8435094ec241 | 3946 | /* Write to TIMx CCMR2 and CCER registers */ |
mbed_official | 155:8435094ec241 | 3947 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 3948 | TIMx->CCER = tmpccer; |
mbed_official | 155:8435094ec241 | 3949 | } |
mbed_official | 155:8435094ec241 | 3950 | |
mbed_official | 155:8435094ec241 | 3951 | /** |
mbed_official | 155:8435094ec241 | 3952 | * @brief Configure the TI4 as Input. |
mbed_official | 155:8435094ec241 | 3953 | * @param TIMx: where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
mbed_official | 155:8435094ec241 | 3954 | * @param TIM_ICPolarity : The Input Polarity. |
mbed_official | 155:8435094ec241 | 3955 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3956 | * @arg TIM_ICPolarity_Rising |
mbed_official | 155:8435094ec241 | 3957 | * @arg TIM_ICPolarity_Falling |
mbed_official | 155:8435094ec241 | 3958 | * @arg TIM_ICPolarity_BothEdge |
mbed_official | 155:8435094ec241 | 3959 | * @param TIM_ICSelection: specifies the input to be used. |
mbed_official | 155:8435094ec241 | 3960 | * This parameter can be one of the following values: |
mbed_official | 155:8435094ec241 | 3961 | * @arg TIM_ICSelection_DirectTI: TIM Input 4 is selected to be connected to IC4. |
mbed_official | 155:8435094ec241 | 3962 | * @arg TIM_ICSelection_IndirectTI: TIM Input 4 is selected to be connected to IC3. |
mbed_official | 155:8435094ec241 | 3963 | * @arg TIM_ICSelection_TRC: TIM Input 4 is selected to be connected to TRC. |
mbed_official | 155:8435094ec241 | 3964 | * @param TIM_ICFilter: Specifies the Input Capture Filter. |
mbed_official | 155:8435094ec241 | 3965 | * This parameter must be a value between 0x00 and 0x0F. |
mbed_official | 155:8435094ec241 | 3966 | * @retval None |
mbed_official | 155:8435094ec241 | 3967 | */ |
mbed_official | 155:8435094ec241 | 3968 | static void TI4_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, |
mbed_official | 155:8435094ec241 | 3969 | uint16_t TIM_ICFilter) |
mbed_official | 155:8435094ec241 | 3970 | { |
mbed_official | 155:8435094ec241 | 3971 | uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0; |
mbed_official | 155:8435094ec241 | 3972 | |
mbed_official | 155:8435094ec241 | 3973 | /* Disable the Channel 4: Reset the CC4E Bit */ |
mbed_official | 155:8435094ec241 | 3974 | TIMx->CCER &= (uint16_t)~TIM_CCER_CC4E; |
mbed_official | 155:8435094ec241 | 3975 | tmpccmr2 = TIMx->CCMR2; |
mbed_official | 155:8435094ec241 | 3976 | tmpccer = TIMx->CCER; |
mbed_official | 155:8435094ec241 | 3977 | tmp = (uint16_t)(TIM_ICPolarity << 12); |
mbed_official | 155:8435094ec241 | 3978 | |
mbed_official | 155:8435094ec241 | 3979 | /* Select the Input and set the filter */ |
mbed_official | 155:8435094ec241 | 3980 | tmpccmr2 &= ((uint16_t)~TIM_CCMR1_CC2S) & ((uint16_t)~TIM_CCMR1_IC2F); |
mbed_official | 155:8435094ec241 | 3981 | tmpccmr2 |= (uint16_t)(TIM_ICSelection << 8); |
mbed_official | 155:8435094ec241 | 3982 | tmpccmr2 |= (uint16_t)(TIM_ICFilter << 12); |
mbed_official | 155:8435094ec241 | 3983 | |
mbed_official | 155:8435094ec241 | 3984 | /* Select the Polarity and set the CC4E Bit */ |
mbed_official | 155:8435094ec241 | 3985 | tmpccer &= (uint16_t)~(TIM_CCER_CC4P | TIM_CCER_CC4NP); |
mbed_official | 155:8435094ec241 | 3986 | tmpccer |= (uint16_t)(tmp | (uint16_t)TIM_CCER_CC4E); |
mbed_official | 155:8435094ec241 | 3987 | |
mbed_official | 155:8435094ec241 | 3988 | /* Write to TIMx CCMR2 and CCER registers */ |
mbed_official | 155:8435094ec241 | 3989 | TIMx->CCMR2 = tmpccmr2; |
mbed_official | 155:8435094ec241 | 3990 | TIMx->CCER = tmpccer ; |
mbed_official | 155:8435094ec241 | 3991 | } |
mbed_official | 155:8435094ec241 | 3992 | |
mbed_official | 155:8435094ec241 | 3993 | /** |
mbed_official | 155:8435094ec241 | 3994 | * @} |
mbed_official | 155:8435094ec241 | 3995 | */ |
mbed_official | 155:8435094ec241 | 3996 | |
mbed_official | 155:8435094ec241 | 3997 | /** |
mbed_official | 155:8435094ec241 | 3998 | * @} |
mbed_official | 155:8435094ec241 | 3999 | */ |
mbed_official | 155:8435094ec241 | 4000 | |
mbed_official | 155:8435094ec241 | 4001 | /** |
mbed_official | 155:8435094ec241 | 4002 | * @} |
mbed_official | 155:8435094ec241 | 4003 | */ |
mbed_official | 155:8435094ec241 | 4004 | |
mbed_official | 155:8435094ec241 | 4005 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |