2 ******************************************************************************
\r
3 * @file stm32l4xx_hal_i2c_ex.h
\r
4 * @author MCD Application Team
\r
5 * @brief Header file of I2C HAL Extended module.
\r
6 ******************************************************************************
\r
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
10 * All rights reserved.</center></h2>
\r
12 * This software component is licensed by ST under BSD 3-Clause license,
\r
13 * the "License"; You may not use this file except in compliance with the
\r
14 * License. You may obtain a copy of the License at:
\r
15 * opensource.org/licenses/BSD-3-Clause
\r
17 ******************************************************************************
\r
20 /* Define to prevent recursive inclusion -------------------------------------*/
\r
21 #ifndef STM32L4xx_HAL_I2C_EX_H
\r
22 #define STM32L4xx_HAL_I2C_EX_H
\r
28 /* Includes ------------------------------------------------------------------*/
\r
29 #include "stm32l4xx_hal_def.h"
\r
31 /** @addtogroup STM32L4xx_HAL_Driver
\r
35 /** @addtogroup I2CEx
\r
39 /* Exported types ------------------------------------------------------------*/
\r
40 /* Exported constants --------------------------------------------------------*/
\r
42 /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants
\r
46 /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter
\r
49 #define I2C_ANALOGFILTER_ENABLE 0x00000000U
\r
50 #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF
\r
55 /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus
\r
58 #define I2C_FMP_NOT_SUPPORTED 0xAAAA0000U /*!< Fast Mode Plus not supported */
\r
59 #define I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */
\r
60 #define I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */
\r
61 #if defined(SYSCFG_CFGR1_I2C_PB8_FMP)
\r
62 #define I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */
\r
63 #define I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */
\r
65 #define I2C_FASTMODEPLUS_PB8 (uint32_t)(0x00000010U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported */
\r
66 #define I2C_FASTMODEPLUS_PB9 (uint32_t)(0x00000012U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported */
\r
68 #define I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */
\r
69 #if defined(SYSCFG_CFGR1_I2C2_FMP)
\r
70 #define I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */
\r
72 #define I2C_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */
\r
74 #define I2C_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */
\r
75 #if defined(SYSCFG_CFGR1_I2C4_FMP)
\r
76 #define I2C_FASTMODEPLUS_I2C4 SYSCFG_CFGR1_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */
\r
78 #define I2C_FASTMODEPLUS_I2C4 (uint32_t)(0x00000800U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C4 not supported */
\r
88 /* Exported macro ------------------------------------------------------------*/
\r
89 /* Exported functions --------------------------------------------------------*/
\r
91 /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions
\r
95 /** @addtogroup I2CEx_Exported_Functions_Group1 Extended features functions
\r
96 * @brief Extended features functions
\r
100 /* Peripheral Control functions ************************************************/
\r
101 HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter);
\r
102 HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter);
\r
103 HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c);
\r
104 HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c);
\r
105 void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
\r
106 void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
\r
108 /* Private constants ---------------------------------------------------------*/
\r
109 /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants
\r
117 /* Private macros ------------------------------------------------------------*/
\r
118 /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros
\r
121 #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \
\r
122 ((FILTER) == I2C_ANALOGFILTER_DISABLE))
\r
124 #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU)
\r
126 #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FMP_NOT_SUPPORTED) != I2C_FMP_NOT_SUPPORTED) && \
\r
127 ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \
\r
128 (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \
\r
129 (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \
\r
130 (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \
\r
131 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \
\r
132 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2) || \
\r
133 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3) || \
\r
134 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C4)) == I2C_FASTMODEPLUS_I2C4)))
\r
142 /* Private Functions ---------------------------------------------------------*/
\r
143 /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions
\r
146 /* Private functions are defined in stm32l4xx_hal_i2c_ex.c file */
\r
171 #endif /* STM32L4xx_HAL_I2C_EX_H */
\r
173 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r