mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Jul 02 16:30:08 2015 +0100
Revision:
581:39197bcd20f2
Parent:
532:fe11edbda85c
Child:
613:bc40b8d2aec4
Synchronized with git revision ae2d3cdffe70184eb8736d94f76c45c93f4b7724

Full URL: https://github.com/mbedmicro/mbed/commit/ae2d3cdffe70184eb8736d94f76c45c93f4b7724/

Make it possible to build the core mbed library with yotta

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 235:685d5f11838f 1 /**
mbed_official 235:685d5f11838f 2 ******************************************************************************
mbed_official 235:685d5f11838f 3 * @file stm32f4xx_hal_i2c.h
mbed_official 235:685d5f11838f 4 * @author MCD Application Team
mbed_official 532:fe11edbda85c 5 * @version V1.3.0
mbed_official 532:fe11edbda85c 6 * @date 09-March-2015
mbed_official 235:685d5f11838f 7 * @brief Header file of I2C HAL module.
mbed_official 235:685d5f11838f 8 ******************************************************************************
mbed_official 235:685d5f11838f 9 * @attention
mbed_official 235:685d5f11838f 10 *
mbed_official 532:fe11edbda85c 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 235:685d5f11838f 12 *
mbed_official 235:685d5f11838f 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 235:685d5f11838f 14 * are permitted provided that the following conditions are met:
mbed_official 235:685d5f11838f 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 235:685d5f11838f 16 * this list of conditions and the following disclaimer.
mbed_official 235:685d5f11838f 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 235:685d5f11838f 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 235:685d5f11838f 19 * and/or other materials provided with the distribution.
mbed_official 235:685d5f11838f 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 235:685d5f11838f 21 * may be used to endorse or promote products derived from this software
mbed_official 235:685d5f11838f 22 * without specific prior written permission.
mbed_official 235:685d5f11838f 23 *
mbed_official 235:685d5f11838f 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 235:685d5f11838f 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 235:685d5f11838f 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 235:685d5f11838f 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 235:685d5f11838f 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 235:685d5f11838f 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 235:685d5f11838f 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 235:685d5f11838f 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 235:685d5f11838f 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 235:685d5f11838f 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 235:685d5f11838f 34 *
mbed_official 235:685d5f11838f 35 ******************************************************************************
mbed_official 235:685d5f11838f 36 */
mbed_official 235:685d5f11838f 37
mbed_official 235:685d5f11838f 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 235:685d5f11838f 39 #ifndef __STM32F4xx_HAL_I2C_H
mbed_official 235:685d5f11838f 40 #define __STM32F4xx_HAL_I2C_H
mbed_official 235:685d5f11838f 41
mbed_official 235:685d5f11838f 42 #ifdef __cplusplus
mbed_official 235:685d5f11838f 43 extern "C" {
mbed_official 235:685d5f11838f 44 #endif
mbed_official 235:685d5f11838f 45
mbed_official 235:685d5f11838f 46 /* Includes ------------------------------------------------------------------*/
mbed_official 235:685d5f11838f 47 #include "stm32f4xx_hal_def.h"
mbed_official 235:685d5f11838f 48
mbed_official 235:685d5f11838f 49 /** @addtogroup STM32F4xx_HAL_Driver
mbed_official 235:685d5f11838f 50 * @{
mbed_official 235:685d5f11838f 51 */
mbed_official 235:685d5f11838f 52
mbed_official 235:685d5f11838f 53 /** @addtogroup I2C
mbed_official 235:685d5f11838f 54 * @{
mbed_official 235:685d5f11838f 55 */
mbed_official 235:685d5f11838f 56
mbed_official 235:685d5f11838f 57 /* Exported types ------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 58 /** @defgroup I2C_Exported_Types I2C Exported Types
mbed_official 532:fe11edbda85c 59 * @{
mbed_official 532:fe11edbda85c 60 */
mbed_official 532:fe11edbda85c 61
mbed_official 235:685d5f11838f 62 /**
mbed_official 235:685d5f11838f 63 * @brief I2C Configuration Structure definition
mbed_official 235:685d5f11838f 64 */
mbed_official 235:685d5f11838f 65 typedef struct
mbed_official 235:685d5f11838f 66 {
mbed_official 235:685d5f11838f 67 uint32_t ClockSpeed; /*!< Specifies the clock frequency.
mbed_official 235:685d5f11838f 68 This parameter must be set to a value lower than 400kHz */
mbed_official 235:685d5f11838f 69
mbed_official 235:685d5f11838f 70 uint32_t DutyCycle; /*!< Specifies the I2C fast mode duty cycle.
mbed_official 235:685d5f11838f 71 This parameter can be a value of @ref I2C_duty_cycle_in_fast_mode */
mbed_official 235:685d5f11838f 72
mbed_official 235:685d5f11838f 73 uint32_t OwnAddress1; /*!< Specifies the first device own address.
mbed_official 235:685d5f11838f 74 This parameter can be a 7-bit or 10-bit address. */
mbed_official 235:685d5f11838f 75
mbed_official 235:685d5f11838f 76 uint32_t AddressingMode; /*!< Specifies if 7-bit or 10-bit addressing mode is selected.
mbed_official 235:685d5f11838f 77 This parameter can be a value of @ref I2C_addressing_mode */
mbed_official 235:685d5f11838f 78
mbed_official 235:685d5f11838f 79 uint32_t DualAddressMode; /*!< Specifies if dual addressing mode is selected.
mbed_official 235:685d5f11838f 80 This parameter can be a value of @ref I2C_dual_addressing_mode */
mbed_official 235:685d5f11838f 81
mbed_official 235:685d5f11838f 82 uint32_t OwnAddress2; /*!< Specifies the second device own address if dual addressing mode is selected
mbed_official 235:685d5f11838f 83 This parameter can be a 7-bit address. */
mbed_official 235:685d5f11838f 84
mbed_official 235:685d5f11838f 85 uint32_t GeneralCallMode; /*!< Specifies if general call mode is selected.
mbed_official 235:685d5f11838f 86 This parameter can be a value of @ref I2C_general_call_addressing_mode */
mbed_official 235:685d5f11838f 87
mbed_official 235:685d5f11838f 88 uint32_t NoStretchMode; /*!< Specifies if nostretch mode is selected.
mbed_official 235:685d5f11838f 89 This parameter can be a value of @ref I2C_nostretch_mode */
mbed_official 235:685d5f11838f 90
mbed_official 235:685d5f11838f 91 }I2C_InitTypeDef;
mbed_official 235:685d5f11838f 92
mbed_official 235:685d5f11838f 93 /**
mbed_official 235:685d5f11838f 94 * @brief HAL State structures definition
mbed_official 235:685d5f11838f 95 */
mbed_official 235:685d5f11838f 96 typedef enum
mbed_official 235:685d5f11838f 97 {
mbed_official 235:685d5f11838f 98 HAL_I2C_STATE_RESET = 0x00, /*!< I2C not yet initialized or disabled */
mbed_official 235:685d5f11838f 99 HAL_I2C_STATE_READY = 0x01, /*!< I2C initialized and ready for use */
mbed_official 235:685d5f11838f 100 HAL_I2C_STATE_BUSY = 0x02, /*!< I2C internal process is ongoing */
mbed_official 235:685d5f11838f 101 HAL_I2C_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
mbed_official 235:685d5f11838f 102 HAL_I2C_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
mbed_official 235:685d5f11838f 103 HAL_I2C_STATE_MEM_BUSY_TX = 0x32, /*!< Memory Data Transmission process is ongoing */
mbed_official 235:685d5f11838f 104 HAL_I2C_STATE_MEM_BUSY_RX = 0x42, /*!< Memory Data Reception process is ongoing */
mbed_official 235:685d5f11838f 105 HAL_I2C_STATE_TIMEOUT = 0x03, /*!< I2C timeout state */
mbed_official 235:685d5f11838f 106 HAL_I2C_STATE_ERROR = 0x04 /*!< I2C error state */
mbed_official 235:685d5f11838f 107
mbed_official 235:685d5f11838f 108 }HAL_I2C_StateTypeDef;
mbed_official 235:685d5f11838f 109
mbed_official 235:685d5f11838f 110 /**
mbed_official 235:685d5f11838f 111 * @brief I2C handle Structure definition
mbed_official 235:685d5f11838f 112 */
mbed_official 235:685d5f11838f 113 typedef struct
mbed_official 235:685d5f11838f 114 {
mbed_official 235:685d5f11838f 115 I2C_TypeDef *Instance; /*!< I2C registers base address */
mbed_official 235:685d5f11838f 116
mbed_official 235:685d5f11838f 117 I2C_InitTypeDef Init; /*!< I2C communication parameters */
mbed_official 235:685d5f11838f 118
mbed_official 235:685d5f11838f 119 uint8_t *pBuffPtr; /*!< Pointer to I2C transfer buffer */
mbed_official 235:685d5f11838f 120
mbed_official 235:685d5f11838f 121 uint16_t XferSize; /*!< I2C transfer size */
mbed_official 235:685d5f11838f 122
mbed_official 235:685d5f11838f 123 __IO uint16_t XferCount; /*!< I2C transfer counter */
mbed_official 235:685d5f11838f 124
mbed_official 235:685d5f11838f 125 DMA_HandleTypeDef *hdmatx; /*!< I2C Tx DMA handle parameters */
mbed_official 235:685d5f11838f 126
mbed_official 235:685d5f11838f 127 DMA_HandleTypeDef *hdmarx; /*!< I2C Rx DMA handle parameters */
mbed_official 235:685d5f11838f 128
mbed_official 235:685d5f11838f 129 HAL_LockTypeDef Lock; /*!< I2C locking object */
mbed_official 235:685d5f11838f 130
mbed_official 235:685d5f11838f 131 __IO HAL_I2C_StateTypeDef State; /*!< I2C communication state */
mbed_official 235:685d5f11838f 132
mbed_official 532:fe11edbda85c 133 __IO uint32_t ErrorCode; /*!< I2C Error code */
mbed_official 235:685d5f11838f 134
mbed_official 235:685d5f11838f 135 }I2C_HandleTypeDef;
mbed_official 532:fe11edbda85c 136 /**
mbed_official 532:fe11edbda85c 137 * @}
mbed_official 532:fe11edbda85c 138 */
mbed_official 235:685d5f11838f 139
mbed_official 235:685d5f11838f 140 /* Exported constants --------------------------------------------------------*/
mbed_official 532:fe11edbda85c 141 /** @defgroup I2C_Exported_Constants I2C Exported Constants
mbed_official 235:685d5f11838f 142 * @{
mbed_official 235:685d5f11838f 143 */
mbed_official 235:685d5f11838f 144
mbed_official 532:fe11edbda85c 145 /** @defgroup I2C_Error_Code I2C Error Code
mbed_official 532:fe11edbda85c 146 * @brief I2C Error Code
mbed_official 532:fe11edbda85c 147 * @{
mbed_official 532:fe11edbda85c 148 */
mbed_official 532:fe11edbda85c 149 #define HAL_I2C_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
mbed_official 532:fe11edbda85c 150 #define HAL_I2C_ERROR_BERR ((uint32_t)0x00000001) /*!< BERR error */
mbed_official 532:fe11edbda85c 151 #define HAL_I2C_ERROR_ARLO ((uint32_t)0x00000002) /*!< ARLO error */
mbed_official 532:fe11edbda85c 152 #define HAL_I2C_ERROR_AF ((uint32_t)0x00000004) /*!< AF error */
mbed_official 532:fe11edbda85c 153 #define HAL_I2C_ERROR_OVR ((uint32_t)0x00000008) /*!< OVR error */
mbed_official 532:fe11edbda85c 154 #define HAL_I2C_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
mbed_official 532:fe11edbda85c 155 #define HAL_I2C_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout Error */
mbed_official 532:fe11edbda85c 156 /**
mbed_official 532:fe11edbda85c 157 * @}
mbed_official 532:fe11edbda85c 158 */
mbed_official 532:fe11edbda85c 159
mbed_official 532:fe11edbda85c 160 /** @defgroup I2C_duty_cycle_in_fast_mode I2C duty cycle in fast mode
mbed_official 235:685d5f11838f 161 * @{
mbed_official 235:685d5f11838f 162 */
mbed_official 235:685d5f11838f 163 #define I2C_DUTYCYCLE_2 ((uint32_t)0x00000000)
mbed_official 235:685d5f11838f 164 #define I2C_DUTYCYCLE_16_9 I2C_CCR_DUTY
mbed_official 235:685d5f11838f 165 /**
mbed_official 235:685d5f11838f 166 * @}
mbed_official 235:685d5f11838f 167 */
mbed_official 235:685d5f11838f 168
mbed_official 532:fe11edbda85c 169 /** @defgroup I2C_addressing_mode I2C addressing mode
mbed_official 235:685d5f11838f 170 * @{
mbed_official 235:685d5f11838f 171 */
mbed_official 532:fe11edbda85c 172 #define I2C_ADDRESSINGMODE_7BIT ((uint32_t)0x00004000)
mbed_official 532:fe11edbda85c 173 #define I2C_ADDRESSINGMODE_10BIT (I2C_OAR1_ADDMODE | ((uint32_t)0x00004000))
mbed_official 235:685d5f11838f 174 /**
mbed_official 235:685d5f11838f 175 * @}
mbed_official 235:685d5f11838f 176 */
mbed_official 235:685d5f11838f 177
mbed_official 532:fe11edbda85c 178 /** @defgroup I2C_dual_addressing_mode I2C dual addressing mode
mbed_official 235:685d5f11838f 179 * @{
mbed_official 235:685d5f11838f 180 */
mbed_official 532:fe11edbda85c 181 #define I2C_DUALADDRESS_DISABLE ((uint32_t)0x00000000)
mbed_official 532:fe11edbda85c 182 #define I2C_DUALADDRESS_ENABLE I2C_OAR2_ENDUAL
mbed_official 235:685d5f11838f 183 /**
mbed_official 235:685d5f11838f 184 * @}
mbed_official 235:685d5f11838f 185 */
mbed_official 235:685d5f11838f 186
mbed_official 532:fe11edbda85c 187 /** @defgroup I2C_general_call_addressing_mode I2C general call addressing mode
mbed_official 235:685d5f11838f 188 * @{
mbed_official 235:685d5f11838f 189 */
mbed_official 532:fe11edbda85c 190 #define I2C_GENERALCALL_DISABLE ((uint32_t)0x00000000)
mbed_official 532:fe11edbda85c 191 #define I2C_GENERALCALL_ENABLE I2C_CR1_ENGC
mbed_official 235:685d5f11838f 192 /**
mbed_official 235:685d5f11838f 193 * @}
mbed_official 235:685d5f11838f 194 */
mbed_official 235:685d5f11838f 195
mbed_official 532:fe11edbda85c 196 /** @defgroup I2C_nostretch_mode I2C nostretch mode
mbed_official 532:fe11edbda85c 197 * @{
mbed_official 532:fe11edbda85c 198 */
mbed_official 532:fe11edbda85c 199 #define I2C_NOSTRETCH_DISABLE ((uint32_t)0x00000000)
mbed_official 532:fe11edbda85c 200 #define I2C_NOSTRETCH_ENABLE I2C_CR1_NOSTRETCH
mbed_official 532:fe11edbda85c 201 /**
mbed_official 532:fe11edbda85c 202 * @}
mbed_official 532:fe11edbda85c 203 */
mbed_official 532:fe11edbda85c 204
mbed_official 532:fe11edbda85c 205 /** @defgroup I2C_Memory_Address_Size I2C Memory Address Size
mbed_official 235:685d5f11838f 206 * @{
mbed_official 235:685d5f11838f 207 */
mbed_official 235:685d5f11838f 208 #define I2C_MEMADD_SIZE_8BIT ((uint32_t)0x00000001)
mbed_official 235:685d5f11838f 209 #define I2C_MEMADD_SIZE_16BIT ((uint32_t)0x00000010)
mbed_official 235:685d5f11838f 210 /**
mbed_official 235:685d5f11838f 211 * @}
mbed_official 235:685d5f11838f 212 */
mbed_official 235:685d5f11838f 213
mbed_official 532:fe11edbda85c 214 /** @defgroup I2C_Interrupt_configuration_definition I2C Interrupt configuration definition
mbed_official 235:685d5f11838f 215 * @{
mbed_official 235:685d5f11838f 216 */
mbed_official 235:685d5f11838f 217 #define I2C_IT_BUF I2C_CR2_ITBUFEN
mbed_official 235:685d5f11838f 218 #define I2C_IT_EVT I2C_CR2_ITEVTEN
mbed_official 235:685d5f11838f 219 #define I2C_IT_ERR I2C_CR2_ITERREN
mbed_official 235:685d5f11838f 220 /**
mbed_official 235:685d5f11838f 221 * @}
mbed_official 235:685d5f11838f 222 */
mbed_official 235:685d5f11838f 223
mbed_official 532:fe11edbda85c 224 /** @defgroup I2C_Flag_definition I2C Flag definition
mbed_official 235:685d5f11838f 225 * @{
mbed_official 235:685d5f11838f 226 */
mbed_official 235:685d5f11838f 227 #define I2C_FLAG_SMBALERT ((uint32_t)0x00018000)
mbed_official 235:685d5f11838f 228 #define I2C_FLAG_TIMEOUT ((uint32_t)0x00014000)
mbed_official 235:685d5f11838f 229 #define I2C_FLAG_PECERR ((uint32_t)0x00011000)
mbed_official 235:685d5f11838f 230 #define I2C_FLAG_OVR ((uint32_t)0x00010800)
mbed_official 235:685d5f11838f 231 #define I2C_FLAG_AF ((uint32_t)0x00010400)
mbed_official 235:685d5f11838f 232 #define I2C_FLAG_ARLO ((uint32_t)0x00010200)
mbed_official 235:685d5f11838f 233 #define I2C_FLAG_BERR ((uint32_t)0x00010100)
mbed_official 235:685d5f11838f 234 #define I2C_FLAG_TXE ((uint32_t)0x00010080)
mbed_official 235:685d5f11838f 235 #define I2C_FLAG_RXNE ((uint32_t)0x00010040)
mbed_official 235:685d5f11838f 236 #define I2C_FLAG_STOPF ((uint32_t)0x00010010)
mbed_official 235:685d5f11838f 237 #define I2C_FLAG_ADD10 ((uint32_t)0x00010008)
mbed_official 235:685d5f11838f 238 #define I2C_FLAG_BTF ((uint32_t)0x00010004)
mbed_official 235:685d5f11838f 239 #define I2C_FLAG_ADDR ((uint32_t)0x00010002)
mbed_official 235:685d5f11838f 240 #define I2C_FLAG_SB ((uint32_t)0x00010001)
mbed_official 235:685d5f11838f 241 #define I2C_FLAG_DUALF ((uint32_t)0x00100080)
mbed_official 235:685d5f11838f 242 #define I2C_FLAG_SMBHOST ((uint32_t)0x00100040)
mbed_official 235:685d5f11838f 243 #define I2C_FLAG_SMBDEFAULT ((uint32_t)0x00100020)
mbed_official 235:685d5f11838f 244 #define I2C_FLAG_GENCALL ((uint32_t)0x00100010)
mbed_official 235:685d5f11838f 245 #define I2C_FLAG_TRA ((uint32_t)0x00100004)
mbed_official 235:685d5f11838f 246 #define I2C_FLAG_BUSY ((uint32_t)0x00100002)
mbed_official 235:685d5f11838f 247 #define I2C_FLAG_MSL ((uint32_t)0x00100001)
mbed_official 235:685d5f11838f 248 /**
mbed_official 235:685d5f11838f 249 * @}
mbed_official 235:685d5f11838f 250 */
mbed_official 235:685d5f11838f 251
mbed_official 235:685d5f11838f 252 /**
mbed_official 235:685d5f11838f 253 * @}
mbed_official 235:685d5f11838f 254 */
mbed_official 235:685d5f11838f 255
mbed_official 235:685d5f11838f 256 /* Exported macro ------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 257 /** @defgroup I2C_Exported_Macros I2C Exported Macros
mbed_official 532:fe11edbda85c 258 * @{
mbed_official 532:fe11edbda85c 259 */
mbed_official 235:685d5f11838f 260
mbed_official 235:685d5f11838f 261 /** @brief Reset I2C handle state
mbed_official 235:685d5f11838f 262 * @param __HANDLE__: specifies the I2C Handle.
mbed_official 235:685d5f11838f 263 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
mbed_official 235:685d5f11838f 264 * @retval None
mbed_official 235:685d5f11838f 265 */
mbed_official 235:685d5f11838f 266 #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2C_STATE_RESET)
mbed_official 235:685d5f11838f 267
mbed_official 235:685d5f11838f 268 /** @brief Enable or disable the specified I2C interrupts.
mbed_official 235:685d5f11838f 269 * @param __HANDLE__: specifies the I2C Handle.
mbed_official 235:685d5f11838f 270 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
mbed_official 235:685d5f11838f 271 * @param __INTERRUPT__: specifies the interrupt source to enable or disable.
mbed_official 235:685d5f11838f 272 * This parameter can be one of the following values:
mbed_official 235:685d5f11838f 273 * @arg I2C_IT_BUF: Buffer interrupt enable
mbed_official 235:685d5f11838f 274 * @arg I2C_IT_EVT: Event interrupt enable
mbed_official 235:685d5f11838f 275 * @arg I2C_IT_ERR: Error interrupt enable
mbed_official 235:685d5f11838f 276 * @retval None
mbed_official 235:685d5f11838f 277 */
mbed_official 235:685d5f11838f 278 #define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
mbed_official 235:685d5f11838f 279 #define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
mbed_official 235:685d5f11838f 280
mbed_official 235:685d5f11838f 281 /** @brief Checks if the specified I2C interrupt source is enabled or disabled.
mbed_official 235:685d5f11838f 282 * @param __HANDLE__: specifies the I2C Handle.
mbed_official 235:685d5f11838f 283 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
mbed_official 235:685d5f11838f 284 * @param __INTERRUPT__: specifies the I2C interrupt source to check.
mbed_official 235:685d5f11838f 285 * This parameter can be one of the following values:
mbed_official 235:685d5f11838f 286 * @arg I2C_IT_BUF: Buffer interrupt enable
mbed_official 235:685d5f11838f 287 * @arg I2C_IT_EVT: Event interrupt enable
mbed_official 235:685d5f11838f 288 * @arg I2C_IT_ERR: Error interrupt enable
mbed_official 235:685d5f11838f 289 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
mbed_official 235:685d5f11838f 290 */
mbed_official 235:685d5f11838f 291 #define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
mbed_official 235:685d5f11838f 292
mbed_official 235:685d5f11838f 293 /** @brief Checks whether the specified I2C flag is set or not.
mbed_official 235:685d5f11838f 294 * @param __HANDLE__: specifies the I2C Handle.
mbed_official 235:685d5f11838f 295 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
mbed_official 235:685d5f11838f 296 * @param __FLAG__: specifies the flag to check.
mbed_official 235:685d5f11838f 297 * This parameter can be one of the following values:
mbed_official 235:685d5f11838f 298 * @arg I2C_FLAG_SMBALERT: SMBus Alert flag
mbed_official 235:685d5f11838f 299 * @arg I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
mbed_official 235:685d5f11838f 300 * @arg I2C_FLAG_PECERR: PEC error in reception flag
mbed_official 235:685d5f11838f 301 * @arg I2C_FLAG_OVR: Overrun/Underrun flag
mbed_official 235:685d5f11838f 302 * @arg I2C_FLAG_AF: Acknowledge failure flag
mbed_official 235:685d5f11838f 303 * @arg I2C_FLAG_ARLO: Arbitration lost flag
mbed_official 235:685d5f11838f 304 * @arg I2C_FLAG_BERR: Bus error flag
mbed_official 235:685d5f11838f 305 * @arg I2C_FLAG_TXE: Data register empty flag
mbed_official 235:685d5f11838f 306 * @arg I2C_FLAG_RXNE: Data register not empty flag
mbed_official 235:685d5f11838f 307 * @arg I2C_FLAG_STOPF: Stop detection flag
mbed_official 235:685d5f11838f 308 * @arg I2C_FLAG_ADD10: 10-bit header sent flag
mbed_official 235:685d5f11838f 309 * @arg I2C_FLAG_BTF: Byte transfer finished flag
mbed_official 235:685d5f11838f 310 * @arg I2C_FLAG_ADDR: Address sent flag
mbed_official 235:685d5f11838f 311 * Address matched flag
mbed_official 235:685d5f11838f 312 * @arg I2C_FLAG_SB: Start bit flag
mbed_official 235:685d5f11838f 313 * @arg I2C_FLAG_DUALF: Dual flag
mbed_official 235:685d5f11838f 314 * @arg I2C_FLAG_SMBHOST: SMBus host header
mbed_official 235:685d5f11838f 315 * @arg I2C_FLAG_SMBDEFAULT: SMBus default header
mbed_official 235:685d5f11838f 316 * @arg I2C_FLAG_GENCALL: General call header flag
mbed_official 235:685d5f11838f 317 * @arg I2C_FLAG_TRA: Transmitter/Receiver flag
mbed_official 235:685d5f11838f 318 * @arg I2C_FLAG_BUSY: Bus busy flag
mbed_official 235:685d5f11838f 319 * @arg I2C_FLAG_MSL: Master/Slave flag
mbed_official 235:685d5f11838f 320 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 235:685d5f11838f 321 */
mbed_official 235:685d5f11838f 322 #define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__) ((((uint8_t)((__FLAG__) >> 16)) == 0x01)?((((__HANDLE__)->Instance->SR1) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)): \
mbed_official 235:685d5f11838f 323 ((((__HANDLE__)->Instance->SR2) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)))
mbed_official 235:685d5f11838f 324
mbed_official 235:685d5f11838f 325 /** @brief Clears the I2C pending flags which are cleared by writing 0 in a specific bit.
mbed_official 235:685d5f11838f 326 * @param __HANDLE__: specifies the I2C Handle.
mbed_official 235:685d5f11838f 327 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
mbed_official 235:685d5f11838f 328 * @param __FLAG__: specifies the flag to clear.
mbed_official 235:685d5f11838f 329 * This parameter can be any combination of the following values:
mbed_official 235:685d5f11838f 330 * @arg I2C_FLAG_SMBALERT: SMBus Alert flag
mbed_official 235:685d5f11838f 331 * @arg I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
mbed_official 235:685d5f11838f 332 * @arg I2C_FLAG_PECERR: PEC error in reception flag
mbed_official 235:685d5f11838f 333 * @arg I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
mbed_official 235:685d5f11838f 334 * @arg I2C_FLAG_AF: Acknowledge failure flag
mbed_official 235:685d5f11838f 335 * @arg I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
mbed_official 235:685d5f11838f 336 * @arg I2C_FLAG_BERR: Bus error flag
mbed_official 235:685d5f11838f 337 * @retval None
mbed_official 235:685d5f11838f 338 */
mbed_official 235:685d5f11838f 339 #define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR1 = ~((__FLAG__) & I2C_FLAG_MASK))
mbed_official 235:685d5f11838f 340
mbed_official 235:685d5f11838f 341 /** @brief Clears the I2C ADDR pending flag.
mbed_official 235:685d5f11838f 342 * @param __HANDLE__: specifies the I2C Handle.
mbed_official 235:685d5f11838f 343 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
mbed_official 235:685d5f11838f 344 * @retval None
mbed_official 235:685d5f11838f 345 */
mbed_official 532:fe11edbda85c 346 #define __HAL_I2C_CLEAR_ADDRFLAG(__HANDLE__) \
mbed_official 532:fe11edbda85c 347 do{ \
mbed_official 532:fe11edbda85c 348 __IO uint32_t tmpreg; \
mbed_official 532:fe11edbda85c 349 tmpreg = (__HANDLE__)->Instance->SR1; \
mbed_official 532:fe11edbda85c 350 tmpreg = (__HANDLE__)->Instance->SR2; \
mbed_official 532:fe11edbda85c 351 UNUSED(tmpreg); \
mbed_official 532:fe11edbda85c 352 } while(0)
mbed_official 235:685d5f11838f 353
mbed_official 235:685d5f11838f 354 /** @brief Clears the I2C STOPF pending flag.
mbed_official 235:685d5f11838f 355 * @param __HANDLE__: specifies the I2C Handle.
mbed_official 235:685d5f11838f 356 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
mbed_official 235:685d5f11838f 357 * @retval None
mbed_official 235:685d5f11838f 358 */
mbed_official 532:fe11edbda85c 359 #define __HAL_I2C_CLEAR_STOPFLAG(__HANDLE__) \
mbed_official 532:fe11edbda85c 360 do{ \
mbed_official 532:fe11edbda85c 361 __IO uint32_t tmpreg; \
mbed_official 532:fe11edbda85c 362 tmpreg = (__HANDLE__)->Instance->SR1; \
mbed_official 532:fe11edbda85c 363 (__HANDLE__)->Instance->CR1 |= I2C_CR1_PE; \
mbed_official 532:fe11edbda85c 364 UNUSED(tmpreg); \
mbed_official 532:fe11edbda85c 365 } while(0)
mbed_official 532:fe11edbda85c 366
mbed_official 235:685d5f11838f 367 #define __HAL_I2C_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= I2C_CR1_PE)
mbed_official 235:685d5f11838f 368 #define __HAL_I2C_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~I2C_CR1_PE)
mbed_official 235:685d5f11838f 369
mbed_official 532:fe11edbda85c 370 /**
mbed_official 532:fe11edbda85c 371 * @}
mbed_official 532:fe11edbda85c 372 */
mbed_official 235:685d5f11838f 373
mbed_official 235:685d5f11838f 374 /* Include I2C HAL Extension module */
mbed_official 235:685d5f11838f 375 #include "stm32f4xx_hal_i2c_ex.h"
mbed_official 235:685d5f11838f 376
mbed_official 235:685d5f11838f 377 /* Exported functions --------------------------------------------------------*/
mbed_official 532:fe11edbda85c 378 /** @addtogroup I2C_Exported_Functions
mbed_official 532:fe11edbda85c 379 * @{
mbed_official 532:fe11edbda85c 380 */
mbed_official 532:fe11edbda85c 381
mbed_official 532:fe11edbda85c 382 /** @addtogroup I2C_Exported_Functions_Group1
mbed_official 532:fe11edbda85c 383 * @{
mbed_official 532:fe11edbda85c 384 */
mbed_official 235:685d5f11838f 385 /* Initialization/de-initialization functions **********************************/
mbed_official 235:685d5f11838f 386 HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 387 HAL_StatusTypeDef HAL_I2C_DeInit (I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 388 void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 389 void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c);
mbed_official 532:fe11edbda85c 390 /**
mbed_official 532:fe11edbda85c 391 * @}
mbed_official 532:fe11edbda85c 392 */
mbed_official 235:685d5f11838f 393
mbed_official 532:fe11edbda85c 394 /** @addtogroup I2C_Exported_Functions_Group2
mbed_official 532:fe11edbda85c 395 * @{
mbed_official 532:fe11edbda85c 396 */
mbed_official 235:685d5f11838f 397 /* I/O operation functions *****************************************************/
mbed_official 235:685d5f11838f 398 /******* Blocking mode: Polling */
mbed_official 235:685d5f11838f 399 HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 235:685d5f11838f 400 HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 235:685d5f11838f 401 HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 235:685d5f11838f 402 HAL_StatusTypeDef HAL_I2C_Slave_Receive(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 235:685d5f11838f 403 HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 235:685d5f11838f 404 HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 235:685d5f11838f 405 HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout);
mbed_official 235:685d5f11838f 406
mbed_official 235:685d5f11838f 407 /******* Non-Blocking mode: Interrupt */
mbed_official 235:685d5f11838f 408 HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 409 HAL_StatusTypeDef HAL_I2C_Master_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 410 HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 411 HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 412 HAL_StatusTypeDef HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 413 HAL_StatusTypeDef HAL_I2C_Mem_Read_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 414
mbed_official 235:685d5f11838f 415 /******* Non-Blocking mode: DMA */
mbed_official 235:685d5f11838f 416 HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 417 HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 418 HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 419 HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 420 HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 421 HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
mbed_official 235:685d5f11838f 422
mbed_official 235:685d5f11838f 423 /******* I2C IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */
mbed_official 235:685d5f11838f 424 void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 425 void HAL_I2C_ER_IRQHandler(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 426 void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 427 void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 428 void HAL_I2C_SlaveTxCpltCallback(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 429 void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 430 void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 431 void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);
mbed_official 235:685d5f11838f 432 void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c);
mbed_official 532:fe11edbda85c 433 /**
mbed_official 532:fe11edbda85c 434 * @}
mbed_official 532:fe11edbda85c 435 */
mbed_official 235:685d5f11838f 436
mbed_official 532:fe11edbda85c 437 /** @addtogroup I2C_Exported_Functions_Group3
mbed_official 532:fe11edbda85c 438 * @{
mbed_official 532:fe11edbda85c 439 */
mbed_official 235:685d5f11838f 440 /* Peripheral Control and State functions **************************************/
mbed_official 235:685d5f11838f 441 HAL_I2C_StateTypeDef HAL_I2C_GetState(I2C_HandleTypeDef *hi2c);
mbed_official 532:fe11edbda85c 442 uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c);
mbed_official 532:fe11edbda85c 443
mbed_official 532:fe11edbda85c 444 /**
mbed_official 532:fe11edbda85c 445 * @}
mbed_official 532:fe11edbda85c 446 */
mbed_official 532:fe11edbda85c 447
mbed_official 532:fe11edbda85c 448 /**
mbed_official 532:fe11edbda85c 449 * @}
mbed_official 532:fe11edbda85c 450 */
mbed_official 532:fe11edbda85c 451 /* Private types -------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 452 /* Private variables ---------------------------------------------------------*/
mbed_official 532:fe11edbda85c 453 /* Private constants ---------------------------------------------------------*/
mbed_official 532:fe11edbda85c 454 /** @defgroup I2C_Private_Constants I2C Private Constants
mbed_official 532:fe11edbda85c 455 * @{
mbed_official 532:fe11edbda85c 456 */
mbed_official 532:fe11edbda85c 457 #define I2C_FLAG_MASK ((uint32_t)0x0000FFFF)
mbed_official 532:fe11edbda85c 458 /**
mbed_official 532:fe11edbda85c 459 * @}
mbed_official 532:fe11edbda85c 460 */
mbed_official 532:fe11edbda85c 461
mbed_official 532:fe11edbda85c 462 /* Private macros ------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 463 /** @defgroup I2C_Private_Macros I2C Private Macros
mbed_official 532:fe11edbda85c 464 * @{
mbed_official 532:fe11edbda85c 465 */
mbed_official 532:fe11edbda85c 466
mbed_official 532:fe11edbda85c 467 #define I2C_FREQRANGE(__PCLK__) ((__PCLK__)/1000000)
mbed_official 532:fe11edbda85c 468 #define I2C_RISE_TIME(__FREQRANGE__, __SPEED__) (((__SPEED__) <= 100000) ? ((__FREQRANGE__) + 1) : ((((__FREQRANGE__) * 300) / 1000) + 1))
mbed_official 532:fe11edbda85c 469 #define I2C_SPEED_STANDARD(__PCLK__, __SPEED__) (((((__PCLK__)/((__SPEED__) << 1)) & I2C_CCR_CCR) < 4)? 4:((__PCLK__) / ((__SPEED__) << 1)))
mbed_official 532:fe11edbda85c 470 #define I2C_SPEED_FAST(__PCLK__, __SPEED__, __DUTYCYCLE__) (((__DUTYCYCLE__) == I2C_DUTYCYCLE_2)? ((__PCLK__) / ((__SPEED__) * 3)) : (((__PCLK__) / ((__SPEED__) * 25)) | I2C_DUTYCYCLE_16_9))
mbed_official 532:fe11edbda85c 471 #define I2C_SPEED(__PCLK__, __SPEED__, __DUTYCYCLE__) (((__SPEED__) <= 100000)? (I2C_SPEED_STANDARD((__PCLK__), (__SPEED__))) : \
mbed_official 532:fe11edbda85c 472 ((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__)) & I2C_CCR_CCR) == 0)? 1 : \
mbed_official 532:fe11edbda85c 473 ((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__))) | I2C_CCR_FS))
mbed_official 532:fe11edbda85c 474
mbed_official 532:fe11edbda85c 475 #define I2C_7BIT_ADD_WRITE(__ADDRESS__) ((uint8_t)((__ADDRESS__) & (~I2C_OAR1_ADD0)))
mbed_official 532:fe11edbda85c 476 #define I2C_7BIT_ADD_READ(__ADDRESS__) ((uint8_t)((__ADDRESS__) | I2C_OAR1_ADD0))
mbed_official 532:fe11edbda85c 477
mbed_official 532:fe11edbda85c 478 #define I2C_10BIT_ADDRESS(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF))))
mbed_official 532:fe11edbda85c 479 #define I2C_10BIT_HEADER_WRITE(__ADDRESS__) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF0))))
mbed_official 532:fe11edbda85c 480 #define I2C_10BIT_HEADER_READ(__ADDRESS__) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF1))))
mbed_official 532:fe11edbda85c 481
mbed_official 532:fe11edbda85c 482 #define I2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00))) >> 8)))
mbed_official 532:fe11edbda85c 483 #define I2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF))))
mbed_official 532:fe11edbda85c 484
mbed_official 532:fe11edbda85c 485 /** @defgroup I2C_IS_RTC_Definitions I2C Private macros to check input parameters
mbed_official 532:fe11edbda85c 486 * @{
mbed_official 532:fe11edbda85c 487 */
mbed_official 532:fe11edbda85c 488 #define IS_I2C_DUTY_CYCLE(CYCLE) (((CYCLE) == I2C_DUTYCYCLE_2) || \
mbed_official 532:fe11edbda85c 489 ((CYCLE) == I2C_DUTYCYCLE_16_9))
mbed_official 532:fe11edbda85c 490 #define IS_I2C_ADDRESSING_MODE(ADDRESS) (((ADDRESS) == I2C_ADDRESSINGMODE_7BIT) || \
mbed_official 532:fe11edbda85c 491 ((ADDRESS) == I2C_ADDRESSINGMODE_10BIT))
mbed_official 532:fe11edbda85c 492 #define IS_I2C_DUAL_ADDRESS(ADDRESS) (((ADDRESS) == I2C_DUALADDRESS_DISABLE) || \
mbed_official 532:fe11edbda85c 493 ((ADDRESS) == I2C_DUALADDRESS_ENABLE))
mbed_official 532:fe11edbda85c 494 #define IS_I2C_GENERAL_CALL(CALL) (((CALL) == I2C_GENERALCALL_DISABLE) || \
mbed_official 532:fe11edbda85c 495 ((CALL) == I2C_GENERALCALL_ENABLE))
mbed_official 532:fe11edbda85c 496 #define IS_I2C_NO_STRETCH(STRETCH) (((STRETCH) == I2C_NOSTRETCH_DISABLE) || \
mbed_official 532:fe11edbda85c 497 ((STRETCH) == I2C_NOSTRETCH_ENABLE))
mbed_official 532:fe11edbda85c 498 #define IS_I2C_MEMADD_SIZE(SIZE) (((SIZE) == I2C_MEMADD_SIZE_8BIT) || \
mbed_official 532:fe11edbda85c 499 ((SIZE) == I2C_MEMADD_SIZE_16BIT))
mbed_official 532:fe11edbda85c 500 #define IS_I2C_CLOCK_SPEED(SPEED) (((SPEED) > 0) && ((SPEED) <= 400000))
mbed_official 532:fe11edbda85c 501 #define IS_I2C_OWN_ADDRESS1(ADDRESS1) (((ADDRESS1) & (uint32_t)(0xFFFFFC00)) == 0)
mbed_official 532:fe11edbda85c 502 #define IS_I2C_OWN_ADDRESS2(ADDRESS2) (((ADDRESS2) & (uint32_t)(0xFFFFFF01)) == 0)
mbed_official 532:fe11edbda85c 503 /**
mbed_official 532:fe11edbda85c 504 * @}
mbed_official 532:fe11edbda85c 505 */
mbed_official 532:fe11edbda85c 506
mbed_official 532:fe11edbda85c 507 /**
mbed_official 532:fe11edbda85c 508 * @}
mbed_official 532:fe11edbda85c 509 */
mbed_official 532:fe11edbda85c 510
mbed_official 532:fe11edbda85c 511 /* Private functions ---------------------------------------------------------*/
mbed_official 532:fe11edbda85c 512 /** @defgroup I2C_Private_Functions I2C Private Functions
mbed_official 532:fe11edbda85c 513 * @{
mbed_official 532:fe11edbda85c 514 */
mbed_official 532:fe11edbda85c 515
mbed_official 532:fe11edbda85c 516 /**
mbed_official 532:fe11edbda85c 517 * @}
mbed_official 532:fe11edbda85c 518 */
mbed_official 235:685d5f11838f 519
mbed_official 235:685d5f11838f 520 /**
mbed_official 235:685d5f11838f 521 * @}
mbed_official 235:685d5f11838f 522 */
mbed_official 235:685d5f11838f 523
mbed_official 235:685d5f11838f 524 /**
mbed_official 235:685d5f11838f 525 * @}
mbed_official 235:685d5f11838f 526 */
mbed_official 235:685d5f11838f 527
mbed_official 235:685d5f11838f 528 #ifdef __cplusplus
mbed_official 235:685d5f11838f 529 }
mbed_official 235:685d5f11838f 530 #endif
mbed_official 235:685d5f11838f 531
mbed_official 235:685d5f11838f 532
mbed_official 235:685d5f11838f 533 #endif /* __STM32F4xx_HAL_I2C_H */
mbed_official 235:685d5f11838f 534
mbed_official 235:685d5f11838f 535 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/