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