STM32L486xx HAL User Manual
stm32l4xx_hal_i2c_ex.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_hal_i2c_ex.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of I2C HAL Extended module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00010   *
00011   * Redistribution and use in source and binary forms, with or without modification,
00012   * are permitted provided that the following conditions are met:
00013   *   1. Redistributions of source code must retain the above copyright notice,
00014   *      this list of conditions and the following disclaimer.
00015   *   2. Redistributions in binary form must reproduce the above copyright notice,
00016   *      this list of conditions and the following disclaimer in the documentation
00017   *      and/or other materials provided with the distribution.
00018   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00019   *      may be used to endorse or promote products derived from this software
00020   *      without specific prior written permission.
00021   *
00022   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00023   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00025   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00026   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00028   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00030   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00031   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00032   *
00033   ******************************************************************************
00034   */
00035 
00036 /* Define to prevent recursive inclusion -------------------------------------*/
00037 #ifndef STM32L4xx_HAL_I2C_EX_H
00038 #define STM32L4xx_HAL_I2C_EX_H
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 /* Includes ------------------------------------------------------------------*/
00045 #include "stm32l4xx_hal_def.h"
00046 
00047 /** @addtogroup STM32L4xx_HAL_Driver
00048   * @{
00049   */
00050 
00051 /** @addtogroup I2CEx
00052   * @{
00053   */
00054 
00055 /* Exported types ------------------------------------------------------------*/
00056 /* Exported constants --------------------------------------------------------*/
00057 
00058 /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants
00059   * @{
00060   */
00061 
00062 /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter
00063   * @{
00064   */
00065 #define I2C_ANALOGFILTER_ENABLE         0x00000000U
00066 #define I2C_ANALOGFILTER_DISABLE        I2C_CR1_ANFOFF
00067 /**
00068   * @}
00069   */
00070 
00071 /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus
00072   * @{
00073   */
00074 #define I2C_FMP_NOT_SUPPORTED           0xAAAA0000U                                     /*!< Fast Mode Plus not supported       */
00075 #define I2C_FASTMODEPLUS_PB6            SYSCFG_CFGR1_I2C_PB6_FMP                        /*!< Enable Fast Mode Plus on PB6       */
00076 #define I2C_FASTMODEPLUS_PB7            SYSCFG_CFGR1_I2C_PB7_FMP                        /*!< Enable Fast Mode Plus on PB7       */
00077 #if defined(SYSCFG_CFGR1_I2C_PB8_FMP)
00078 #define I2C_FASTMODEPLUS_PB8            SYSCFG_CFGR1_I2C_PB8_FMP                        /*!< Enable Fast Mode Plus on PB8       */
00079 #define I2C_FASTMODEPLUS_PB9            SYSCFG_CFGR1_I2C_PB9_FMP                        /*!< Enable Fast Mode Plus on PB9       */
00080 #else
00081 #define I2C_FASTMODEPLUS_PB8            (uint32_t)(0x00000010U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported   */
00082 #define I2C_FASTMODEPLUS_PB9            (uint32_t)(0x00000012U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported   */
00083 #endif
00084 #define I2C_FASTMODEPLUS_I2C1           SYSCFG_CFGR1_I2C1_FMP                           /*!< Enable Fast Mode Plus on I2C1 pins */
00085 #if defined(SYSCFG_CFGR1_I2C2_FMP)
00086 #define I2C_FASTMODEPLUS_I2C2           SYSCFG_CFGR1_I2C2_FMP                           /*!< Enable Fast Mode Plus on I2C2 pins */
00087 #else
00088 #define I2C_FASTMODEPLUS_I2C2           (uint32_t)(0x00000200U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported  */
00089 #endif
00090 #define I2C_FASTMODEPLUS_I2C3           SYSCFG_CFGR1_I2C3_FMP                           /*!< Enable Fast Mode Plus on I2C3 pins */
00091 #if defined(SYSCFG_CFGR1_I2C4_FMP)
00092 #define I2C_FASTMODEPLUS_I2C4           SYSCFG_CFGR1_I2C4_FMP                           /*!< Enable Fast Mode Plus on I2C4 pins */
00093 #else
00094 #define I2C_FASTMODEPLUS_I2C4           (uint32_t)(0x00000800U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C4 not supported  */
00095 #endif
00096 /**
00097   * @}
00098   */
00099 
00100 /**
00101   * @}
00102   */
00103 
00104 /* Exported macro ------------------------------------------------------------*/
00105 /* Exported functions --------------------------------------------------------*/
00106 
00107 /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions
00108   * @{
00109   */
00110 
00111 /** @addtogroup I2CEx_Exported_Functions_Group1 Extended features functions
00112   * @brief    Extended features functions
00113   * @{
00114   */
00115 
00116 /* Peripheral Control functions  ************************************************/
00117 HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter);
00118 HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter);
00119 HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c);
00120 HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c);
00121 void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
00122 void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
00123 
00124 /* Private constants ---------------------------------------------------------*/
00125 /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants
00126   * @{
00127   */
00128 
00129 /**
00130   * @}
00131   */
00132 
00133 /* Private macros ------------------------------------------------------------*/
00134 /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros
00135   * @{
00136   */
00137 #define IS_I2C_ANALOG_FILTER(FILTER)    (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \
00138                                           ((FILTER) == I2C_ANALOGFILTER_DISABLE))
00139 
00140 #define IS_I2C_DIGITAL_FILTER(FILTER)   ((FILTER) <= 0x0000000FU)
00141 
00142 #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FMP_NOT_SUPPORTED) != I2C_FMP_NOT_SUPPORTED) && \
00143                                          ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6))  == I2C_FASTMODEPLUS_PB6)     || \
00144                                           (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7))  == I2C_FASTMODEPLUS_PB7)     || \
00145                                           (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8))  == I2C_FASTMODEPLUS_PB8)     || \
00146                                           (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9))  == I2C_FASTMODEPLUS_PB9)     || \
00147                                           (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1)    || \
00148                                           (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2)    || \
00149                                           (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3)    || \
00150                                           (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C4)) == I2C_FASTMODEPLUS_I2C4)))
00151 /**
00152   * @}
00153   */
00154 
00155 /* Private Functions ---------------------------------------------------------*/
00156 /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions
00157   * @{
00158   */
00159 /* Private functions are defined in stm32l4xx_hal_i2c_ex.c file */
00160 /**
00161   * @}
00162   */
00163 
00164 /**
00165   * @}
00166   */
00167 
00168 /**
00169   * @}
00170   */
00171 
00172 /**
00173   * @}
00174   */
00175 
00176 /**
00177   * @}
00178   */
00179 
00180 #ifdef __cplusplus
00181 }
00182 #endif
00183 
00184 #endif /* STM32L4xx_HAL_I2C_EX_H */
00185 
00186 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/