mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Aug 14 13:15:17 2015 +0100
Revision:
610:813dcc80987e
Synchronized with git revision 6d84db41c6833e0b9b024741eb0616a5f62d5599

Full URL: https://github.com/mbedmicro/mbed/commit/6d84db41c6833e0b9b024741eb0616a5f62d5599/

DISCO_F746NG - Improvements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 610:813dcc80987e 1 /**
mbed_official 610:813dcc80987e 2 ******************************************************************************
mbed_official 610:813dcc80987e 3 * @file stm32l4xx_hal_i2c_ex.c
mbed_official 610:813dcc80987e 4 * @author MCD Application Team
mbed_official 610:813dcc80987e 5 * @version V1.0.0
mbed_official 610:813dcc80987e 6 * @date 26-June-2015
mbed_official 610:813dcc80987e 7 * @brief I2C Extended HAL module driver.
mbed_official 610:813dcc80987e 8 * This file provides firmware functions to manage the following
mbed_official 610:813dcc80987e 9 * functionalities of I2C Extended peripheral:
mbed_official 610:813dcc80987e 10 * + Extended features functions
mbed_official 610:813dcc80987e 11 *
mbed_official 610:813dcc80987e 12 @verbatim
mbed_official 610:813dcc80987e 13 ==============================================================================
mbed_official 610:813dcc80987e 14 ##### I2C peripheral Extended features #####
mbed_official 610:813dcc80987e 15 ==============================================================================
mbed_official 610:813dcc80987e 16
mbed_official 610:813dcc80987e 17 [..] Comparing to other previous devices, the I2C interface for STM32L4xx
mbed_official 610:813dcc80987e 18 devices contains the following additional features
mbed_official 610:813dcc80987e 19
mbed_official 610:813dcc80987e 20 (+) Possibility to disable or enable Analog Noise Filter
mbed_official 610:813dcc80987e 21 (+) Use of a configured Digital Noise Filter
mbed_official 610:813dcc80987e 22 (+) Disable or enable wakeup from Stop modes
mbed_official 610:813dcc80987e 23
mbed_official 610:813dcc80987e 24 ##### How to use this driver #####
mbed_official 610:813dcc80987e 25 ==============================================================================
mbed_official 610:813dcc80987e 26 [..] This driver provides functions to configure Noise Filter
mbed_official 610:813dcc80987e 27 (#) Configure I2C Analog noise filter using the function HAL_I2CEx_ConfigAnalogFilter()
mbed_official 610:813dcc80987e 28 (#) Configure I2C Digital noise filter using the function HAL_I2CEx_ConfigDigitalFilter()
mbed_official 610:813dcc80987e 29 (#) Configure the enable or disable of I2C Wake Up Mode using the functions :
mbed_official 610:813dcc80987e 30 (++) HAL_I2CEx_EnableWakeUp()
mbed_official 610:813dcc80987e 31 (++) HAL_I2CEx_DisableWakeUp()
mbed_official 610:813dcc80987e 32 (#) Configure the enable or disable of fast mode plus driving capability using the functions :
mbed_official 610:813dcc80987e 33 (++) HAL_I2CEx_EnableFastModePlus()
mbed_official 610:813dcc80987e 34 (++) HAL_I2CEx_DisbleFastModePlus()
mbed_official 610:813dcc80987e 35 @endverbatim
mbed_official 610:813dcc80987e 36 ******************************************************************************
mbed_official 610:813dcc80987e 37 * @attention
mbed_official 610:813dcc80987e 38 *
mbed_official 610:813dcc80987e 39 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 610:813dcc80987e 40 *
mbed_official 610:813dcc80987e 41 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 610:813dcc80987e 42 * are permitted provided that the following conditions are met:
mbed_official 610:813dcc80987e 43 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 610:813dcc80987e 44 * this list of conditions and the following disclaimer.
mbed_official 610:813dcc80987e 45 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 610:813dcc80987e 46 * this list of conditions and the following disclaimer in the documentation
mbed_official 610:813dcc80987e 47 * and/or other materials provided with the distribution.
mbed_official 610:813dcc80987e 48 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 610:813dcc80987e 49 * may be used to endorse or promote products derived from this software
mbed_official 610:813dcc80987e 50 * without specific prior written permission.
mbed_official 610:813dcc80987e 51 *
mbed_official 610:813dcc80987e 52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 610:813dcc80987e 53 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 610:813dcc80987e 54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 610:813dcc80987e 55 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 610:813dcc80987e 56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 610:813dcc80987e 57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 610:813dcc80987e 58 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 610:813dcc80987e 59 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 610:813dcc80987e 60 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 610:813dcc80987e 61 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 610:813dcc80987e 62 *
mbed_official 610:813dcc80987e 63 ******************************************************************************
mbed_official 610:813dcc80987e 64 */
mbed_official 610:813dcc80987e 65
mbed_official 610:813dcc80987e 66 /* Includes ------------------------------------------------------------------*/
mbed_official 610:813dcc80987e 67 #include "stm32l4xx_hal.h"
mbed_official 610:813dcc80987e 68
mbed_official 610:813dcc80987e 69 /** @addtogroup STM32L4xx_HAL_Driver
mbed_official 610:813dcc80987e 70 * @{
mbed_official 610:813dcc80987e 71 */
mbed_official 610:813dcc80987e 72
mbed_official 610:813dcc80987e 73 /** @defgroup I2CEx I2CEx
mbed_official 610:813dcc80987e 74 * @brief I2C Extended HAL module driver
mbed_official 610:813dcc80987e 75 * @{
mbed_official 610:813dcc80987e 76 */
mbed_official 610:813dcc80987e 77
mbed_official 610:813dcc80987e 78 #ifdef HAL_I2C_MODULE_ENABLED
mbed_official 610:813dcc80987e 79
mbed_official 610:813dcc80987e 80 /* Private typedef -----------------------------------------------------------*/
mbed_official 610:813dcc80987e 81 /* Private define ------------------------------------------------------------*/
mbed_official 610:813dcc80987e 82 /* Private macro -------------------------------------------------------------*/
mbed_official 610:813dcc80987e 83 /* Private variables ---------------------------------------------------------*/
mbed_official 610:813dcc80987e 84 /* Private function prototypes -----------------------------------------------*/
mbed_official 610:813dcc80987e 85 /* Private functions ---------------------------------------------------------*/
mbed_official 610:813dcc80987e 86
mbed_official 610:813dcc80987e 87 /** @defgroup I2CEx_Exported_Functions I2C Extended Exported Functions
mbed_official 610:813dcc80987e 88 * @{
mbed_official 610:813dcc80987e 89 */
mbed_official 610:813dcc80987e 90
mbed_official 610:813dcc80987e 91 /** @defgroup I2CEx_Exported_Functions_Group1 Extended features functions
mbed_official 610:813dcc80987e 92 * @brief Extended features functions
mbed_official 610:813dcc80987e 93 *
mbed_official 610:813dcc80987e 94 @verbatim
mbed_official 610:813dcc80987e 95 ===============================================================================
mbed_official 610:813dcc80987e 96 ##### Extended features functions #####
mbed_official 610:813dcc80987e 97 ===============================================================================
mbed_official 610:813dcc80987e 98 [..] This section provides functions allowing to:
mbed_official 610:813dcc80987e 99 (+) Configure Noise Filters
mbed_official 610:813dcc80987e 100
mbed_official 610:813dcc80987e 101 @endverbatim
mbed_official 610:813dcc80987e 102 * @{
mbed_official 610:813dcc80987e 103 */
mbed_official 610:813dcc80987e 104
mbed_official 610:813dcc80987e 105 /**
mbed_official 610:813dcc80987e 106 * @brief Configures I2C Analog noise filter.
mbed_official 610:813dcc80987e 107 * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 108 * the configuration information for the specified I2Cx peripheral.
mbed_official 610:813dcc80987e 109 * @param AnalogFilter : new state of the Analog filter.
mbed_official 610:813dcc80987e 110 * @retval HAL status
mbed_official 610:813dcc80987e 111 */
mbed_official 610:813dcc80987e 112 HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter)
mbed_official 610:813dcc80987e 113 {
mbed_official 610:813dcc80987e 114 /* Check the parameters */
mbed_official 610:813dcc80987e 115 assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
mbed_official 610:813dcc80987e 116 assert_param(IS_I2C_ANALOG_FILTER(AnalogFilter));
mbed_official 610:813dcc80987e 117
mbed_official 610:813dcc80987e 118 if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX)
mbed_official 610:813dcc80987e 119 || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
mbed_official 610:813dcc80987e 120 {
mbed_official 610:813dcc80987e 121 return HAL_BUSY;
mbed_official 610:813dcc80987e 122 }
mbed_official 610:813dcc80987e 123
mbed_official 610:813dcc80987e 124 /* Process Locked */
mbed_official 610:813dcc80987e 125 __HAL_LOCK(hi2c);
mbed_official 610:813dcc80987e 126
mbed_official 610:813dcc80987e 127 hi2c->State = HAL_I2C_STATE_BUSY;
mbed_official 610:813dcc80987e 128
mbed_official 610:813dcc80987e 129 /* Disable the selected I2C peripheral */
mbed_official 610:813dcc80987e 130 __HAL_I2C_DISABLE(hi2c);
mbed_official 610:813dcc80987e 131
mbed_official 610:813dcc80987e 132 /* Reset I2Cx ANOFF bit */
mbed_official 610:813dcc80987e 133 hi2c->Instance->CR1 &= ~(I2C_CR1_ANFOFF);
mbed_official 610:813dcc80987e 134
mbed_official 610:813dcc80987e 135 /* Set analog filter bit*/
mbed_official 610:813dcc80987e 136 hi2c->Instance->CR1 |= AnalogFilter;
mbed_official 610:813dcc80987e 137
mbed_official 610:813dcc80987e 138 __HAL_I2C_ENABLE(hi2c);
mbed_official 610:813dcc80987e 139
mbed_official 610:813dcc80987e 140 hi2c->State = HAL_I2C_STATE_READY;
mbed_official 610:813dcc80987e 141
mbed_official 610:813dcc80987e 142 /* Process Unlocked */
mbed_official 610:813dcc80987e 143 __HAL_UNLOCK(hi2c);
mbed_official 610:813dcc80987e 144
mbed_official 610:813dcc80987e 145 return HAL_OK;
mbed_official 610:813dcc80987e 146 }
mbed_official 610:813dcc80987e 147
mbed_official 610:813dcc80987e 148 /**
mbed_official 610:813dcc80987e 149 * @brief Configures I2C Digital noise filter.
mbed_official 610:813dcc80987e 150 * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 151 * the configuration information for the specified I2Cx peripheral.
mbed_official 610:813dcc80987e 152 * @param DigitalFilter : Coefficient of digital noise filter between 0x00 and 0x0F.
mbed_official 610:813dcc80987e 153 * @retval HAL status
mbed_official 610:813dcc80987e 154 */
mbed_official 610:813dcc80987e 155 HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter)
mbed_official 610:813dcc80987e 156 {
mbed_official 610:813dcc80987e 157 uint32_t tmpreg = 0;
mbed_official 610:813dcc80987e 158
mbed_official 610:813dcc80987e 159 /* Check the parameters */
mbed_official 610:813dcc80987e 160 assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
mbed_official 610:813dcc80987e 161 assert_param(IS_I2C_DIGITAL_FILTER(DigitalFilter));
mbed_official 610:813dcc80987e 162
mbed_official 610:813dcc80987e 163 if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX)
mbed_official 610:813dcc80987e 164 || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
mbed_official 610:813dcc80987e 165 {
mbed_official 610:813dcc80987e 166 return HAL_BUSY;
mbed_official 610:813dcc80987e 167 }
mbed_official 610:813dcc80987e 168
mbed_official 610:813dcc80987e 169 /* Process Locked */
mbed_official 610:813dcc80987e 170 __HAL_LOCK(hi2c);
mbed_official 610:813dcc80987e 171
mbed_official 610:813dcc80987e 172 hi2c->State = HAL_I2C_STATE_BUSY;
mbed_official 610:813dcc80987e 173
mbed_official 610:813dcc80987e 174 /* Disable the selected I2C peripheral */
mbed_official 610:813dcc80987e 175 __HAL_I2C_DISABLE(hi2c);
mbed_official 610:813dcc80987e 176
mbed_official 610:813dcc80987e 177 /* Get the old register value */
mbed_official 610:813dcc80987e 178 tmpreg = hi2c->Instance->CR1;
mbed_official 610:813dcc80987e 179
mbed_official 610:813dcc80987e 180 /* Reset I2Cx DNF bits [11:8] */
mbed_official 610:813dcc80987e 181 tmpreg &= ~(I2C_CR1_DFN);
mbed_official 610:813dcc80987e 182
mbed_official 610:813dcc80987e 183 /* Set I2Cx DNF coefficient */
mbed_official 610:813dcc80987e 184 tmpreg |= DigitalFilter << 8;
mbed_official 610:813dcc80987e 185
mbed_official 610:813dcc80987e 186 /* Store the new register value */
mbed_official 610:813dcc80987e 187 hi2c->Instance->CR1 = tmpreg;
mbed_official 610:813dcc80987e 188
mbed_official 610:813dcc80987e 189 __HAL_I2C_ENABLE(hi2c);
mbed_official 610:813dcc80987e 190
mbed_official 610:813dcc80987e 191 hi2c->State = HAL_I2C_STATE_READY;
mbed_official 610:813dcc80987e 192
mbed_official 610:813dcc80987e 193 /* Process Unlocked */
mbed_official 610:813dcc80987e 194 __HAL_UNLOCK(hi2c);
mbed_official 610:813dcc80987e 195
mbed_official 610:813dcc80987e 196 return HAL_OK;
mbed_official 610:813dcc80987e 197 }
mbed_official 610:813dcc80987e 198
mbed_official 610:813dcc80987e 199 /**
mbed_official 610:813dcc80987e 200 * @brief Enables I2C wakeup from stop mode.
mbed_official 610:813dcc80987e 201 * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 202 * the configuration information for the specified I2Cx peripheral.
mbed_official 610:813dcc80987e 203 * @retval HAL status
mbed_official 610:813dcc80987e 204 */
mbed_official 610:813dcc80987e 205 HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp (I2C_HandleTypeDef *hi2c)
mbed_official 610:813dcc80987e 206 {
mbed_official 610:813dcc80987e 207 /* Check the parameters */
mbed_official 610:813dcc80987e 208 assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
mbed_official 610:813dcc80987e 209
mbed_official 610:813dcc80987e 210 if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX)
mbed_official 610:813dcc80987e 211 || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
mbed_official 610:813dcc80987e 212 {
mbed_official 610:813dcc80987e 213 return HAL_BUSY;
mbed_official 610:813dcc80987e 214 }
mbed_official 610:813dcc80987e 215
mbed_official 610:813dcc80987e 216 /* Process Locked */
mbed_official 610:813dcc80987e 217 __HAL_LOCK(hi2c);
mbed_official 610:813dcc80987e 218
mbed_official 610:813dcc80987e 219 hi2c->State = HAL_I2C_STATE_BUSY;
mbed_official 610:813dcc80987e 220
mbed_official 610:813dcc80987e 221 /* Disable the selected I2C peripheral */
mbed_official 610:813dcc80987e 222 __HAL_I2C_DISABLE(hi2c);
mbed_official 610:813dcc80987e 223
mbed_official 610:813dcc80987e 224 /* Enable wakeup from stop mode */
mbed_official 610:813dcc80987e 225 hi2c->Instance->CR1 |= I2C_CR1_WUPEN;
mbed_official 610:813dcc80987e 226
mbed_official 610:813dcc80987e 227 __HAL_I2C_ENABLE(hi2c);
mbed_official 610:813dcc80987e 228
mbed_official 610:813dcc80987e 229 hi2c->State = HAL_I2C_STATE_READY;
mbed_official 610:813dcc80987e 230
mbed_official 610:813dcc80987e 231 /* Process Unlocked */
mbed_official 610:813dcc80987e 232 __HAL_UNLOCK(hi2c);
mbed_official 610:813dcc80987e 233
mbed_official 610:813dcc80987e 234 return HAL_OK;
mbed_official 610:813dcc80987e 235 }
mbed_official 610:813dcc80987e 236
mbed_official 610:813dcc80987e 237
mbed_official 610:813dcc80987e 238 /**
mbed_official 610:813dcc80987e 239 * @brief Disables I2C wakeup from stop mode.
mbed_official 610:813dcc80987e 240 * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 241 * the configuration information for the specified I2Cx peripheral.
mbed_official 610:813dcc80987e 242 * @retval HAL status
mbed_official 610:813dcc80987e 243 */
mbed_official 610:813dcc80987e 244 HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp (I2C_HandleTypeDef *hi2c)
mbed_official 610:813dcc80987e 245 {
mbed_official 610:813dcc80987e 246 /* Check the parameters */
mbed_official 610:813dcc80987e 247 assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
mbed_official 610:813dcc80987e 248
mbed_official 610:813dcc80987e 249 if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX)
mbed_official 610:813dcc80987e 250 || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
mbed_official 610:813dcc80987e 251 {
mbed_official 610:813dcc80987e 252 return HAL_BUSY;
mbed_official 610:813dcc80987e 253 }
mbed_official 610:813dcc80987e 254
mbed_official 610:813dcc80987e 255 /* Process Locked */
mbed_official 610:813dcc80987e 256 __HAL_LOCK(hi2c);
mbed_official 610:813dcc80987e 257
mbed_official 610:813dcc80987e 258 hi2c->State = HAL_I2C_STATE_BUSY;
mbed_official 610:813dcc80987e 259
mbed_official 610:813dcc80987e 260 /* Disable the selected I2C peripheral */
mbed_official 610:813dcc80987e 261 __HAL_I2C_DISABLE(hi2c);
mbed_official 610:813dcc80987e 262
mbed_official 610:813dcc80987e 263 /* Enable wakeup from stop mode */
mbed_official 610:813dcc80987e 264 hi2c->Instance->CR1 &= ~(I2C_CR1_WUPEN);
mbed_official 610:813dcc80987e 265
mbed_official 610:813dcc80987e 266 __HAL_I2C_ENABLE(hi2c);
mbed_official 610:813dcc80987e 267
mbed_official 610:813dcc80987e 268 hi2c->State = HAL_I2C_STATE_READY;
mbed_official 610:813dcc80987e 269
mbed_official 610:813dcc80987e 270 /* Process Unlocked */
mbed_official 610:813dcc80987e 271 __HAL_UNLOCK(hi2c);
mbed_official 610:813dcc80987e 272
mbed_official 610:813dcc80987e 273 return HAL_OK;
mbed_official 610:813dcc80987e 274 }
mbed_official 610:813dcc80987e 275
mbed_official 610:813dcc80987e 276 /**
mbed_official 610:813dcc80987e 277 * @brief Enable the I2C fast mode plus driving capability.
mbed_official 610:813dcc80987e 278 * @param ConfigFastModePlus: selects the pin.
mbed_official 610:813dcc80987e 279 * This parameter can be one of the @ref I2CEx_FastModePlus values
mbed_official 610:813dcc80987e 280 * @note For I2C1, fast mode plus driving capability can be enabled on all selected
mbed_official 610:813dcc80987e 281 * I2C1 pins using I2C_FASTMODEPLUS_I2C1 parameter or independently
mbed_official 610:813dcc80987e 282 * on each one of the following pins PB6, PB7, PB8 and PB9.
mbed_official 610:813dcc80987e 283 * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability
mbed_official 610:813dcc80987e 284 * can be enabled only by using I2C_FASTMODEPLUS_I2C1 parameter.
mbed_official 610:813dcc80987e 285 * @note For all I2C2 pins fast mode plus driving capability can be enabled
mbed_official 610:813dcc80987e 286 * only by using I2C_FASTMODEPLUS_I2C2 parameter.
mbed_official 610:813dcc80987e 287 * @note For all I2C3 pins fast mode plus driving capability can be enabled
mbed_official 610:813dcc80987e 288 * only by using I2C_FASTMODEPLUS_I2C3 parameter.
mbed_official 610:813dcc80987e 289 * @retval None
mbed_official 610:813dcc80987e 290 */
mbed_official 610:813dcc80987e 291 void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
mbed_official 610:813dcc80987e 292 {
mbed_official 610:813dcc80987e 293 /* Check the parameter */
mbed_official 610:813dcc80987e 294 assert_param(IS_I2C_FASTMODEPLUS(ConfigFastModePlus));
mbed_official 610:813dcc80987e 295
mbed_official 610:813dcc80987e 296 /* Enable SYSCFG clock */
mbed_official 610:813dcc80987e 297 __HAL_RCC_SYSCFG_CLK_ENABLE();
mbed_official 610:813dcc80987e 298
mbed_official 610:813dcc80987e 299 /* Enable fast mode plus driving capability for selected pin */
mbed_official 610:813dcc80987e 300 SET_BIT(SYSCFG->CFGR1, (uint32_t)ConfigFastModePlus);
mbed_official 610:813dcc80987e 301 }
mbed_official 610:813dcc80987e 302
mbed_official 610:813dcc80987e 303 /**
mbed_official 610:813dcc80987e 304 * @brief Disable the I2C fast mode plus driving capability.
mbed_official 610:813dcc80987e 305 * @param ConfigFastModePlus: selects the pin.
mbed_official 610:813dcc80987e 306 * This parameter can be one of the @ref I2CEx_FastModePlus values
mbed_official 610:813dcc80987e 307 * @note For I2C1, fast mode plus driving capability can be disabled on all selected
mbed_official 610:813dcc80987e 308 * I2C1 pins using I2C_FASTMODEPLUS_I2C1 parameter or independently
mbed_official 610:813dcc80987e 309 * on each one of the following pins PB6, PB7, PB8 and PB9.
mbed_official 610:813dcc80987e 310 * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability
mbed_official 610:813dcc80987e 311 * can be disabled only by using I2C_FASTMODEPLUS_I2C1 parameter.
mbed_official 610:813dcc80987e 312 * @note For all I2C2 pins fast mode plus driving capability can be disabled
mbed_official 610:813dcc80987e 313 * only by using I2C_FASTMODEPLUS_I2C2 parameter.
mbed_official 610:813dcc80987e 314 * @note For all I2C3 pins fast mode plus driving capability can be disabled
mbed_official 610:813dcc80987e 315 * only by using I2C_FASTMODEPLUS_I2C3 parameter.
mbed_official 610:813dcc80987e 316 * @retval None
mbed_official 610:813dcc80987e 317 */
mbed_official 610:813dcc80987e 318 void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
mbed_official 610:813dcc80987e 319 {
mbed_official 610:813dcc80987e 320 /* Check the parameter */
mbed_official 610:813dcc80987e 321 assert_param(IS_I2C_FASTMODEPLUS(ConfigFastModePlus));
mbed_official 610:813dcc80987e 322
mbed_official 610:813dcc80987e 323 /* Enable SYSCFG clock */
mbed_official 610:813dcc80987e 324 __HAL_RCC_SYSCFG_CLK_ENABLE();
mbed_official 610:813dcc80987e 325
mbed_official 610:813dcc80987e 326 /* Disable fast mode plus driving capability for selected pin */
mbed_official 610:813dcc80987e 327 CLEAR_BIT(SYSCFG->CFGR1, (uint32_t)ConfigFastModePlus);
mbed_official 610:813dcc80987e 328 }
mbed_official 610:813dcc80987e 329
mbed_official 610:813dcc80987e 330 /**
mbed_official 610:813dcc80987e 331 * @}
mbed_official 610:813dcc80987e 332 */
mbed_official 610:813dcc80987e 333
mbed_official 610:813dcc80987e 334 /**
mbed_official 610:813dcc80987e 335 * @}
mbed_official 610:813dcc80987e 336 */
mbed_official 610:813dcc80987e 337
mbed_official 610:813dcc80987e 338 #endif /* HAL_I2C_MODULE_ENABLED */
mbed_official 610:813dcc80987e 339 /**
mbed_official 610:813dcc80987e 340 * @}
mbed_official 610:813dcc80987e 341 */
mbed_official 610:813dcc80987e 342
mbed_official 610:813dcc80987e 343 /**
mbed_official 610:813dcc80987e 344 * @}
mbed_official 610:813dcc80987e 345 */
mbed_official 610:813dcc80987e 346
mbed_official 610:813dcc80987e 347 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/