1 /**
2   ******************************************************************************
3   * @file    stm32l0xx_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) 2016 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 STM32L0xx_HAL_SMBUS_EX_H
21 #define STM32L0xx_HAL_SMBUS_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32l0xx_hal_def.h"
29 
30 /** @addtogroup STM32L0xx_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 #if defined(SYSCFG_CFGR2_I2C_PB6_FMP)
49 #define SMBUS_FASTMODEPLUS_PB6            SYSCFG_CFGR2_I2C_PB6_FMP                        /*!< Enable Fast Mode Plus on PB6       */
50 #define SMBUS_FASTMODEPLUS_PB7            SYSCFG_CFGR2_I2C_PB7_FMP                        /*!< Enable Fast Mode Plus on PB7       */
51 #else
52 #define SMBUS_FASTMODEPLUS_PB6            (uint32_t)(0x00000004U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB6 not supported   */
53 #define SMBUS_FASTMODEPLUS_PB7            (uint32_t)(0x00000008U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB7 not supported   */
54 #endif /* SYSCFG_CFGR2_I2C_PB6_FMP */
55 #if defined(SYSCFG_CFGR2_I2C_PB8_FMP)
56 #define SMBUS_FASTMODEPLUS_PB8            SYSCFG_CFGR2_I2C_PB8_FMP                        /*!< Enable Fast Mode Plus on PB8       */
57 #define SMBUS_FASTMODEPLUS_PB9            SYSCFG_CFGR2_I2C_PB9_FMP                        /*!< Enable Fast Mode Plus on PB9       */
58 #else
59 #define SMBUS_FASTMODEPLUS_PB8            (uint32_t)(0x00000010U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported   */
60 #define SMBUS_FASTMODEPLUS_PB9            (uint32_t)(0x00000012U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported   */
61 #endif /* SYSCFG_CFGR2_I2C_PB8_FMP */
62 #if defined(SYSCFG_CFGR2_I2C1_FMP)
63 #define SMBUS_FASTMODEPLUS_I2C1           SYSCFG_CFGR2_I2C1_FMP                           /*!< Enable Fast Mode Plus on I2C1 pins */
64 #else
65 #define SMBUS_FASTMODEPLUS_I2C1           (uint32_t)(0x00000100U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C1 not supported  */
66 #endif /* SYSCFG_CFGR2_I2C1_FMP */
67 #if defined(SYSCFG_CFGR2_I2C2_FMP)
68 #define SMBUS_FASTMODEPLUS_I2C2           SYSCFG_CFGR2_I2C2_FMP                           /*!< Enable Fast Mode Plus on I2C2 pins */
69 #else
70 #define SMBUS_FASTMODEPLUS_I2C2           (uint32_t)(0x00000200U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported  */
71 #endif /* SYSCFG_CFGR2_I2C2_FMP */
72 #if defined(SYSCFG_CFGR2_I2C3_FMP)
73 #define SMBUS_FASTMODEPLUS_I2C3           SYSCFG_CFGR2_I2C3_FMP                           /*!< Enable Fast Mode Plus on I2C3 pins */
74 #else
75 #define SMBUS_FASTMODEPLUS_I2C3           (uint32_t)(0x00000400U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C3 not supported  */
76 #endif /* SYSCFG_CFGR2_I2C3_FMP */
77 /**
78   * @}
79   */
80 
81 /**
82   * @}
83   */
84 
85 /* Exported macro ------------------------------------------------------------*/
86 /** @defgroup SMBUSEx_Exported_Macros SMBUS Extended Exported Macros
87   * @{
88   */
89 
90 /**
91   * @}
92   */
93 
94 /* Exported functions --------------------------------------------------------*/
95 /** @addtogroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions
96   * @{
97   */
98 
99 /** @addtogroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions
100   * @{
101   */
102 /* Peripheral Control functions  ************************************************/
103 HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus);
104 HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus);
105 /**
106   * @}
107   */
108 
109 /** @addtogroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions
110   * @{
111   */
112 #if  (defined(SYSCFG_CFGR2_I2C_PB6_FMP) || defined(SYSCFG_CFGR2_I2C_PB7_FMP)) || (defined(SYSCFG_CFGR2_I2C_PB8_FMP) || defined(SYSCFG_CFGR2_I2C_PB9_FMP)) || (defined(SYSCFG_CFGR2_I2C1_FMP)) || defined(SYSCFG_CFGR2_I2C2_FMP) || defined(SYSCFG_CFGR2_I2C3_FMP)
113 void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
114 void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
115 #endif /* Fast Mode Plus Availability */
116 /**
117   * @}
118   */
119 
120 /**
121   * @}
122   */
123 
124 /* Private constants ---------------------------------------------------------*/
125 /** @defgroup SMBUSEx_Private_Constants SMBUS Extended Private Constants
126   * @{
127   */
128 
129 /**
130   * @}
131   */
132 
133 /* Private macros ------------------------------------------------------------*/
134 /** @defgroup SMBUSEx_Private_Macro SMBUS Extended Private Macros
135   * @{
136   */
137 #define IS_SMBUS_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & SMBUS_FMP_NOT_SUPPORTED) != SMBUS_FMP_NOT_SUPPORTED) && \
138                                            ((((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB6))  == SMBUS_FASTMODEPLUS_PB6)  || \
139                                             (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB7))  == SMBUS_FASTMODEPLUS_PB7)  || \
140                                             (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB8))  == SMBUS_FASTMODEPLUS_PB8)  || \
141                                             (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB9))  == SMBUS_FASTMODEPLUS_PB9)  || \
142                                             (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C1)) == SMBUS_FASTMODEPLUS_I2C1) || \
143                                             (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C2)) == SMBUS_FASTMODEPLUS_I2C2) || \
144                                             (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C3)) == SMBUS_FASTMODEPLUS_I2C3)))
145 /**
146   * @}
147   */
148 
149 /* Private Functions ---------------------------------------------------------*/
150 /** @defgroup SMBUSEx_Private_Functions SMBUS Extended Private Functions
151   * @{
152   */
153 /* Private functions are defined in stm32l0xx_hal_smbus_ex.c file */
154 /**
155   * @}
156   */
157 
158 /**
159   * @}
160   */
161 
162 /**
163   * @}
164   */
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* STM32L0xx_HAL_SMBUS_EX_H */
171