You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

149 regels
5.2 KiB

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