my fork
Fork of mbed by
TARGET_NUCLEO_L053R8/stm32l0xx_hal_i2c_ex.h@96:487b796308b0, 2015-03-17 (annotated)
- Committer:
- Kojto
- Date:
- Tue Mar 17 14:27:45 2015 +0000
- Revision:
- 96:487b796308b0
- Parent:
- 92:4fc01daae5a5
Release 96 of the mbed library
Changes:
- IAR support for ble boards, lpc, ethernet stack
- RTC - attach function to redirect time functions
- Nucleo F103RB - cube driver
- k20xx - fixes for teensy and k20 platforms in sleep/deepsleep and usb
- STM32L0, Nucleo/Disco L053 - refactoring
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 84:0b3ab51c8877 | 1 | /** |
bogdanm | 84:0b3ab51c8877 | 2 | ****************************************************************************** |
bogdanm | 84:0b3ab51c8877 | 3 | * @file stm32l0xx_hal_i2c_ex.h |
bogdanm | 84:0b3ab51c8877 | 4 | * @author MCD Application Team |
Kojto | 96:487b796308b0 | 5 | * @version V1.2.0 |
Kojto | 96:487b796308b0 | 6 | * @date 06-February-2015 |
bogdanm | 84:0b3ab51c8877 | 7 | * @brief Header file of I2C HAL Extension module. |
bogdanm | 84:0b3ab51c8877 | 8 | ****************************************************************************** |
bogdanm | 84:0b3ab51c8877 | 9 | * @attention |
bogdanm | 84:0b3ab51c8877 | 10 | * |
Kojto | 96:487b796308b0 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
bogdanm | 84:0b3ab51c8877 | 12 | * |
bogdanm | 84:0b3ab51c8877 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 84:0b3ab51c8877 | 14 | * are permitted provided that the following conditions are met: |
bogdanm | 84:0b3ab51c8877 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 84:0b3ab51c8877 | 16 | * this list of conditions and the following disclaimer. |
bogdanm | 84:0b3ab51c8877 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 84:0b3ab51c8877 | 18 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 84:0b3ab51c8877 | 19 | * and/or other materials provided with the distribution. |
bogdanm | 84:0b3ab51c8877 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 84:0b3ab51c8877 | 21 | * may be used to endorse or promote products derived from this software |
bogdanm | 84:0b3ab51c8877 | 22 | * without specific prior written permission. |
bogdanm | 84:0b3ab51c8877 | 23 | * |
bogdanm | 84:0b3ab51c8877 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 84:0b3ab51c8877 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 84:0b3ab51c8877 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 84:0b3ab51c8877 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 84:0b3ab51c8877 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 84:0b3ab51c8877 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 84:0b3ab51c8877 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 84:0b3ab51c8877 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 84:0b3ab51c8877 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 84:0b3ab51c8877 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 84:0b3ab51c8877 | 34 | * |
bogdanm | 84:0b3ab51c8877 | 35 | ****************************************************************************** |
bogdanm | 84:0b3ab51c8877 | 36 | */ |
bogdanm | 84:0b3ab51c8877 | 37 | |
bogdanm | 84:0b3ab51c8877 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 39 | #ifndef __STM32L0xx_HAL_I2C_EX_H |
bogdanm | 84:0b3ab51c8877 | 40 | #define __STM32L0xx_HAL_I2C_EX_H |
bogdanm | 84:0b3ab51c8877 | 41 | |
bogdanm | 84:0b3ab51c8877 | 42 | #ifdef __cplusplus |
bogdanm | 84:0b3ab51c8877 | 43 | extern "C" { |
bogdanm | 84:0b3ab51c8877 | 44 | #endif |
bogdanm | 84:0b3ab51c8877 | 45 | |
bogdanm | 84:0b3ab51c8877 | 46 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 47 | #include "stm32l0xx_hal_def.h" |
bogdanm | 84:0b3ab51c8877 | 48 | |
bogdanm | 84:0b3ab51c8877 | 49 | /** @addtogroup STM32L0xx_HAL_Driver |
bogdanm | 84:0b3ab51c8877 | 50 | * @{ |
bogdanm | 84:0b3ab51c8877 | 51 | */ |
bogdanm | 84:0b3ab51c8877 | 52 | |
bogdanm | 84:0b3ab51c8877 | 53 | /** @addtogroup I2CEx |
bogdanm | 84:0b3ab51c8877 | 54 | * @{ |
bogdanm | 84:0b3ab51c8877 | 55 | */ |
bogdanm | 84:0b3ab51c8877 | 56 | |
bogdanm | 84:0b3ab51c8877 | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 58 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 59 | |
bogdanm | 84:0b3ab51c8877 | 60 | /** @defgroup I2CEx_Exported_Constants |
bogdanm | 84:0b3ab51c8877 | 61 | * @{ |
bogdanm | 84:0b3ab51c8877 | 62 | */ |
bogdanm | 84:0b3ab51c8877 | 63 | |
bogdanm | 84:0b3ab51c8877 | 64 | /** @defgroup I2CEx_Analog_Filter |
bogdanm | 84:0b3ab51c8877 | 65 | * @{ |
bogdanm | 84:0b3ab51c8877 | 66 | */ |
Kojto | 96:487b796308b0 | 67 | #define I2C_ANALOGFILTER_ENABLE ((uint32_t)0x00000000) |
Kojto | 96:487b796308b0 | 68 | #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF |
bogdanm | 84:0b3ab51c8877 | 69 | /** |
bogdanm | 84:0b3ab51c8877 | 70 | * @} |
bogdanm | 84:0b3ab51c8877 | 71 | */ |
bogdanm | 84:0b3ab51c8877 | 72 | |
Kojto | 96:487b796308b0 | 73 | /** @defgroup I2CEx_FastModePlus |
bogdanm | 84:0b3ab51c8877 | 74 | * @{ |
bogdanm | 84:0b3ab51c8877 | 75 | */ |
Kojto | 96:487b796308b0 | 76 | #define I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR2_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ |
Kojto | 96:487b796308b0 | 77 | #define I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR2_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ |
Kojto | 96:487b796308b0 | 78 | #define I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR2_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ |
Kojto | 96:487b796308b0 | 79 | #define I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR2_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ |
Kojto | 96:487b796308b0 | 80 | #define I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR2_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ |
Kojto | 96:487b796308b0 | 81 | #if !defined(STM32L031xx) && !defined(STM32L041xx) |
Kojto | 96:487b796308b0 | 82 | #define I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR2_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ |
Kojto | 96:487b796308b0 | 83 | #endif |
Kojto | 96:487b796308b0 | 84 | #if defined(STM32L071xx) || defined(STM32L072xx) || defined(STM32L073xx) || defined(STM32L081xx) || defined(STM32L082xx) || defined(STM32L083xx) |
Kojto | 96:487b796308b0 | 85 | #define I2C_FASTMODEPLUS_I2C3 SYSCFG_CFGR2_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ |
Kojto | 96:487b796308b0 | 86 | #endif |
bogdanm | 84:0b3ab51c8877 | 87 | /** |
bogdanm | 84:0b3ab51c8877 | 88 | * @} |
bogdanm | 84:0b3ab51c8877 | 89 | */ |
bogdanm | 84:0b3ab51c8877 | 90 | |
bogdanm | 84:0b3ab51c8877 | 91 | /** |
bogdanm | 84:0b3ab51c8877 | 92 | * @} |
bogdanm | 84:0b3ab51c8877 | 93 | */ |
bogdanm | 84:0b3ab51c8877 | 94 | |
bogdanm | 84:0b3ab51c8877 | 95 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 96 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 97 | |
bogdanm | 84:0b3ab51c8877 | 98 | /* Peripheral Control methods ************************************************/ |
Kojto | 96:487b796308b0 | 99 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter); |
Kojto | 96:487b796308b0 | 100 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter); |
Kojto | 96:487b796308b0 | 101 | HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c); |
Kojto | 96:487b796308b0 | 102 | HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c); |
Kojto | 96:487b796308b0 | 103 | void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); |
Kojto | 96:487b796308b0 | 104 | void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); |
Kojto | 96:487b796308b0 | 105 | |
Kojto | 96:487b796308b0 | 106 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 107 | /** @defgroup I2C_Private_Constants I2C Private Constants |
Kojto | 96:487b796308b0 | 108 | * @{ |
Kojto | 96:487b796308b0 | 109 | */ |
bogdanm | 84:0b3ab51c8877 | 110 | |
bogdanm | 84:0b3ab51c8877 | 111 | /** |
bogdanm | 84:0b3ab51c8877 | 112 | * @} |
bogdanm | 84:0b3ab51c8877 | 113 | */ |
bogdanm | 84:0b3ab51c8877 | 114 | |
Kojto | 96:487b796308b0 | 115 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 116 | /** @defgroup I2C_Private_Macro I2C Private Macros |
Kojto | 96:487b796308b0 | 117 | * @{ |
Kojto | 96:487b796308b0 | 118 | */ |
Kojto | 96:487b796308b0 | 119 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \ |
Kojto | 96:487b796308b0 | 120 | ((FILTER) == I2C_ANALOGFILTER_DISABLE)) |
Kojto | 96:487b796308b0 | 121 | |
Kojto | 96:487b796308b0 | 122 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000F) |
Kojto | 96:487b796308b0 | 123 | |
Kojto | 96:487b796308b0 | 124 | #if defined(STM32L031xx) || defined(STM32L041xx) |
Kojto | 96:487b796308b0 | 125 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \ |
Kojto | 96:487b796308b0 | 126 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \ |
Kojto | 96:487b796308b0 | 127 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \ |
Kojto | 96:487b796308b0 | 128 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \ |
Kojto | 96:487b796308b0 | 129 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1)) |
Kojto | 96:487b796308b0 | 130 | #elif defined(STM32L071xx) || defined(STM32L072xx) || defined(STM32L073xx) || defined(STM32L081xx) || defined(STM32L082xx) || defined(STM32L083xx) |
Kojto | 96:487b796308b0 | 131 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \ |
Kojto | 96:487b796308b0 | 132 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \ |
Kojto | 96:487b796308b0 | 133 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \ |
Kojto | 96:487b796308b0 | 134 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \ |
Kojto | 96:487b796308b0 | 135 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \ |
Kojto | 96:487b796308b0 | 136 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2) || \ |
Kojto | 96:487b796308b0 | 137 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3)) |
Kojto | 96:487b796308b0 | 138 | #else |
Kojto | 96:487b796308b0 | 139 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \ |
Kojto | 96:487b796308b0 | 140 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \ |
Kojto | 96:487b796308b0 | 141 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \ |
Kojto | 96:487b796308b0 | 142 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \ |
Kojto | 96:487b796308b0 | 143 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \ |
Kojto | 96:487b796308b0 | 144 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2)) |
Kojto | 96:487b796308b0 | 145 | #endif |
Kojto | 96:487b796308b0 | 146 | /** |
Kojto | 96:487b796308b0 | 147 | * @} |
Kojto | 96:487b796308b0 | 148 | */ |
Kojto | 96:487b796308b0 | 149 | |
Kojto | 96:487b796308b0 | 150 | /* Private Fonctions ---------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 151 | /** @defgroup I2C_Private_Functions I2C Private Functions |
Kojto | 96:487b796308b0 | 152 | * @{ |
Kojto | 96:487b796308b0 | 153 | */ |
Kojto | 96:487b796308b0 | 154 | /* Private functions are defined in stm32l0xx_hal_i2c_ex.c file */ |
bogdanm | 84:0b3ab51c8877 | 155 | /** |
bogdanm | 84:0b3ab51c8877 | 156 | * @} |
bogdanm | 84:0b3ab51c8877 | 157 | */ |
bogdanm | 84:0b3ab51c8877 | 158 | |
Kojto | 96:487b796308b0 | 159 | /** |
Kojto | 96:487b796308b0 | 160 | * @} |
Kojto | 96:487b796308b0 | 161 | */ |
Kojto | 96:487b796308b0 | 162 | |
Kojto | 96:487b796308b0 | 163 | /** |
Kojto | 96:487b796308b0 | 164 | * @} |
Kojto | 96:487b796308b0 | 165 | */ |
Kojto | 96:487b796308b0 | 166 | |
bogdanm | 84:0b3ab51c8877 | 167 | #ifdef __cplusplus |
bogdanm | 84:0b3ab51c8877 | 168 | } |
bogdanm | 84:0b3ab51c8877 | 169 | #endif |
bogdanm | 84:0b3ab51c8877 | 170 | |
bogdanm | 84:0b3ab51c8877 | 171 | #endif /* __STM32L0xx_HAL_I2C_EX_H */ |
bogdanm | 84:0b3ab51c8877 | 172 | |
bogdanm | 84:0b3ab51c8877 | 173 | |
bogdanm | 84:0b3ab51c8877 | 174 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Kojto | 96:487b796308b0 | 175 |