Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:35

0001 /**
0002   ******************************************************************************
0003   * @file    stm32h7xx_hal_i2c_ex.h
0004   * @author  MCD Application Team
0005   * @brief   Header file of I2C HAL Extended module.
0006   ******************************************************************************
0007   * @attention
0008   *
0009   * Copyright (c) 2017 STMicroelectronics.
0010   * All rights reserved.
0011   *
0012   * This software is licensed under terms that can be found in the LICENSE file
0013   * in the root directory of this software component.
0014   * If no LICENSE file comes with this software, it is provided AS-IS.
0015   *
0016   ******************************************************************************
0017   */
0018 
0019 /* Define to prevent recursive inclusion -------------------------------------*/
0020 #ifndef STM32H7xx_HAL_I2C_EX_H
0021 #define STM32H7xx_HAL_I2C_EX_H
0022 
0023 #ifdef __cplusplus
0024 extern "C" {
0025 #endif
0026 
0027 /* Includes ------------------------------------------------------------------*/
0028 #include "stm32h7xx_hal_def.h"
0029 
0030 /** @addtogroup STM32H7xx_HAL_Driver
0031   * @{
0032   */
0033 
0034 /** @addtogroup I2CEx
0035   * @{
0036   */
0037 
0038 /* Exported types ------------------------------------------------------------*/
0039 /* Exported constants --------------------------------------------------------*/
0040 /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants
0041   * @ingroup RTEMSBSPsARMSTM32H7
0042   * @{
0043   */
0044 
0045 /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter
0046   * @ingroup RTEMSBSPsARMSTM32H7
0047   * @{
0048   */
0049 #define I2C_ANALOGFILTER_ENABLE         0x00000000U
0050 #define I2C_ANALOGFILTER_DISABLE        I2C_CR1_ANFOFF
0051 /**
0052   * @}
0053   */
0054 
0055 /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus
0056   * @ingroup RTEMSBSPsARMSTM32H7
0057   * @{
0058   */
0059 #define I2C_FMP_NOT_SUPPORTED           0xAAAA0000U                                     /*!< Fast Mode Plus not supported       */
0060 #define I2C_FASTMODEPLUS_PB6            SYSCFG_PMCR_I2C_PB6_FMP                        /*!< Enable Fast Mode Plus on PB6       */
0061 #define I2C_FASTMODEPLUS_PB7            SYSCFG_PMCR_I2C_PB7_FMP                        /*!< Enable Fast Mode Plus on PB7       */
0062 #define I2C_FASTMODEPLUS_PB8            SYSCFG_PMCR_I2C_PB8_FMP                        /*!< Enable Fast Mode Plus on PB8       */
0063 #define I2C_FASTMODEPLUS_PB9            SYSCFG_PMCR_I2C_PB9_FMP                        /*!< Enable Fast Mode Plus on PB9       */
0064 #define I2C_FASTMODEPLUS_I2C1           SYSCFG_PMCR_I2C1_FMP                           /*!< Enable Fast Mode Plus on I2C1 pins */
0065 #define I2C_FASTMODEPLUS_I2C2           SYSCFG_PMCR_I2C2_FMP                           /*!< Enable Fast Mode Plus on I2C2 pins */
0066 #define I2C_FASTMODEPLUS_I2C3           SYSCFG_PMCR_I2C3_FMP                           /*!< Enable Fast Mode Plus on I2C3 pins */
0067 #define I2C_FASTMODEPLUS_I2C4           SYSCFG_PMCR_I2C4_FMP                           /*!< Enable Fast Mode Plus on I2C4 pins */
0068 #if defined(SYSCFG_PMCR_I2C5_FMP)
0069 #define I2C_FASTMODEPLUS_I2C5           SYSCFG_PMCR_I2C5_FMP                           /*!< Enable Fast Mode Plus on I2C5 pins */
0070 #else
0071 #define I2C_FASTMODEPLUS_I2C5           (uint32_t)(0x00001000U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C5 not supported  */
0072 #endif /* SYSCFG_PMCR_I2C5_FMP */
0073 /**
0074   * @}
0075   */
0076 
0077 /**
0078   * @}
0079   */
0080 
0081 /* Exported macro ------------------------------------------------------------*/
0082 /** @defgroup I2CEx_Exported_Macros I2C Extended Exported Macros
0083   * @ingroup RTEMSBSPsARMSTM32H7
0084   * @{
0085   */
0086 
0087 /**
0088   * @}
0089   */
0090 
0091 /* Exported functions --------------------------------------------------------*/
0092 /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions
0093   * @{
0094   */
0095 
0096 /** @addtogroup I2CEx_Exported_Functions_Group1 Filter Mode Functions
0097   * @{
0098   */
0099 /* Peripheral Control functions  ************************************************/
0100 HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter);
0101 HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter);
0102 /**
0103   * @}
0104   */
0105 
0106 /** @addtogroup I2CEx_Exported_Functions_Group2 WakeUp Mode Functions
0107   * @{
0108   */
0109 HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c);
0110 HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c);
0111 /**
0112   * @}
0113   */
0114 
0115 /** @addtogroup I2CEx_Exported_Functions_Group3 Fast Mode Plus Functions
0116   * @{
0117   */
0118 void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
0119 void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
0120 /**
0121   * @}
0122   */
0123 
0124 /**
0125   * @}
0126   */
0127 
0128 /* Private constants ---------------------------------------------------------*/
0129 /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants
0130   * @ingroup RTEMSBSPsARMSTM32H7
0131   * @{
0132   */
0133 
0134 /**
0135   * @}
0136   */
0137 
0138 /* Private macros ------------------------------------------------------------*/
0139 /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros
0140   * @ingroup RTEMSBSPsARMSTM32H7
0141   * @{
0142   */
0143 #define IS_I2C_ANALOG_FILTER(FILTER)    (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \
0144                                          ((FILTER) == I2C_ANALOGFILTER_DISABLE))
0145 
0146 #define IS_I2C_DIGITAL_FILTER(FILTER)   ((FILTER) <= 0x0000000FU)
0147 
0148 #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FASTMODEPLUS_PB6)  == I2C_FASTMODEPLUS_PB6)  || \
0149                                          (((__CONFIG__) & I2C_FASTMODEPLUS_PB7)  == I2C_FASTMODEPLUS_PB7)  || \
0150                                          (((__CONFIG__) & I2C_FASTMODEPLUS_PB8)  == I2C_FASTMODEPLUS_PB8)  || \
0151                                          (((__CONFIG__) & I2C_FASTMODEPLUS_PB9)  == I2C_FASTMODEPLUS_PB9)  || \
0152                                          (((__CONFIG__) & I2C_FASTMODEPLUS_I2C1) == I2C_FASTMODEPLUS_I2C1) || \
0153                                          (((__CONFIG__) & I2C_FASTMODEPLUS_I2C2) == I2C_FASTMODEPLUS_I2C2) || \
0154                                          (((__CONFIG__) & I2C_FASTMODEPLUS_I2C3) == I2C_FASTMODEPLUS_I2C3) || \
0155                                          (((__CONFIG__) & I2C_FASTMODEPLUS_I2C4) == I2C_FASTMODEPLUS_I2C4))
0156 /**
0157   * @}
0158   */
0159 
0160 /* Private Functions ---------------------------------------------------------*/
0161 /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions
0162   * @ingroup RTEMSBSPsARMSTM32H7
0163   * @{
0164   */
0165 /* Private functions are defined in stm32h7xx_hal_i2c_ex.c file */
0166 /**
0167   * @}
0168   */
0169 
0170 /**
0171   * @}
0172   */
0173 
0174 /**
0175   * @}
0176   */
0177 
0178 #ifdef __cplusplus
0179 }
0180 #endif
0181 
0182 #endif /* STM32H7xx_HAL_I2C_EX_H */