1 /**
2   ******************************************************************************
3   * @file    stm32f4xx_hal_fmpsmbus_ex.c
4   * @author  MCD Application Team
5   * @brief   FMPSMBUS Extended HAL module driver.
6   *          This file provides firmware functions to manage the following
7   *          functionalities of FMPSMBUS Extended peripheral:
8   *           + Extended features functions
9   *
10   ******************************************************************************
11   * @attention
12   *
13   * Copyright (c) 2016 STMicroelectronics.
14   * All rights reserved.
15   *
16   * This software is licensed under terms that can be found in the LICENSE file
17   * in the root directory of this software component.
18   * If no LICENSE file comes with this software, it is provided AS-IS.
19   *
20   ******************************************************************************
21   @verbatim
22   ==============================================================================
23                ##### FMPSMBUS peripheral Extended features  #####
24   ==============================================================================
25 
26   [..] Comparing to other previous devices, the FMPSMBUS interface for STM32F4xx
27        devices contains the following additional features
28 
29        (+) Disable or enable Fast Mode Plus
30 
31                      ##### How to use this driver #####
32   ==============================================================================
33     (#) Configure the enable or disable of fast mode plus driving capability using the functions :
34           (++) HAL_FMPSMBUSEx_EnableFastModePlus()
35           (++) HAL_FMPSMBUSEx_DisableFastModePlus()
36   @endverbatim
37   */
38 
39 /* Includes ------------------------------------------------------------------*/
40 #include "stm32f4xx_hal.h"
41 
42 /** @addtogroup STM32F4xx_HAL_Driver
43   * @{
44   */
45 
46 /** @defgroup FMPSMBUSEx FMPSMBUSEx
47   * @brief FMPSMBUS Extended HAL module driver
48   * @{
49   */
50 
51 #ifdef HAL_FMPSMBUS_MODULE_ENABLED
52 #if defined(FMPI2C_CR1_PE)
53 
54 /* Private typedef -----------------------------------------------------------*/
55 /* Private define ------------------------------------------------------------*/
56 /* Private macro -------------------------------------------------------------*/
57 /* Private variables ---------------------------------------------------------*/
58 /* Private function prototypes -----------------------------------------------*/
59 /* Private functions ---------------------------------------------------------*/
60 
61 /** @defgroup FMPSMBUSEx_Exported_Functions FMPSMBUS Extended Exported Functions
62   * @{
63   */
64 
65 /** @defgroup FMPSMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions
66   * @brief    Fast Mode Plus Functions
67   *
68 @verbatim
69  ===============================================================================
70                       ##### Fast Mode Plus Functions #####
71  ===============================================================================
72     [..] This section provides functions allowing to:
73       (+) Configure Fast Mode Plus
74 
75 @endverbatim
76   * @{
77   */
78 
79 /**
80   * @brief Enable the FMPSMBUS fast mode plus driving capability.
81   * @param ConfigFastModePlus Selects the pin.
82   *   This parameter can be one of the @ref FMPSMBUSEx_FastModePlus values
83   * @note  For FMPI2C1, fast mode plus driving capability can be enabled on all selected
84   *        FMPI2C1 pins using FMPSMBUS_FASTMODEPLUS_FMPI2C1 parameter or independently
85   *        on each one of the following pins PB6, PB7, PB8 and PB9.
86   * @note  For remaining FMPI2C1 pins (PA14, PA15...) fast mode plus driving capability
87   *        can be enabled only by using FMPSMBUS_FASTMODEPLUS_FMPI2C1 parameter.
88   * @retval None
89   */
HAL_FMPSMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus)90 void HAL_FMPSMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
91 {
92   /* Check the parameter */
93   assert_param(IS_FMPSMBUS_FASTMODEPLUS(ConfigFastModePlus));
94 
95   /* Enable SYSCFG clock */
96   __HAL_RCC_SYSCFG_CLK_ENABLE();
97 
98   /* Enable fast mode plus driving capability for selected pin */
99   SET_BIT(SYSCFG->CFGR, (uint32_t)ConfigFastModePlus);
100 }
101 
102 /**
103   * @brief Disable the FMPSMBUS fast mode plus driving capability.
104   * @param ConfigFastModePlus Selects the pin.
105   *   This parameter can be one of the @ref FMPSMBUSEx_FastModePlus values
106   * @note  For FMPI2C1, fast mode plus driving capability can be disabled on all selected
107   *        FMPI2C1 pins using FMPSMBUS_FASTMODEPLUS_FMPI2C1 parameter or independently
108   *        on each one of the following pins PB6, PB7, PB8 and PB9.
109   * @note  For remaining FMPI2C1 pins (PA14, PA15...) fast mode plus driving capability
110   *        can be disabled only by using FMPSMBUS_FASTMODEPLUS_FMPI2C1 parameter.
111   * @retval None
112   */
HAL_FMPSMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus)113 void HAL_FMPSMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
114 {
115   /* Check the parameter */
116   assert_param(IS_FMPSMBUS_FASTMODEPLUS(ConfigFastModePlus));
117 
118   /* Enable SYSCFG clock */
119   __HAL_RCC_SYSCFG_CLK_ENABLE();
120 
121   /* Disable fast mode plus driving capability for selected pin */
122   CLEAR_BIT(SYSCFG->CFGR, (uint32_t)ConfigFastModePlus);
123 }
124 
125 /**
126   * @}
127   */
128 
129 /**
130   * @}
131   */
132 
133 /**
134   * @}
135   */
136 
137 #endif /* FMPI2C_CR1_PE */
138 #endif /* HAL_FMPSMBUS_MODULE_ENABLED */
139 /**
140   * @}
141   */
142 
143 /**
144   * @}
145   */
146