1 /**
2   ******************************************************************************
3   * @file    stm32wb0x_hal_smbus_ex.c
4   * @author  MCD Application Team
5   * @brief   SMBUS Extended HAL module driver.
6   *          This file provides firmware functions to manage the following
7   *          functionalities of SMBUS Extended peripheral:
8   *           + Extended features functions
9   *           + FastModePlus Functions
10   *
11   ******************************************************************************
12   * @attention
13   *
14   * Copyright (c) 2024 STMicroelectronics.
15   * All rights reserved.
16   *
17   * This software is licensed under terms that can be found in the LICENSE file
18   * in the root directory of this software component.
19   * If no LICENSE file comes with this software, it is provided AS-IS.
20   *
21   ******************************************************************************
22   @verbatim
23   ==============================================================================
24                ##### SMBUS peripheral Extended features  #####
25   ==============================================================================
26 
27   [..] Comparing to other previous devices, the SMBUS interface for STM32WB0x
28        devices contains the following additional features
29 
30        (+) Disable or enable Fast Mode Plus
31 
32                      ##### How to use this driver #####
33   ==============================================================================
34     (#) Configure the enable or disable of fast mode plus driving capability using the functions :
35           (++) HAL_SMBUSEx_EnableFastModePlus()
36           (++) HAL_SMBUSEx_DisableFastModePlus()
37   @endverbatim
38   */
39 
40 /* Includes ------------------------------------------------------------------*/
41 #include "stm32wb0x_hal.h"
42 
43 /** @addtogroup STM32WB0x_HAL_Driver
44   * @{
45   */
46 
47 /** @defgroup SMBUSEx SMBUSEx
48   * @brief SMBUS Extended HAL module driver
49   * @{
50   */
51 
52 #ifdef HAL_SMBUS_MODULE_ENABLED
53 
54 /* Private typedef -----------------------------------------------------------*/
55 /* Private define ------------------------------------------------------------*/
56 /* Private macro -------------------------------------------------------------*/
57 /* Private variables ---------------------------------------------------------*/
58 /* Private function prototypes -----------------------------------------------*/
59 /* Private functions ---------------------------------------------------------*/
60 
61 /** @defgroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions
62   * @{
63   */
64 
65 /** @defgroup SMBUSEx_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 SMBUS fast mode plus driving capability.
81   * @param ConfigFastModePlus Selects the pin.
82   *   This parameter can be one of the @ref SMBUSEx_FastModePlus values
83   * @retval None
84   */
HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus)85 void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
86 {
87   /* Check the parameter */
88   assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus));
89 
90   /* Enable fast mode plus driving capability for selected pin */
91   SET_BIT(SYSCFG->I2C_FMP_CTRL, (uint32_t)ConfigFastModePlus);
92 }
93 
94 /**
95   * @brief Disable the SMBUS fast mode plus driving capability.
96   * @param ConfigFastModePlus Selects the pin.
97   *   This parameter can be one of the @ref SMBUSEx_FastModePlus values
98   * @retval None
99   */
HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus)100 void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
101 {
102   /* Check the parameter */
103   assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus));
104 
105   /* Disable fast mode plus driving capability for selected pin */
106   CLEAR_BIT(SYSCFG->I2C_FMP_CTRL, (uint32_t)ConfigFastModePlus);
107 }
108 
109 /**
110   * @}
111   */
112 
113 /**
114   * @}
115   */
116 
117 /**
118   * @}
119   */
120 
121 #endif /* HAL_SMBUS_MODULE_ENABLED */
122 /**
123   * @}
124   */
125 
126 /**
127   * @}
128   */
129