mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
184:08ed48f1de7f
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file stm32l1xx_hal_tim_ex.c
<> 149:156823d33999 4 * @author MCD Application Team
<> 149:156823d33999 5 * @version V1.2.0
<> 149:156823d33999 6 * @date 01-July-2016
<> 149:156823d33999 7 * @brief TIM HAL module driver.
<> 149:156823d33999 8 * This file provides firmware functions to manage the following
<> 149:156823d33999 9 * functionalities of the Timer extension peripheral:
<> 149:156823d33999 10 * + Time Master and Slave synchronization configuration
<> 149:156823d33999 11 * + Timer remapping capabilities configuration
<> 149:156823d33999 12 @verbatim
<> 149:156823d33999 13 ==============================================================================
<> 149:156823d33999 14 ##### TIMER Extended features #####
<> 149:156823d33999 15 ==============================================================================
<> 149:156823d33999 16 [..]
<> 149:156823d33999 17 The Timer Extension features include:
<> 149:156823d33999 18 (#) Synchronization circuit to control the timer with external signals and to
<> 149:156823d33999 19 interconnect several timers together.
<> 149:156823d33999 20 (#) Timer remapping capabilities configuration
<> 149:156823d33999 21
<> 149:156823d33999 22 @endverbatim
<> 149:156823d33999 23 ******************************************************************************
<> 149:156823d33999 24 * @attention
<> 149:156823d33999 25 *
<> 149:156823d33999 26 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 149:156823d33999 27 *
<> 149:156823d33999 28 * Redistribution and use in source and binary forms, with or without modification,
<> 149:156823d33999 29 * are permitted provided that the following conditions are met:
<> 149:156823d33999 30 * 1. Redistributions of source code must retain the above copyright notice,
<> 149:156823d33999 31 * this list of conditions and the following disclaimer.
<> 149:156823d33999 32 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 149:156823d33999 33 * this list of conditions and the following disclaimer in the documentation
<> 149:156823d33999 34 * and/or other materials provided with the distribution.
<> 149:156823d33999 35 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 149:156823d33999 36 * may be used to endorse or promote products derived from this software
<> 149:156823d33999 37 * without specific prior written permission.
<> 149:156823d33999 38 *
<> 149:156823d33999 39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 149:156823d33999 40 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 149:156823d33999 41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 149:156823d33999 42 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 149:156823d33999 43 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 149:156823d33999 44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 149:156823d33999 45 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 149:156823d33999 46 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 149:156823d33999 47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 149:156823d33999 48 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 149:156823d33999 49 *
<> 149:156823d33999 50 ******************************************************************************
<> 149:156823d33999 51 */
<> 149:156823d33999 52
<> 149:156823d33999 53 /* Includes ------------------------------------------------------------------*/
<> 149:156823d33999 54 #include "stm32l1xx_hal.h"
<> 149:156823d33999 55
<> 149:156823d33999 56 /** @addtogroup STM32L1xx_HAL_Driver
<> 149:156823d33999 57 * @{
<> 149:156823d33999 58 */
<> 149:156823d33999 59
<> 149:156823d33999 60 /** @defgroup TIMEx TIMEx
<> 149:156823d33999 61 * @brief TIM Extended HAL module driver
<> 149:156823d33999 62 * @{
<> 149:156823d33999 63 */
<> 149:156823d33999 64
<> 149:156823d33999 65 #ifdef HAL_TIM_MODULE_ENABLED
<> 149:156823d33999 66
<> 149:156823d33999 67 /* Private typedef -----------------------------------------------------------*/
<> 149:156823d33999 68 /* Private define ------------------------------------------------------------*/
<> 149:156823d33999 69 /* Private macro -------------------------------------------------------------*/
<> 149:156823d33999 70 /* Private variables ---------------------------------------------------------*/
<> 149:156823d33999 71 /* Private function prototypes -----------------------------------------------*/
<> 149:156823d33999 72 /* Private functions ---------------------------------------------------------*/
<> 149:156823d33999 73
<> 149:156823d33999 74 /* Exported functions ---------------------------------------------------------*/
<> 149:156823d33999 75
<> 149:156823d33999 76 /** @defgroup TIMEx_Exported_Functions TIMEx Exported Functions
<> 149:156823d33999 77 * @{
<> 149:156823d33999 78 */
<> 149:156823d33999 79
<> 149:156823d33999 80 /** @defgroup TIMEx_Exported_Functions_Group1 Peripheral Control functions
<> 149:156823d33999 81 * @brief Peripheral Control functions
<> 149:156823d33999 82 *
<> 149:156823d33999 83 @verbatim
<> 149:156823d33999 84 ==============================================================================
<> 149:156823d33999 85 ##### Peripheral Control functions #####
<> 149:156823d33999 86 ==============================================================================
<> 149:156823d33999 87 [..]
<> 149:156823d33999 88 This section provides functions allowing to:
<> 149:156823d33999 89 (+)Configure Master synchronization.
<> 149:156823d33999 90 (+) Configure timer remapping capabilities.
<> 149:156823d33999 91
<> 149:156823d33999 92 @endverbatim
<> 149:156823d33999 93 * @{
<> 149:156823d33999 94 */
<> 149:156823d33999 95
<> 149:156823d33999 96 /**
<> 149:156823d33999 97 * @brief Configures the TIM in master mode.
<> 149:156823d33999 98 * @param htim: TIM handle.
<> 149:156823d33999 99 * @param sMasterConfig: pointer to a TIM_MasterConfigTypeDef structure that
<> 149:156823d33999 100 * contains the selected trigger output (TRGO) and the Master/Slave
<> 149:156823d33999 101 * mode.
<> 149:156823d33999 102 * @retval HAL status
<> 149:156823d33999 103 */
<> 149:156823d33999 104 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef * sMasterConfig)
<> 149:156823d33999 105 {
<> 149:156823d33999 106 /* Check the parameters */
<> 149:156823d33999 107 assert_param(IS_TIM_MASTER_INSTANCE(htim->Instance));
<> 149:156823d33999 108 assert_param(IS_TIM_TRGO_SOURCE(sMasterConfig->MasterOutputTrigger));
<> 149:156823d33999 109 assert_param(IS_TIM_MSM_STATE(sMasterConfig->MasterSlaveMode));
<> 149:156823d33999 110
<> 149:156823d33999 111 __HAL_LOCK(htim);
<> 149:156823d33999 112
<> 149:156823d33999 113 htim->State = HAL_TIM_STATE_BUSY;
<> 149:156823d33999 114
<> 149:156823d33999 115 /* Reset the MMS Bits */
<> 149:156823d33999 116 htim->Instance->CR2 &= ~TIM_CR2_MMS;
<> 149:156823d33999 117 /* Select the TRGO source */
<> 149:156823d33999 118 htim->Instance->CR2 |= sMasterConfig->MasterOutputTrigger;
<> 149:156823d33999 119
<> 149:156823d33999 120 /* Reset the MSM Bit */
<> 149:156823d33999 121 htim->Instance->SMCR &= ~TIM_SMCR_MSM;
<> 149:156823d33999 122 /* Set or Reset the MSM Bit */
<> 149:156823d33999 123 htim->Instance->SMCR |= sMasterConfig->MasterSlaveMode;
<> 149:156823d33999 124
<> 149:156823d33999 125 htim->State = HAL_TIM_STATE_READY;
<> 149:156823d33999 126
<> 149:156823d33999 127 __HAL_UNLOCK(htim);
<> 149:156823d33999 128
<> 149:156823d33999 129 return HAL_OK;
<> 149:156823d33999 130 }
<> 149:156823d33999 131
<> 149:156823d33999 132 /**
<> 149:156823d33999 133 * @brief Configures the TIM2/TIM3/TIM9/TIM10/TIM11 Remapping input capabilities.
<> 149:156823d33999 134 * @param htim: TIM handle.
<> 149:156823d33999 135 * @param Remap: specifies the TIM remapping source.
<> 149:156823d33999 136 * This parameter is a combination of the following values depending on TIM instance.
<> 149:156823d33999 137 * @retval HAL status
<> 149:156823d33999 138 *
<> 149:156823d33999 139 * @note For TIM2, the parameter can have the following values:
<> 149:156823d33999 140 * @arg TIM_TIM2_ITR1_TIM10_OC: TIM2 ITR1 input is connected to TIM10 OC
<> 149:156823d33999 141 * @arg TIM_TIM2_ITR1_TIM5_TGO: TIM2 ITR1 input is connected to TIM5 TGO
<> 149:156823d33999 142 *
<> 149:156823d33999 143 * @note For TIM3, the parameter can have the following values:
<> 149:156823d33999 144 * @arg TIM_TIM3_ITR2_TIM11_OC: TIM3 ITR2 input is connected to TIM11 OC
<> 149:156823d33999 145 * @arg TIM_TIM3_ITR2_TIM5_TGO: TIM3 ITR2 input is connected to TIM5 TGO
<> 149:156823d33999 146 *
<> 149:156823d33999 147 * @note For TIM9, the parameter is a combination of 2 fields (field1 | field2):
<> 149:156823d33999 148 * @note For TIM9, the field1 can have the following values:
<> 149:156823d33999 149 * @arg TIM_TIM9_ITR1_TIM3_TGO: TIM9 ITR1 input is connected to TIM3 TGO
<> 149:156823d33999 150 * @arg TIM_TIM9_ITR1_TS: TIM9 ITR1 input is connected to touch sensing I/O
<> 149:156823d33999 151 * @note For TIM9, the field2 can have the following values:
<> 149:156823d33999 152 * @arg TIM_TIM9_GPIO: TIM9 Channel1 is connected to GPIO
<> 149:156823d33999 153 * @arg TIM_TIM9_LSE: TIM9 Channel1 is connected to LSE internal clock
<> 149:156823d33999 154 * @arg TIM_TIM9_GPIO1: TIM9 Channel1 is connected to GPIO
<> 149:156823d33999 155 * @arg TIM_TIM9_GPIO2: TIM9 Channel1 is connected to GPIO
<> 149:156823d33999 156 *
<> 149:156823d33999 157 * @note For TIM10, the parameter is a combination of 3 fields (field1 | field2 | field3):
<> 149:156823d33999 158 * @note For TIM10, the field1 can have the following values:
<> 149:156823d33999 159 * @arg TIM_TIM10_TI1RMP: TIM10 Channel 1 depends on TI1_RMP
<> 149:156823d33999 160 * @arg TIM_TIM10_RI: TIM10 Channel 1 is connected to RI
<> 149:156823d33999 161 * @note For TIM10, the field2 can have the following values:
<> 149:156823d33999 162 * @arg TIM_TIM10_ETR_LSE: TIM10 ETR input is connected to LSE clock
<> 149:156823d33999 163 * @arg TIM_TIM10_ETR_TIM9_TGO: TIM10 ETR input is connected to TIM9 TGO
<> 149:156823d33999 164 * @note For TIM10, the field3 can have the following values:
<> 149:156823d33999 165 * @arg TIM_TIM10_GPIO: TIM10 Channel1 is connected to GPIO
<> 149:156823d33999 166 * @arg TIM_TIM10_LSI: TIM10 Channel1 is connected to LSI internal clock
<> 149:156823d33999 167 * @arg TIM_TIM10_LSE: TIM10 Channel1 is connected to LSE internal clock
<> 149:156823d33999 168 * @arg TIM_TIM10_RTC: TIM10 Channel1 is connected to RTC wakeup interrupt
<> 149:156823d33999 169 *
<> 149:156823d33999 170 * @note For TIM11, the parameter is a combination of 3 fields (field1 | field2 | field3):
<> 149:156823d33999 171 * @note For TIM11, the field1 can have the following values:
<> 149:156823d33999 172 * @arg TIM_TIM11_TI1RMP: TIM11 Channel 1 depends on TI1_RMP
<> 149:156823d33999 173 * @arg TIM_TIM11_RI: TIM11 Channel 1 is connected to RI
<> 149:156823d33999 174 * @note For TIM11, the field2 can have the following values:
<> 149:156823d33999 175 * @arg TIM_TIM11_ETR_LSE: TIM11 ETR input is connected to LSE clock
<> 149:156823d33999 176 * @arg TIM_TIM11_ETR_TIM9_TGO: TIM11 ETR input is connected to TIM9 TGO
<> 149:156823d33999 177 * @note For TIM11, the field3 can have the following values:
<> 149:156823d33999 178 * @arg TIM_TIM11_GPIO: TIM11 Channel1 is connected to GPIO
<> 149:156823d33999 179 * @arg TIM_TIM11_MSI: TIM11 Channel1 is connected to MSI internal clock
<> 149:156823d33999 180 * @arg TIM_TIM11_HSE_RTC: TIM11 Channel1 is connected to HSE_RTC clock
<> 149:156823d33999 181 * @arg TIM_TIM11_GPIO1: TIM11 Channel1 is connected to GPIO
<> 149:156823d33999 182 *
<> 149:156823d33999 183 */
<> 149:156823d33999 184 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap)
<> 149:156823d33999 185 {
<> 149:156823d33999 186 __HAL_LOCK(htim);
<> 149:156823d33999 187
<> 149:156823d33999 188 /* Check parameters */
<> 149:156823d33999 189 assert_param(IS_TIM_REMAP_INSTANCE(htim->Instance));
<> 149:156823d33999 190 assert_param(IS_TIM_REMAP(htim->Instance,Remap));
<> 149:156823d33999 191
<> 149:156823d33999 192 /* Set the Timer remapping configuration */
<> 149:156823d33999 193 htim->Instance->OR = Remap;
<> 149:156823d33999 194
<> 149:156823d33999 195 htim->State = HAL_TIM_STATE_READY;
<> 149:156823d33999 196
<> 149:156823d33999 197 __HAL_UNLOCK(htim);
<> 149:156823d33999 198
<> 149:156823d33999 199 return HAL_OK;
<> 149:156823d33999 200 }
<> 149:156823d33999 201
<> 149:156823d33999 202 /**
<> 149:156823d33999 203 * @}
<> 149:156823d33999 204 */
<> 149:156823d33999 205
<> 149:156823d33999 206 #endif /* HAL_TIM_MODULE_ENABLED */
<> 149:156823d33999 207 /**
<> 149:156823d33999 208 * @}
<> 149:156823d33999 209 */
<> 149:156823d33999 210
<> 149:156823d33999 211 /**
<> 149:156823d33999 212 * @}
<> 149:156823d33999 213 */
<> 149:156823d33999 214
<> 149:156823d33999 215 /**
<> 149:156823d33999 216 * @}
<> 149:156823d33999 217 */
<> 149:156823d33999 218
<> 149:156823d33999 219 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/