1 /**
2   ******************************************************************************
3   * @file    stm32h7xx_hal_smbus_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of SMBUS HAL Extended module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2017 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32H7xx_HAL_SMBUS_EX_H
21 #define STM32H7xx_HAL_SMBUS_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h7xx_hal_def.h"
29 
30 /** @addtogroup STM32H7xx_HAL_Driver
31   * @{
32   */
33 
34 /** @addtogroup SMBUSEx
35   * @{
36   */
37 
38 /* Exported types ------------------------------------------------------------*/
39 /* Exported constants --------------------------------------------------------*/
40 /** @defgroup SMBUSEx_Exported_Constants SMBUS Extended Exported Constants
41   * @{
42   */
43 
44 /** @defgroup SMBUSEx_FastModePlus SMBUS Extended Fast Mode Plus
45   * @{
46   */
47 #define SMBUS_FMP_NOT_SUPPORTED           0xAAAA0000U                                     /*!< Fast Mode Plus not supported       */
48 #define SMBUS_FASTMODEPLUS_PB6            SYSCFG_PMCR_I2C_PB6_FMP                        /*!< Enable Fast Mode Plus on PB6       */
49 #define SMBUS_FASTMODEPLUS_PB7            SYSCFG_PMCR_I2C_PB7_FMP                        /*!< Enable Fast Mode Plus on PB7       */
50 #define SMBUS_FASTMODEPLUS_PB8            SYSCFG_PMCR_I2C_PB8_FMP                        /*!< Enable Fast Mode Plus on PB8       */
51 #define SMBUS_FASTMODEPLUS_PB9            SYSCFG_PMCR_I2C_PB9_FMP                        /*!< Enable Fast Mode Plus on PB9       */
52 #define SMBUS_FASTMODEPLUS_I2C1           SYSCFG_PMCR_I2C1_FMP                           /*!< Enable Fast Mode Plus on I2C1 pins */
53 #define SMBUS_FASTMODEPLUS_I2C2           SYSCFG_PMCR_I2C2_FMP                           /*!< Enable Fast Mode Plus on I2C2 pins */
54 #define SMBUS_FASTMODEPLUS_I2C3           SYSCFG_PMCR_I2C3_FMP                           /*!< Enable Fast Mode Plus on I2C3 pins */
55 #define SMBUS_FASTMODEPLUS_I2C4           SYSCFG_PMCR_I2C4_FMP                           /*!< Enable Fast Mode Plus on I2C4 pins */
56 #if defined(SYSCFG_PMCR_I2C5_FMP)
57 #define SMBUS_FASTMODEPLUS_I2C5           SYSCFG_PMCR_I2C5_FMP                           /*!< Enable Fast Mode Plus on I2C5 pins */
58 #else
59 #define SMBUS_FASTMODEPLUS_I2C5           (uint32_t)(0x00001000U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C5 not supported  */
60 #endif /* SYSCFG_PMCR_I2C5_FMP */
61 /**
62   * @}
63   */
64 
65 /**
66   * @}
67   */
68 
69 /* Exported macro ------------------------------------------------------------*/
70 /** @defgroup SMBUSEx_Exported_Macros SMBUS Extended Exported Macros
71   * @{
72   */
73 
74 /**
75   * @}
76   */
77 
78 /* Exported functions --------------------------------------------------------*/
79 /** @addtogroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions
80   * @{
81   */
82 
83 /** @addtogroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions
84   * @{
85   */
86 /* Peripheral Control functions  ************************************************/
87 HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus);
88 HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus);
89 /**
90   * @}
91   */
92 
93 /** @addtogroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions
94   * @{
95   */
96 void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
97 void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
98 /**
99   * @}
100   */
101 
102 /**
103   * @}
104   */
105 
106 /* Private constants ---------------------------------------------------------*/
107 /** @defgroup SMBUSEx_Private_Constants SMBUS Extended Private Constants
108   * @{
109   */
110 
111 /**
112   * @}
113   */
114 
115 /* Private macros ------------------------------------------------------------*/
116 /** @defgroup SMBUSEx_Private_Macro SMBUS Extended Private Macros
117   * @{
118   */
119 #define IS_SMBUS_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & SMBUS_FASTMODEPLUS_PB6)  == SMBUS_FASTMODEPLUS_PB6)    || \
120                                            (((__CONFIG__) & SMBUS_FASTMODEPLUS_PB7)  == SMBUS_FASTMODEPLUS_PB7)    || \
121                                            (((__CONFIG__) & SMBUS_FASTMODEPLUS_PB8)  == SMBUS_FASTMODEPLUS_PB8)    || \
122                                            (((__CONFIG__) & SMBUS_FASTMODEPLUS_PB9)  == SMBUS_FASTMODEPLUS_PB9)    || \
123                                            (((__CONFIG__) & SMBUS_FASTMODEPLUS_I2C1) == SMBUS_FASTMODEPLUS_I2C1)   || \
124                                            (((__CONFIG__) & SMBUS_FASTMODEPLUS_I2C2) == SMBUS_FASTMODEPLUS_I2C2)   || \
125                                            (((__CONFIG__) & SMBUS_FASTMODEPLUS_I2C3) == SMBUS_FASTMODEPLUS_I2C3)   || \
126                                            (((__CONFIG__) & SMBUS_FASTMODEPLUS_I2C4) == SMBUS_FASTMODEPLUS_I2C4))
127 /**
128   * @}
129   */
130 
131 /* Private Functions ---------------------------------------------------------*/
132 /** @defgroup SMBUSEx_Private_Functions SMBUS Extended Private Functions
133   * @{
134   */
135 /* Private functions are defined in stm32h7xx_hal_smbus_ex.c file */
136 /**
137   * @}
138   */
139 
140 /**
141   * @}
142   */
143 
144 /**
145   * @}
146   */
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 #endif /* STM32H7xx_HAL_SMBUS_EX_H */
153