TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Fri Feb 24 21:13:56 2017 +0000
Revision:
1:d0dfbce63a89
Ready-to-copy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elmot 1:d0dfbce63a89 1 /**
elmot 1:d0dfbce63a89 2 ******************************************************************************
elmot 1:d0dfbce63a89 3 * @file stm32l4xx_hal_i2c_ex.h
elmot 1:d0dfbce63a89 4 * @author MCD Application Team
elmot 1:d0dfbce63a89 5 * @version V1.5.1
elmot 1:d0dfbce63a89 6 * @date 31-May-2016
elmot 1:d0dfbce63a89 7 * @brief Header file of I2C HAL Extended module.
elmot 1:d0dfbce63a89 8 ******************************************************************************
elmot 1:d0dfbce63a89 9 * @attention
elmot 1:d0dfbce63a89 10 *
elmot 1:d0dfbce63a89 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
elmot 1:d0dfbce63a89 12 *
elmot 1:d0dfbce63a89 13 * Redistribution and use in source and binary forms, with or without modification,
elmot 1:d0dfbce63a89 14 * are permitted provided that the following conditions are met:
elmot 1:d0dfbce63a89 15 * 1. Redistributions of source code must retain the above copyright notice,
elmot 1:d0dfbce63a89 16 * this list of conditions and the following disclaimer.
elmot 1:d0dfbce63a89 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
elmot 1:d0dfbce63a89 18 * this list of conditions and the following disclaimer in the documentation
elmot 1:d0dfbce63a89 19 * and/or other materials provided with the distribution.
elmot 1:d0dfbce63a89 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
elmot 1:d0dfbce63a89 21 * may be used to endorse or promote products derived from this software
elmot 1:d0dfbce63a89 22 * without specific prior written permission.
elmot 1:d0dfbce63a89 23 *
elmot 1:d0dfbce63a89 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
elmot 1:d0dfbce63a89 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
elmot 1:d0dfbce63a89 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
elmot 1:d0dfbce63a89 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
elmot 1:d0dfbce63a89 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
elmot 1:d0dfbce63a89 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
elmot 1:d0dfbce63a89 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
elmot 1:d0dfbce63a89 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
elmot 1:d0dfbce63a89 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
elmot 1:d0dfbce63a89 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elmot 1:d0dfbce63a89 34 *
elmot 1:d0dfbce63a89 35 ******************************************************************************
elmot 1:d0dfbce63a89 36 */
elmot 1:d0dfbce63a89 37
elmot 1:d0dfbce63a89 38 /* Define to prevent recursive inclusion -------------------------------------*/
elmot 1:d0dfbce63a89 39 #ifndef __STM32L4xx_HAL_I2C_EX_H
elmot 1:d0dfbce63a89 40 #define __STM32L4xx_HAL_I2C_EX_H
elmot 1:d0dfbce63a89 41
elmot 1:d0dfbce63a89 42 #ifdef __cplusplus
elmot 1:d0dfbce63a89 43 extern "C" {
elmot 1:d0dfbce63a89 44 #endif
elmot 1:d0dfbce63a89 45
elmot 1:d0dfbce63a89 46 /* Includes ------------------------------------------------------------------*/
elmot 1:d0dfbce63a89 47 #include "stm32l4xx_hal_def.h"
elmot 1:d0dfbce63a89 48
elmot 1:d0dfbce63a89 49 /** @addtogroup STM32L4xx_HAL_Driver
elmot 1:d0dfbce63a89 50 * @{
elmot 1:d0dfbce63a89 51 */
elmot 1:d0dfbce63a89 52
elmot 1:d0dfbce63a89 53 /** @addtogroup I2CEx I2CEx
elmot 1:d0dfbce63a89 54 * @{
elmot 1:d0dfbce63a89 55 */
elmot 1:d0dfbce63a89 56
elmot 1:d0dfbce63a89 57 /* Exported types ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 58 /* Exported constants --------------------------------------------------------*/
elmot 1:d0dfbce63a89 59
elmot 1:d0dfbce63a89 60 /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants
elmot 1:d0dfbce63a89 61 * @{
elmot 1:d0dfbce63a89 62 */
elmot 1:d0dfbce63a89 63
elmot 1:d0dfbce63a89 64 /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter
elmot 1:d0dfbce63a89 65 * @{
elmot 1:d0dfbce63a89 66 */
elmot 1:d0dfbce63a89 67 #define I2C_ANALOGFILTER_ENABLE ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 68 #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF
elmot 1:d0dfbce63a89 69 /**
elmot 1:d0dfbce63a89 70 * @}
elmot 1:d0dfbce63a89 71 */
elmot 1:d0dfbce63a89 72
elmot 1:d0dfbce63a89 73 /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus
elmot 1:d0dfbce63a89 74 * @{
elmot 1:d0dfbce63a89 75 */
elmot 1:d0dfbce63a89 76 #define I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */
elmot 1:d0dfbce63a89 77 #define I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */
elmot 1:d0dfbce63a89 78 #define I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */
elmot 1:d0dfbce63a89 79 #define I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */
elmot 1:d0dfbce63a89 80 #define I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */
elmot 1:d0dfbce63a89 81 #define I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */
elmot 1:d0dfbce63a89 82 #define I2C_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */
elmot 1:d0dfbce63a89 83 /**
elmot 1:d0dfbce63a89 84 * @}
elmot 1:d0dfbce63a89 85 */
elmot 1:d0dfbce63a89 86
elmot 1:d0dfbce63a89 87 /**
elmot 1:d0dfbce63a89 88 * @}
elmot 1:d0dfbce63a89 89 */
elmot 1:d0dfbce63a89 90
elmot 1:d0dfbce63a89 91 /* Exported macro ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 92 /* Exported functions --------------------------------------------------------*/
elmot 1:d0dfbce63a89 93
elmot 1:d0dfbce63a89 94 /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions
elmot 1:d0dfbce63a89 95 * @{
elmot 1:d0dfbce63a89 96 */
elmot 1:d0dfbce63a89 97
elmot 1:d0dfbce63a89 98 /** @addtogroup I2CEx_Exported_Functions_Group1 Extended features functions
elmot 1:d0dfbce63a89 99 * @brief Extended features functions
elmot 1:d0dfbce63a89 100 * @{
elmot 1:d0dfbce63a89 101 */
elmot 1:d0dfbce63a89 102
elmot 1:d0dfbce63a89 103 /* Peripheral Control functions ************************************************/
elmot 1:d0dfbce63a89 104 HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter);
elmot 1:d0dfbce63a89 105 HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter);
elmot 1:d0dfbce63a89 106 HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c);
elmot 1:d0dfbce63a89 107 HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c);
elmot 1:d0dfbce63a89 108 void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
elmot 1:d0dfbce63a89 109 void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
elmot 1:d0dfbce63a89 110
elmot 1:d0dfbce63a89 111 /* Private constants ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 112 /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants
elmot 1:d0dfbce63a89 113 * @{
elmot 1:d0dfbce63a89 114 */
elmot 1:d0dfbce63a89 115
elmot 1:d0dfbce63a89 116 /**
elmot 1:d0dfbce63a89 117 * @}
elmot 1:d0dfbce63a89 118 */
elmot 1:d0dfbce63a89 119
elmot 1:d0dfbce63a89 120 /* Private macros ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 121 /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros
elmot 1:d0dfbce63a89 122 * @{
elmot 1:d0dfbce63a89 123 */
elmot 1:d0dfbce63a89 124 #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \
elmot 1:d0dfbce63a89 125 ((FILTER) == I2C_ANALOGFILTER_DISABLE))
elmot 1:d0dfbce63a89 126
elmot 1:d0dfbce63a89 127 #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000F)
elmot 1:d0dfbce63a89 128
elmot 1:d0dfbce63a89 129 #if defined (STM32L432xx) || defined (STM32L442xx)
elmot 1:d0dfbce63a89 130 #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \
elmot 1:d0dfbce63a89 131 (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \
elmot 1:d0dfbce63a89 132 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \
elmot 1:d0dfbce63a89 133 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3))
elmot 1:d0dfbce63a89 134 #else
elmot 1:d0dfbce63a89 135 #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \
elmot 1:d0dfbce63a89 136 (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \
elmot 1:d0dfbce63a89 137 (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \
elmot 1:d0dfbce63a89 138 (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \
elmot 1:d0dfbce63a89 139 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \
elmot 1:d0dfbce63a89 140 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2) || \
elmot 1:d0dfbce63a89 141 (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3))
elmot 1:d0dfbce63a89 142 #endif /* STM32L432xx || STM32L442xx */
elmot 1:d0dfbce63a89 143 /**
elmot 1:d0dfbce63a89 144 * @}
elmot 1:d0dfbce63a89 145 */
elmot 1:d0dfbce63a89 146
elmot 1:d0dfbce63a89 147 /* Private Functions ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 148 /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions
elmot 1:d0dfbce63a89 149 * @{
elmot 1:d0dfbce63a89 150 */
elmot 1:d0dfbce63a89 151 /* Private functions are defined in stm32l4xx_hal_i2c_ex.c file */
elmot 1:d0dfbce63a89 152 /**
elmot 1:d0dfbce63a89 153 * @}
elmot 1:d0dfbce63a89 154 */
elmot 1:d0dfbce63a89 155
elmot 1:d0dfbce63a89 156 /**
elmot 1:d0dfbce63a89 157 * @}
elmot 1:d0dfbce63a89 158 */
elmot 1:d0dfbce63a89 159
elmot 1:d0dfbce63a89 160 /**
elmot 1:d0dfbce63a89 161 * @}
elmot 1:d0dfbce63a89 162 */
elmot 1:d0dfbce63a89 163
elmot 1:d0dfbce63a89 164 /**
elmot 1:d0dfbce63a89 165 * @}
elmot 1:d0dfbce63a89 166 */
elmot 1:d0dfbce63a89 167
elmot 1:d0dfbce63a89 168 /**
elmot 1:d0dfbce63a89 169 * @}
elmot 1:d0dfbce63a89 170 */
elmot 1:d0dfbce63a89 171
elmot 1:d0dfbce63a89 172 #ifdef __cplusplus
elmot 1:d0dfbce63a89 173 }
elmot 1:d0dfbce63a89 174 #endif
elmot 1:d0dfbce63a89 175
elmot 1:d0dfbce63a89 176 #endif /* __STM32L4xx_HAL_I2C_EX_H */
elmot 1:d0dfbce63a89 177
elmot 1:d0dfbce63a89 178 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/