mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32L0/stm32l0xx_hal_tim_ex.c@636:a11c0372f0ba, 2015-09-30 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Sep 30 17:00:09 2015 +0100
- Revision:
- 636:a11c0372f0ba
- Parent:
- 490:119543c9f674
Synchronized with git revision d29c98dae61be0946ddf3a3c641c7726056f9452
Full URL: https://github.com/mbedmicro/mbed/commit/d29c98dae61be0946ddf3a3c641c7726056f9452/
Added support for SAMW25
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 376:cb4d9db17537 | 1 | /** |
mbed_official | 376:cb4d9db17537 | 2 | ****************************************************************************** |
mbed_official | 376:cb4d9db17537 | 3 | * @file stm32l0xx_hal_tim_ex.c |
mbed_official | 376:cb4d9db17537 | 4 | * @author MCD Application Team |
mbed_official | 490:119543c9f674 | 5 | * @version V1.2.0 |
mbed_official | 490:119543c9f674 | 6 | * @date 06-February-2015 |
mbed_official | 376:cb4d9db17537 | 7 | * @brief TIM HAL module driver. |
mbed_official | 376:cb4d9db17537 | 8 | * @brief This file provides firmware functions to manage the following |
mbed_official | 376:cb4d9db17537 | 9 | * functionalities of the Timer (TIM) peripheral: |
mbed_official | 376:cb4d9db17537 | 10 | * + Time Hall Sensor Interface Initialization |
mbed_official | 376:cb4d9db17537 | 11 | * + Time Hall Sensor Interface Start |
mbed_official | 376:cb4d9db17537 | 12 | * + Time Master and Slave synchronization configuration |
mbed_official | 376:cb4d9db17537 | 13 | @verbatim |
mbed_official | 376:cb4d9db17537 | 14 | ================================================================================ |
mbed_official | 376:cb4d9db17537 | 15 | ##### TIM specific features integration ##### |
mbed_official | 376:cb4d9db17537 | 16 | ================================================================================ |
mbed_official | 376:cb4d9db17537 | 17 | |
mbed_official | 376:cb4d9db17537 | 18 | [..] The Timer features include: |
mbed_official | 376:cb4d9db17537 | 19 | (#) 16-bit up, down, up/down auto-reload counter. |
mbed_official | 376:cb4d9db17537 | 20 | (#) 16-bit programmable prescaler allowing dividing (also on the fly) the counter clock |
mbed_official | 376:cb4d9db17537 | 21 | frequency either by any factor between 1 and 65536. |
mbed_official | 376:cb4d9db17537 | 22 | (#) Up to 4 independent channels for: |
mbed_official | 376:cb4d9db17537 | 23 | Input Capture |
mbed_official | 376:cb4d9db17537 | 24 | Output Compare |
mbed_official | 376:cb4d9db17537 | 25 | PWM generation (Edge and Center-aligned Mode) |
mbed_official | 376:cb4d9db17537 | 26 | One-pulse mode output |
mbed_official | 376:cb4d9db17537 | 27 | (#) Synchronization circuit to control the timer with external signals and to interconnect |
mbed_official | 376:cb4d9db17537 | 28 | several timers together. |
mbed_official | 376:cb4d9db17537 | 29 | (#) Supports incremental (quadrature) encoder and hall-sensor circuitry for positioning |
mbed_official | 376:cb4d9db17537 | 30 | purposes |
mbed_official | 376:cb4d9db17537 | 31 | |
mbed_official | 376:cb4d9db17537 | 32 | ##### How to use this driver ##### |
mbed_official | 376:cb4d9db17537 | 33 | ================================================================================ |
mbed_official | 376:cb4d9db17537 | 34 | [..] |
mbed_official | 376:cb4d9db17537 | 35 | (#) Enable the TIM interface clock using |
mbed_official | 490:119543c9f674 | 36 | __HAL_RCC_TIMx_CLK_ENABLE(); |
mbed_official | 376:cb4d9db17537 | 37 | |
mbed_official | 376:cb4d9db17537 | 38 | (#) TIM pins configuration |
mbed_official | 376:cb4d9db17537 | 39 | (++) Enable the clock for the TIM GPIOs using the following function: |
mbed_official | 490:119543c9f674 | 40 | __HAL_RCC_GPIOx_CLK_ENABLE(); |
mbed_official | 376:cb4d9db17537 | 41 | (++) Configure these TIM pins in Alternate function mode using HAL_GPIO_Init(); |
mbed_official | 376:cb4d9db17537 | 42 | |
mbed_official | 376:cb4d9db17537 | 43 | (#) The external Clock can be configured, if needed (the default clock is the internal clock from the APBx), |
mbed_official | 376:cb4d9db17537 | 44 | using the following function: |
mbed_official | 376:cb4d9db17537 | 45 | HAL_TIM_ConfigClockSource, the clock configuration should be done before any start function. |
mbed_official | 376:cb4d9db17537 | 46 | |
mbed_official | 376:cb4d9db17537 | 47 | (#) Configure the TIM in the desired operating mode using one of the |
mbed_official | 376:cb4d9db17537 | 48 | configuration function of this driver: |
mbed_official | 376:cb4d9db17537 | 49 | (++) HAL_TIMEx_MasterConfigSynchronization() to configure the peripheral in master mode. |
mbed_official | 376:cb4d9db17537 | 50 | |
mbed_official | 376:cb4d9db17537 | 51 | (#) Remap the Timer I/O using HAL_TIMEx_RemapConfig() API. |
mbed_official | 376:cb4d9db17537 | 52 | |
mbed_official | 376:cb4d9db17537 | 53 | |
mbed_official | 376:cb4d9db17537 | 54 | @endverbatim |
mbed_official | 376:cb4d9db17537 | 55 | ****************************************************************************** |
mbed_official | 376:cb4d9db17537 | 56 | * @attention |
mbed_official | 376:cb4d9db17537 | 57 | * |
mbed_official | 490:119543c9f674 | 58 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
mbed_official | 376:cb4d9db17537 | 59 | * |
mbed_official | 376:cb4d9db17537 | 60 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 376:cb4d9db17537 | 61 | * are permitted provided that the following conditions are met: |
mbed_official | 376:cb4d9db17537 | 62 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 376:cb4d9db17537 | 63 | * this list of conditions and the following disclaimer. |
mbed_official | 376:cb4d9db17537 | 64 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 376:cb4d9db17537 | 65 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 376:cb4d9db17537 | 66 | * and/or other materials provided with the distribution. |
mbed_official | 376:cb4d9db17537 | 67 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 376:cb4d9db17537 | 68 | * may be used to endorse or promote products derived from this software |
mbed_official | 376:cb4d9db17537 | 69 | * without specific prior written permission. |
mbed_official | 376:cb4d9db17537 | 70 | * |
mbed_official | 376:cb4d9db17537 | 71 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 376:cb4d9db17537 | 72 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 376:cb4d9db17537 | 73 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 376:cb4d9db17537 | 74 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 376:cb4d9db17537 | 75 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 376:cb4d9db17537 | 76 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 376:cb4d9db17537 | 77 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 376:cb4d9db17537 | 78 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 376:cb4d9db17537 | 79 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 376:cb4d9db17537 | 80 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 376:cb4d9db17537 | 81 | * |
mbed_official | 376:cb4d9db17537 | 82 | ****************************************************************************** |
mbed_official | 376:cb4d9db17537 | 83 | */ |
mbed_official | 376:cb4d9db17537 | 84 | |
mbed_official | 376:cb4d9db17537 | 85 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 376:cb4d9db17537 | 86 | #include "stm32l0xx_hal.h" |
mbed_official | 376:cb4d9db17537 | 87 | |
mbed_official | 376:cb4d9db17537 | 88 | /** @addtogroup STM32L0xx_HAL_Driver |
mbed_official | 376:cb4d9db17537 | 89 | * @{ |
mbed_official | 376:cb4d9db17537 | 90 | */ |
mbed_official | 376:cb4d9db17537 | 91 | |
mbed_official | 490:119543c9f674 | 92 | /** @addtogroup TIMEx |
mbed_official | 376:cb4d9db17537 | 93 | * @brief TIMEx HAL module driver |
mbed_official | 376:cb4d9db17537 | 94 | * @{ |
mbed_official | 376:cb4d9db17537 | 95 | */ |
mbed_official | 376:cb4d9db17537 | 96 | |
mbed_official | 376:cb4d9db17537 | 97 | #ifdef HAL_TIM_MODULE_ENABLED |
mbed_official | 376:cb4d9db17537 | 98 | |
mbed_official | 376:cb4d9db17537 | 99 | |
mbed_official | 490:119543c9f674 | 100 | /** @addtogroup TIMEx_Exported_Functions |
mbed_official | 376:cb4d9db17537 | 101 | * @{ |
mbed_official | 376:cb4d9db17537 | 102 | */ |
mbed_official | 376:cb4d9db17537 | 103 | |
mbed_official | 376:cb4d9db17537 | 104 | |
mbed_official | 490:119543c9f674 | 105 | /** @addtogroup TIMEx_Exported_Functions_Group1 |
mbed_official | 490:119543c9f674 | 106 | * @brief Peripheral Control functions |
mbed_official | 376:cb4d9db17537 | 107 | * |
mbed_official | 376:cb4d9db17537 | 108 | @verbatim |
mbed_official | 376:cb4d9db17537 | 109 | =============================================================================== |
mbed_official | 376:cb4d9db17537 | 110 | ##### Peripheral Control functions ##### |
mbed_official | 376:cb4d9db17537 | 111 | =============================================================================== |
mbed_official | 376:cb4d9db17537 | 112 | [..] This section provides functions allowing to: |
mbed_official | 376:cb4d9db17537 | 113 | (+) Configure Master and the Slave synchronization. |
mbed_official | 376:cb4d9db17537 | 114 | |
mbed_official | 376:cb4d9db17537 | 115 | @endverbatim |
mbed_official | 376:cb4d9db17537 | 116 | * @{ |
mbed_official | 376:cb4d9db17537 | 117 | */ |
mbed_official | 376:cb4d9db17537 | 118 | |
mbed_official | 376:cb4d9db17537 | 119 | /** |
mbed_official | 376:cb4d9db17537 | 120 | * @brief Configures the TIM in master mode. |
mbed_official | 376:cb4d9db17537 | 121 | * @param htim: TIM handle. |
mbed_official | 376:cb4d9db17537 | 122 | * @param sMasterConfig: pointer to a TIM_MasterConfigTypeDef structure that |
mbed_official | 376:cb4d9db17537 | 123 | * contains the selected trigger output (TRGO) and the Master/Slave |
mbed_official | 376:cb4d9db17537 | 124 | * mode. |
mbed_official | 376:cb4d9db17537 | 125 | * @retval HAL status |
mbed_official | 376:cb4d9db17537 | 126 | */ |
mbed_official | 376:cb4d9db17537 | 127 | HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef * sMasterConfig) |
mbed_official | 376:cb4d9db17537 | 128 | { |
mbed_official | 376:cb4d9db17537 | 129 | /* Check the parameters */ |
mbed_official | 376:cb4d9db17537 | 130 | assert_param(IS_TIM_MASTER_INSTANCE(htim->Instance)); |
mbed_official | 376:cb4d9db17537 | 131 | assert_param(IS_TIM_TRGO_SOURCE(sMasterConfig->MasterOutputTrigger)); |
mbed_official | 376:cb4d9db17537 | 132 | assert_param(IS_TIM_MSM_STATE(sMasterConfig->MasterSlaveMode)); |
mbed_official | 376:cb4d9db17537 | 133 | |
mbed_official | 376:cb4d9db17537 | 134 | __HAL_LOCK(htim); |
mbed_official | 376:cb4d9db17537 | 135 | |
mbed_official | 376:cb4d9db17537 | 136 | /* Change the handler state */ |
mbed_official | 376:cb4d9db17537 | 137 | htim->State = HAL_TIM_STATE_BUSY; |
mbed_official | 376:cb4d9db17537 | 138 | |
mbed_official | 376:cb4d9db17537 | 139 | /* Reset the MMS Bits */ |
mbed_official | 376:cb4d9db17537 | 140 | htim->Instance->CR2 &= ~TIM_CR2_MMS; |
mbed_official | 376:cb4d9db17537 | 141 | /* Select the TRGO source */ |
mbed_official | 376:cb4d9db17537 | 142 | htim->Instance->CR2 |= sMasterConfig->MasterOutputTrigger; |
mbed_official | 376:cb4d9db17537 | 143 | |
mbed_official | 376:cb4d9db17537 | 144 | /* Reset the MSM Bit */ |
mbed_official | 376:cb4d9db17537 | 145 | htim->Instance->SMCR &= ~TIM_SMCR_MSM; |
mbed_official | 376:cb4d9db17537 | 146 | /* Set or Reset the MSM Bit */ |
mbed_official | 376:cb4d9db17537 | 147 | htim->Instance->SMCR |= sMasterConfig->MasterSlaveMode; |
mbed_official | 376:cb4d9db17537 | 148 | |
mbed_official | 376:cb4d9db17537 | 149 | htim->State = HAL_TIM_STATE_READY; |
mbed_official | 376:cb4d9db17537 | 150 | |
mbed_official | 376:cb4d9db17537 | 151 | __HAL_UNLOCK(htim); |
mbed_official | 376:cb4d9db17537 | 152 | |
mbed_official | 376:cb4d9db17537 | 153 | return HAL_OK; |
mbed_official | 376:cb4d9db17537 | 154 | } |
mbed_official | 376:cb4d9db17537 | 155 | |
mbed_official | 490:119543c9f674 | 156 | |
mbed_official | 490:119543c9f674 | 157 | #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) \ |
mbed_official | 490:119543c9f674 | 158 | || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) |
mbed_official | 490:119543c9f674 | 159 | |
mbed_official | 376:cb4d9db17537 | 160 | /** |
mbed_official | 490:119543c9f674 | 161 | * @brief Configures the remapping of the TIM2, TIM3, TIM21 and TIM22 inputs. |
mbed_official | 490:119543c9f674 | 162 | * The channel inputs (T1..T4) and the Trigger input (ETR) of the |
mbed_official | 490:119543c9f674 | 163 | * timers can be remaped thanks to this function. When an input is |
mbed_official | 490:119543c9f674 | 164 | * mapped, on a GPIO, refer yourself to the GPIO alternate functions |
mbed_official | 490:119543c9f674 | 165 | * for more details. |
mbed_official | 490:119543c9f674 | 166 | * @note It is not possible to connect TIM2 and TIM21 on |
mbed_official | 490:119543c9f674 | 167 | * GPIOB5_AF4 at the same time. |
mbed_official | 490:119543c9f674 | 168 | * When selecting TIM3_TI2_GPIOB5_AF4, Channel2 of TIM3 will be |
mbed_official | 490:119543c9f674 | 169 | * connected to GPIOB5_AF4 and Channel2 of TIM22 will be connected to |
mbed_official | 490:119543c9f674 | 170 | * some other GPIOs. (refer to alternate functions for more details) |
mbed_official | 490:119543c9f674 | 171 | * When selecting TIM3_TI2_GPIO_DEF, Channel2 of Timer 3 will be |
mbed_official | 490:119543c9f674 | 172 | * connected an GPIO (other than GPIOB5_AF4) and Channel2 of TIM22 |
mbed_official | 490:119543c9f674 | 173 | * will be connected to GPIOB5_AF4. |
mbed_official | 490:119543c9f674 | 174 | * |
mbed_official | 376:cb4d9db17537 | 175 | * @param htim: pointer to a TIM_HandleTypeDef structure that contains |
mbed_official | 490:119543c9f674 | 176 | * the configuration information for TIM module. |
mbed_official | 490:119543c9f674 | 177 | * @param Remap: specifies the TIM input remapping source. |
mbed_official | 490:119543c9f674 | 178 | * This parameter is a combination of the following values |
mbed_official | 490:119543c9f674 | 179 | * depending on TIM instance: |
mbed_official | 490:119543c9f674 | 180 | * |
mbed_official | 490:119543c9f674 | 181 | * For TIM2, the parameter can have the following values: |
mbed_official | 490:119543c9f674 | 182 | * @arg TIM2_ETR_GPIO: TIM2 ETR connected to GPIO (default): |
mbed_official | 490:119543c9f674 | 183 | * GPIOA(0)_AF5 or GPIOA(5)_AF2 or |
mbed_official | 490:119543c9f674 | 184 | * GPIOA(15)_AF2 or GPIOE(9)_AF2 |
mbed_official | 490:119543c9f674 | 185 | * @arg TIM2_ETR_HSI48: TIM2 ETR connected to HSI48 |
mbed_official | 490:119543c9f674 | 186 | * @arg TIM2_ETR_LSE: TIM2 ETR connected to LSE |
mbed_official | 490:119543c9f674 | 187 | * @arg TIM2_ETR_COMP2_OUT: TIM2 ETR connected to COMP2 output |
mbed_official | 490:119543c9f674 | 188 | * @arg TIM2_ETR_COMP1_OUT: TIM2 ETR connected to COMP1 output |
mbed_official | 490:119543c9f674 | 189 | * @arg TIM2_TI4_GPIO : TIM2 TI4 connected to GPIO1(default): |
mbed_official | 490:119543c9f674 | 190 | * GPIOA(3)_AF2 or GPIOB(11)_AF2 or |
mbed_official | 490:119543c9f674 | 191 | * GPIOE(12)_AF0 |
mbed_official | 490:119543c9f674 | 192 | * @arg TIM2_TI4_COMP1: TIM2 TI4 connected to COMP1 |
mbed_official | 490:119543c9f674 | 193 | * @arg TIM2_TI4_COMP2: TIM2 TI4 connected to COMP2 |
mbed_official | 490:119543c9f674 | 194 | * |
mbed_official | 490:119543c9f674 | 195 | * For TIM3, the parameter can have the following values: |
mbed_official | 490:119543c9f674 | 196 | * @arg TIM3_ETR_GPIO: TIM3 ETR connected to GPIO (default): |
mbed_official | 490:119543c9f674 | 197 | * GPIOE(2)_AF2 or GPIOD(2)_AF2 or |
mbed_official | 490:119543c9f674 | 198 | * GPIOE(2)AF2 |
mbed_official | 490:119543c9f674 | 199 | * @arg TIM3_ETR_HSI: TIM3 ETR connected to HSI |
mbed_official | 490:119543c9f674 | 200 | * @arg TIM3_TI1_USB_SOF: TIM3 TI1 connected to USB_SOF (default) |
mbed_official | 490:119543c9f674 | 201 | * @arg TIM3_TI1_GPIO: TIM3 TI1 connected to GPIO : |
mbed_official | 490:119543c9f674 | 202 | * GPIOE(3)_AF2 or GPIOA(6)_AF2 or |
mbed_official | 490:119543c9f674 | 203 | * GPIOC(6)_AF2 or GPIOB(4)_AF2 |
mbed_official | 490:119543c9f674 | 204 | * @arg TIM3_TI2_GPIOB5_AF4:TIM3 TI3 connected to GPIOB(5)_AF4 |
mbed_official | 490:119543c9f674 | 205 | * (refer to note) |
mbed_official | 490:119543c9f674 | 206 | * @arg TIM3_TI2_GPIO_DEF: TIM3 TI3 connected to GPIO (default): |
mbed_official | 490:119543c9f674 | 207 | * GPIO_A(7)_AF2 or GPIO_B(5)_AF4 or |
mbed_official | 490:119543c9f674 | 208 | * GPIOC(7)_AF2 or GPIOE(7)_AF2 |
mbed_official | 490:119543c9f674 | 209 | * @arg TIM3_TI4_GPIO_DEF: TIM3 TI4 connected to GPIO: |
mbed_official | 490:119543c9f674 | 210 | * GPIO_B(1)_AF2 or GPIO_E(6)_AF2 |
mbed_official | 490:119543c9f674 | 211 | * @arg TIM3_TI4_GPIOC9_AF2:TIM3 TI4 connected to GPIOC(9)_AF2 |
mbed_official | 490:119543c9f674 | 212 | * |
mbed_official | 490:119543c9f674 | 213 | * For TIM21, the parameter can have the following values: |
mbed_official | 490:119543c9f674 | 214 | * @arg TIM21_ETR_GPIO: TIM21 ETR connected to GPIO(default) : |
mbed_official | 490:119543c9f674 | 215 | * APB2_PC(9)_AF0 or APB2_PA(1)_AF5 |
mbed_official | 490:119543c9f674 | 216 | * @arg TIM21_ETR_COMP2_OUT:TIM21 ETR connected to COMP2 output |
mbed_official | 490:119543c9f674 | 217 | * @arg TIM21_ETR_COMP1_OUT:TIM21 ETR connected to COMP1 output |
mbed_official | 490:119543c9f674 | 218 | * @arg TIM21_ETR_LSE: TIM21 ETR connected to LSE |
mbed_official | 490:119543c9f674 | 219 | * @arg TIM21_TI1_MCO: TIM21 TI1 connected to MCO |
mbed_official | 490:119543c9f674 | 220 | * @arg TIM21_TI1_RTC_WKUT_IT: TIM21 TI1 connected to RTC WAKEUP interrupt |
mbed_official | 490:119543c9f674 | 221 | * @arg TIM21_TI1_HSE_RTC: TIM21 TI1 connected to HSE_RTC |
mbed_official | 490:119543c9f674 | 222 | * @arg TIM21_TI1_MSI: TIM21 TI1 connected to MSI clock |
mbed_official | 490:119543c9f674 | 223 | * @arg TIM21_TI1_LSE: TIM21 TI1 connected to LSE |
mbed_official | 490:119543c9f674 | 224 | * @arg TIM21_TI1_LSI: TIM21 TI1 connected to LSI |
mbed_official | 490:119543c9f674 | 225 | * @arg TIM21_TI1_COMP1_OUT:TIM21 TI1 connected to COMP1_OUT |
mbed_official | 490:119543c9f674 | 226 | * @arg TIM21_TI1_GPIO: TIM21 TI1 connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 227 | * GPIOA(2)_AF0 or GPIOB(13)_AF6 or |
mbed_official | 490:119543c9f674 | 228 | * GPIOE(5)_AF0 or GPIOD(0)_AF0 |
mbed_official | 490:119543c9f674 | 229 | * @arg TIM21_TI2_GPIO: TIM21 TI2 connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 230 | * GPIOA(3)_AF0 or GPIOB(14)_AF6 or |
mbed_official | 490:119543c9f674 | 231 | * GPIOE(6)_AF0 or GPIOD(7)_AF1 |
mbed_official | 490:119543c9f674 | 232 | * @arg TIM21_TI2_COMP2_OUT:TIM21 TI2 connected to COMP2 output |
mbed_official | 490:119543c9f674 | 233 | * |
mbed_official | 490:119543c9f674 | 234 | * For TIM22, the parameter can have the following values: |
mbed_official | 490:119543c9f674 | 235 | * @arg TIM22_ETR_LSE: TIM22 ETR connected to LSE |
mbed_official | 490:119543c9f674 | 236 | * @arg TIM22_ETR_COMP2_OUT:TIM22 ETR connected to COMP2 output |
mbed_official | 490:119543c9f674 | 237 | * @arg TIM22_ETR_COMP1_OUT:TIM22 ETR connected to COMP1 output |
mbed_official | 490:119543c9f674 | 238 | * @arg TIM22_ETR_GPIO: TIM22 ETR connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 239 | * GPIOC(8)_AF0 or GPIOA(4)_AF5 |
mbed_official | 490:119543c9f674 | 240 | * @arg TIM22_TI1_GPIO1: TIM22 TI1 connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 241 | * GPIOC(6)_AF0 or GPIOA(6)_AF5 or |
mbed_official | 490:119543c9f674 | 242 | * GPIOB(4)_AF4 or GPIOE(0)_AF3 |
mbed_official | 490:119543c9f674 | 243 | * @arg TIM22_TI1_COMP2_OUT:TIM22 TI1 connected to COMP2 output |
mbed_official | 490:119543c9f674 | 244 | * @arg TIM22_TI1_COMP1_OUT:TIM22 TI1 connected to COMP1 output |
mbed_official | 490:119543c9f674 | 245 | * @arg TIM22_TI1_GPIO2: TIM22 TI1 connected to GPIO: |
mbed_official | 490:119543c9f674 | 246 | * GPIOC(6)_AF0 or GPIOA(6)_AF5 or |
mbed_official | 490:119543c9f674 | 247 | * GPIOB(4)_AF4 or GPIOE(3)_AF0 |
mbed_official | 490:119543c9f674 | 248 | * |
mbed_official | 376:cb4d9db17537 | 249 | * @retval HAL status |
mbed_official | 376:cb4d9db17537 | 250 | */ |
mbed_official | 490:119543c9f674 | 251 | #else |
mbed_official | 490:119543c9f674 | 252 | /** |
mbed_official | 490:119543c9f674 | 253 | * @brief Configures the remapping of the TIM2, TIM21 and TIM22 inputs. |
mbed_official | 490:119543c9f674 | 254 | * The channel inputs (T1..T4) and the Trigger input (ETR) of the |
mbed_official | 490:119543c9f674 | 255 | * timers can be remaped thanks to this function. When an input is |
mbed_official | 490:119543c9f674 | 256 | * mapped, on a GPIO, refer yourself to the GPIO alternate functions |
mbed_official | 490:119543c9f674 | 257 | * for more details. |
mbed_official | 490:119543c9f674 | 258 | * |
mbed_official | 490:119543c9f674 | 259 | * @param htim: pointer to a TIM_HandleTypeDef structure that contains |
mbed_official | 490:119543c9f674 | 260 | * the configuration information for TIM module. |
mbed_official | 490:119543c9f674 | 261 | * @param Remap: specifies the TIM input remapping source. |
mbed_official | 490:119543c9f674 | 262 | * This parameter is a combination of the following values |
mbed_official | 490:119543c9f674 | 263 | * depending on TIM instance: |
mbed_official | 490:119543c9f674 | 264 | * |
mbed_official | 490:119543c9f674 | 265 | * For TIM2, the parameter can have the following values: |
mbed_official | 490:119543c9f674 | 266 | * @arg TIM2_ETR_GPIO: TIM2 ETR connected to GPIO (default): |
mbed_official | 490:119543c9f674 | 267 | * GPIOA(0)_AF5 or GPIOA(5)_AF2 or |
mbed_official | 490:119543c9f674 | 268 | * GPIOA(15)_AF2 or GPIOE(9)_AF2 |
mbed_official | 490:119543c9f674 | 269 | * @arg TIM2_ETR_HSI48: TIM2 ETR connected to HSI48 |
mbed_official | 490:119543c9f674 | 270 | * @arg TIM2_ETR_LSE: TIM2 ETR connected to LSE |
mbed_official | 490:119543c9f674 | 271 | * @arg TIM2_ETR_COMP2_OUT: TIM2 ETR connected to COMP2 output |
mbed_official | 490:119543c9f674 | 272 | * @arg TIM2_ETR_COMP1_OUT: TIM2 ETR connected to COMP1 output |
mbed_official | 490:119543c9f674 | 273 | * @arg TIM2_TI4_GPIO: TIM2 TI4 connected to GPIO1(default): |
mbed_official | 490:119543c9f674 | 274 | * GPIOA(3)_AF2 or GPIOB(11)_AF2 or |
mbed_official | 490:119543c9f674 | 275 | * GPIOE(12)_AF0 |
mbed_official | 490:119543c9f674 | 276 | * @arg TIM2_TI4_COMP1: TIM2 TI4 connected to COMP1 |
mbed_official | 490:119543c9f674 | 277 | * @arg TIM2_TI4_COMP2: TIM2 TI4 connected to COMP2 |
mbed_official | 490:119543c9f674 | 278 | * @arg TIM2_TI4_GPIO2: TIM2 TI4 connected to GPIO2 : |
mbed_official | 490:119543c9f674 | 279 | * GPIOA(3)_AF2 or GPIOB(11)_AF2 or |
mbed_official | 490:119543c9f674 | 280 | * GPIOE(12)_AF0 |
mbed_official | 490:119543c9f674 | 281 | * |
mbed_official | 490:119543c9f674 | 282 | * For TIM21, the parameter can have the following values: |
mbed_official | 490:119543c9f674 | 283 | * @arg TIM21_ETR_GPIO: TIM21 ETR connected to GPIO(default) : |
mbed_official | 490:119543c9f674 | 284 | * APB2_PC(9)_AF0 or APB2_PA(1)_AF5 |
mbed_official | 490:119543c9f674 | 285 | * @arg TIM21_ETR_COMP2_OUT:TIM21 ETR connected to COMP2 output |
mbed_official | 490:119543c9f674 | 286 | * @arg TIM21_ETR_COMP1_OUT:TIM21 ETR connected to COMP1 output |
mbed_official | 490:119543c9f674 | 287 | * @arg TIM21_ETR_LSE: TIM21 ETR connected to LSE |
mbed_official | 490:119543c9f674 | 288 | * @arg TIM21_TI1_MCO: TIM21 TI1 connected to MCO |
mbed_official | 490:119543c9f674 | 289 | * @arg TIM21_TI1_RTC_WKUT_IT: TIM21 TI1 connected to RTC WAKEUP interrupt |
mbed_official | 490:119543c9f674 | 290 | * @arg TIM21_TI1_HSE_RTC: TIM21 TI1 connected to HSE_RTC |
mbed_official | 490:119543c9f674 | 291 | * @arg TIM21_TI1_MSI: TIM21 TI1 connected to MSI clock |
mbed_official | 490:119543c9f674 | 292 | * @arg TIM21_TI1_LSE: TIM21 TI1 connected to LSE |
mbed_official | 490:119543c9f674 | 293 | * @arg TIM21_TI1_LSI: TIM21 TI1 connected to LSI |
mbed_official | 490:119543c9f674 | 294 | * @arg TIM21_TI1_COMP1_OUT:TIM21 TI1 connected to COMP1_OUT |
mbed_official | 490:119543c9f674 | 295 | * @arg TIM21_TI1_GPIO: TIM21 TI1 connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 296 | * GPIOA(2)_AF0 or GPIOB(13)_AF6 or |
mbed_official | 490:119543c9f674 | 297 | * GPIOE(5)_AF0 or GPIOD(0)_AF0 |
mbed_official | 490:119543c9f674 | 298 | * @arg TIM21_TI2_GPIO: TIM21 TI2 connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 299 | * GPIOA(3)_AF0 or GPIOB(14)_AF6 or |
mbed_official | 490:119543c9f674 | 300 | * GPIOE(6)_AF0 or GPIOD(7)_AF1 |
mbed_official | 490:119543c9f674 | 301 | * @arg TIM21_TI2_COMP2_OUT:TIM21 TI2 connected to COMP2 output |
mbed_official | 490:119543c9f674 | 302 | * |
mbed_official | 490:119543c9f674 | 303 | * For TIM22, the parameter can have the following values: |
mbed_official | 490:119543c9f674 | 304 | * @arg TIM22_ETR_LSE: TIM22 ETR connected to LSE |
mbed_official | 490:119543c9f674 | 305 | * @arg TIM22_ETR_COMP2_OUT:TIM22 ETR connected to COMP2 output |
mbed_official | 490:119543c9f674 | 306 | * @arg TIM22_ETR_COMP1_OUT:TIM22 ETR connected to COMP1 output |
mbed_official | 490:119543c9f674 | 307 | * @arg TIM22_ETR_GPIO: TIM22 ETR connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 308 | * GPIOC(8)_AF0 or GPIOA(4)_AF5 |
mbed_official | 490:119543c9f674 | 309 | * @arg TIM22_TI1_GPIO1: TIM22 TI1 connected to GPIO(default): |
mbed_official | 490:119543c9f674 | 310 | * GPIOC(6)_AF0 or GPIOA(6)_AF5 or |
mbed_official | 490:119543c9f674 | 311 | * GPIOB(4)_AF4 or GPIOE(0)_AF3 |
mbed_official | 490:119543c9f674 | 312 | * @arg TIM22_TI1_COMP2_OUT:TIM22 TI1 connected to COMP2 output |
mbed_official | 490:119543c9f674 | 313 | * @arg TIM22_TI1_COMP1_OUT:TIM22 TI1 connected to COMP1 output |
mbed_official | 490:119543c9f674 | 314 | * @arg TIM22_TI1_GPIO2: TIM22 TI1 connected to GPIO: |
mbed_official | 490:119543c9f674 | 315 | * GPIOC(6)_AF0 or GPIOA(6)_AF5 or |
mbed_official | 490:119543c9f674 | 316 | * GPIOB(4)_AF4 or GPIOE(3)_AF0 |
mbed_official | 490:119543c9f674 | 317 | * |
mbed_official | 490:119543c9f674 | 318 | * @retval HAL status |
mbed_official | 490:119543c9f674 | 319 | */ |
mbed_official | 490:119543c9f674 | 320 | |
mbed_official | 490:119543c9f674 | 321 | #endif /* STM32L07xxx or STM32L08xxx */ |
mbed_official | 490:119543c9f674 | 322 | |
mbed_official | 376:cb4d9db17537 | 323 | HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap) |
mbed_official | 376:cb4d9db17537 | 324 | { |
mbed_official | 490:119543c9f674 | 325 | |
mbed_official | 490:119543c9f674 | 326 | __HAL_LOCK(htim); |
mbed_official | 490:119543c9f674 | 327 | |
mbed_official | 376:cb4d9db17537 | 328 | /* Check parameters */ |
mbed_official | 490:119543c9f674 | 329 | assert_param(IS_TIM_REMAP(htim->Instance,Remap)); |
mbed_official | 490:119543c9f674 | 330 | |
mbed_official | 376:cb4d9db17537 | 331 | /* Set the Timer remapping configuration */ |
mbed_official | 490:119543c9f674 | 332 | htim->Instance->OR = Remap; |
mbed_official | 490:119543c9f674 | 333 | |
mbed_official | 376:cb4d9db17537 | 334 | htim->State = HAL_TIM_STATE_READY; |
mbed_official | 490:119543c9f674 | 335 | |
mbed_official | 490:119543c9f674 | 336 | __HAL_UNLOCK(htim); |
mbed_official | 490:119543c9f674 | 337 | |
mbed_official | 376:cb4d9db17537 | 338 | return HAL_OK; |
mbed_official | 376:cb4d9db17537 | 339 | } |
mbed_official | 376:cb4d9db17537 | 340 | |
mbed_official | 376:cb4d9db17537 | 341 | /** |
mbed_official | 376:cb4d9db17537 | 342 | * @} |
mbed_official | 376:cb4d9db17537 | 343 | */ |
mbed_official | 376:cb4d9db17537 | 344 | |
mbed_official | 376:cb4d9db17537 | 345 | /** |
mbed_official | 376:cb4d9db17537 | 346 | * @} |
mbed_official | 376:cb4d9db17537 | 347 | */ |
mbed_official | 376:cb4d9db17537 | 348 | |
mbed_official | 376:cb4d9db17537 | 349 | #endif /* HAL_TIM_MODULE_ENABLED */ |
mbed_official | 376:cb4d9db17537 | 350 | /** |
mbed_official | 376:cb4d9db17537 | 351 | * @} |
mbed_official | 376:cb4d9db17537 | 352 | */ |
mbed_official | 376:cb4d9db17537 | 353 | |
mbed_official | 376:cb4d9db17537 | 354 | /** |
mbed_official | 376:cb4d9db17537 | 355 | * @} |
mbed_official | 376:cb4d9db17537 | 356 | */ |
mbed_official | 376:cb4d9db17537 | 357 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |