Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
TARGET_NUCLEO_F746ZG/stm32f7xx_hal_i2c.h@121:672067c3ada4, 2016-04-14 (annotated)
- Committer:
- elijahorr
- Date:
- Thu Apr 14 07:28:54 2016 +0000
- Revision:
- 121:672067c3ada4
- Parent:
- 116:c0f6e94411f5
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 115:87f2f5183dfb | 1 | /** |
Kojto | 115:87f2f5183dfb | 2 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 3 | * @file stm32f7xx_hal_i2c.h |
Kojto | 115:87f2f5183dfb | 4 | * @author MCD Application Team |
Kojto | 116:c0f6e94411f5 | 5 | * @version V1.0.4 |
Kojto | 116:c0f6e94411f5 | 6 | * @date 09-December-2015 |
Kojto | 115:87f2f5183dfb | 7 | * @brief Header file of I2C HAL module. |
Kojto | 115:87f2f5183dfb | 8 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 9 | * @attention |
Kojto | 115:87f2f5183dfb | 10 | * |
Kojto | 115:87f2f5183dfb | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Kojto | 115:87f2f5183dfb | 12 | * |
Kojto | 115:87f2f5183dfb | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 115:87f2f5183dfb | 14 | * are permitted provided that the following conditions are met: |
Kojto | 115:87f2f5183dfb | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 115:87f2f5183dfb | 16 | * this list of conditions and the following disclaimer. |
Kojto | 115:87f2f5183dfb | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 115:87f2f5183dfb | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 115:87f2f5183dfb | 19 | * and/or other materials provided with the distribution. |
Kojto | 115:87f2f5183dfb | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 115:87f2f5183dfb | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 115:87f2f5183dfb | 22 | * without specific prior written permission. |
Kojto | 115:87f2f5183dfb | 23 | * |
Kojto | 115:87f2f5183dfb | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 115:87f2f5183dfb | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 115:87f2f5183dfb | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 115:87f2f5183dfb | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 115:87f2f5183dfb | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 115:87f2f5183dfb | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 115:87f2f5183dfb | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 115:87f2f5183dfb | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 115:87f2f5183dfb | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 115:87f2f5183dfb | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 115:87f2f5183dfb | 34 | * |
Kojto | 115:87f2f5183dfb | 35 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 36 | */ |
Kojto | 115:87f2f5183dfb | 37 | |
Kojto | 115:87f2f5183dfb | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 39 | #ifndef __STM32F7xx_HAL_I2C_H |
Kojto | 115:87f2f5183dfb | 40 | #define __STM32F7xx_HAL_I2C_H |
Kojto | 115:87f2f5183dfb | 41 | |
Kojto | 115:87f2f5183dfb | 42 | #ifdef __cplusplus |
Kojto | 115:87f2f5183dfb | 43 | extern "C" { |
Kojto | 115:87f2f5183dfb | 44 | #endif |
Kojto | 115:87f2f5183dfb | 45 | |
Kojto | 115:87f2f5183dfb | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 47 | #include "stm32f7xx_hal_def.h" |
Kojto | 115:87f2f5183dfb | 48 | |
Kojto | 115:87f2f5183dfb | 49 | /** @addtogroup STM32F7xx_HAL_Driver |
Kojto | 115:87f2f5183dfb | 50 | * @{ |
Kojto | 115:87f2f5183dfb | 51 | */ |
Kojto | 115:87f2f5183dfb | 52 | |
Kojto | 115:87f2f5183dfb | 53 | /** @addtogroup I2C |
Kojto | 115:87f2f5183dfb | 54 | * @{ |
Kojto | 115:87f2f5183dfb | 55 | */ |
Kojto | 115:87f2f5183dfb | 56 | |
Kojto | 115:87f2f5183dfb | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 58 | /** @defgroup I2C_Exported_Types I2C Exported Types |
Kojto | 115:87f2f5183dfb | 59 | * @{ |
Kojto | 115:87f2f5183dfb | 60 | */ |
Kojto | 115:87f2f5183dfb | 61 | |
Kojto | 115:87f2f5183dfb | 62 | /** @defgroup I2C_Configuration_Structure_definition I2C Configuration Structure definition |
Kojto | 115:87f2f5183dfb | 63 | * @brief I2C Configuration Structure definition |
Kojto | 115:87f2f5183dfb | 64 | * @{ |
Kojto | 115:87f2f5183dfb | 65 | */ |
Kojto | 115:87f2f5183dfb | 66 | typedef struct |
Kojto | 115:87f2f5183dfb | 67 | { |
Kojto | 115:87f2f5183dfb | 68 | uint32_t Timing; /*!< Specifies the I2C_TIMINGR_register value. |
Kojto | 115:87f2f5183dfb | 69 | This parameter calculated by referring to I2C initialization |
Kojto | 115:87f2f5183dfb | 70 | section in Reference manual */ |
Kojto | 115:87f2f5183dfb | 71 | |
Kojto | 115:87f2f5183dfb | 72 | uint32_t OwnAddress1; /*!< Specifies the first device own address. |
Kojto | 115:87f2f5183dfb | 73 | This parameter can be a 7-bit or 10-bit address. */ |
Kojto | 115:87f2f5183dfb | 74 | |
Kojto | 115:87f2f5183dfb | 75 | uint32_t AddressingMode; /*!< Specifies if 7-bit or 10-bit addressing mode is selected. |
Kojto | 115:87f2f5183dfb | 76 | This parameter can be a value of @ref I2C_addressing_mode */ |
Kojto | 115:87f2f5183dfb | 77 | |
Kojto | 115:87f2f5183dfb | 78 | uint32_t DualAddressMode; /*!< Specifies if dual addressing mode is selected. |
Kojto | 115:87f2f5183dfb | 79 | This parameter can be a value of @ref I2C_dual_addressing_mode */ |
Kojto | 115:87f2f5183dfb | 80 | |
Kojto | 115:87f2f5183dfb | 81 | uint32_t OwnAddress2; /*!< Specifies the second device own address if dual addressing mode is selected |
Kojto | 115:87f2f5183dfb | 82 | This parameter can be a 7-bit address. */ |
Kojto | 115:87f2f5183dfb | 83 | |
Kojto | 115:87f2f5183dfb | 84 | uint32_t OwnAddress2Masks; /*!< Specifies the acknoledge mask address second device own address if dual addressing mode is selected |
Kojto | 115:87f2f5183dfb | 85 | This parameter can be a value of @ref I2C_own_address2_masks */ |
Kojto | 115:87f2f5183dfb | 86 | |
Kojto | 115:87f2f5183dfb | 87 | uint32_t GeneralCallMode; /*!< Specifies if general call mode is selected. |
Kojto | 115:87f2f5183dfb | 88 | This parameter can be a value of @ref I2C_general_call_addressing_mode */ |
Kojto | 115:87f2f5183dfb | 89 | |
Kojto | 115:87f2f5183dfb | 90 | uint32_t NoStretchMode; /*!< Specifies if nostretch mode is selected. |
Kojto | 115:87f2f5183dfb | 91 | This parameter can be a value of @ref I2C_nostretch_mode */ |
Kojto | 115:87f2f5183dfb | 92 | |
Kojto | 115:87f2f5183dfb | 93 | }I2C_InitTypeDef; |
Kojto | 115:87f2f5183dfb | 94 | |
Kojto | 115:87f2f5183dfb | 95 | /** |
Kojto | 115:87f2f5183dfb | 96 | * @} |
Kojto | 115:87f2f5183dfb | 97 | */ |
Kojto | 115:87f2f5183dfb | 98 | |
Kojto | 115:87f2f5183dfb | 99 | /** @defgroup HAL_state_structure_definition HAL state structure definition |
Kojto | 115:87f2f5183dfb | 100 | * @brief HAL State structure definition |
Kojto | 115:87f2f5183dfb | 101 | * @{ |
Kojto | 115:87f2f5183dfb | 102 | */ |
Kojto | 115:87f2f5183dfb | 103 | |
Kojto | 115:87f2f5183dfb | 104 | typedef enum |
Kojto | 115:87f2f5183dfb | 105 | { |
Kojto | 115:87f2f5183dfb | 106 | HAL_I2C_STATE_RESET = 0x00, /*!< I2C not yet initialized or disabled */ |
Kojto | 115:87f2f5183dfb | 107 | HAL_I2C_STATE_READY = 0x01, /*!< I2C initialized and ready for use */ |
Kojto | 115:87f2f5183dfb | 108 | HAL_I2C_STATE_BUSY = 0x02, /*!< I2C internal process is ongoing */ |
Kojto | 115:87f2f5183dfb | 109 | HAL_I2C_STATE_MASTER_BUSY_TX = 0x12, /*!< Master Data Transmission process is ongoing */ |
Kojto | 115:87f2f5183dfb | 110 | HAL_I2C_STATE_MASTER_BUSY_RX = 0x22, /*!< Master Data Reception process is ongoing */ |
Kojto | 115:87f2f5183dfb | 111 | HAL_I2C_STATE_SLAVE_BUSY_TX = 0x32, /*!< Slave Data Transmission process is ongoing */ |
Kojto | 115:87f2f5183dfb | 112 | HAL_I2C_STATE_SLAVE_BUSY_RX = 0x42, /*!< Slave Data Reception process is ongoing */ |
Kojto | 115:87f2f5183dfb | 113 | HAL_I2C_STATE_MEM_BUSY_TX = 0x52, /*!< Memory Data Transmission process is ongoing */ |
Kojto | 115:87f2f5183dfb | 114 | HAL_I2C_STATE_MEM_BUSY_RX = 0x62, /*!< Memory Data Reception process is ongoing */ |
Kojto | 115:87f2f5183dfb | 115 | HAL_I2C_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 115:87f2f5183dfb | 116 | HAL_I2C_STATE_ERROR = 0x04 /*!< Reception process is ongoing */ |
Kojto | 115:87f2f5183dfb | 117 | }HAL_I2C_StateTypeDef; |
Kojto | 115:87f2f5183dfb | 118 | |
Kojto | 115:87f2f5183dfb | 119 | /** |
Kojto | 115:87f2f5183dfb | 120 | * @} |
Kojto | 115:87f2f5183dfb | 121 | */ |
Kojto | 115:87f2f5183dfb | 122 | |
Kojto | 115:87f2f5183dfb | 123 | /** @defgroup I2C_Error_Code_definition I2C Error Code definition |
Kojto | 115:87f2f5183dfb | 124 | * @brief I2C Error Code definition |
Kojto | 115:87f2f5183dfb | 125 | * @{ |
Kojto | 115:87f2f5183dfb | 126 | */ |
Kojto | 115:87f2f5183dfb | 127 | #define HAL_I2C_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ |
Kojto | 115:87f2f5183dfb | 128 | #define HAL_I2C_ERROR_BERR ((uint32_t)0x00000001) /*!< BERR error */ |
Kojto | 115:87f2f5183dfb | 129 | #define HAL_I2C_ERROR_ARLO ((uint32_t)0x00000002) /*!< ARLO error */ |
Kojto | 115:87f2f5183dfb | 130 | #define HAL_I2C_ERROR_AF ((uint32_t)0x00000004) /*!< ACKF error */ |
Kojto | 115:87f2f5183dfb | 131 | #define HAL_I2C_ERROR_OVR ((uint32_t)0x00000008) /*!< OVR error */ |
Kojto | 115:87f2f5183dfb | 132 | #define HAL_I2C_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */ |
Kojto | 115:87f2f5183dfb | 133 | #define HAL_I2C_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout error */ |
Kojto | 115:87f2f5183dfb | 134 | #define HAL_I2C_ERROR_SIZE ((uint32_t)0x00000040) /*!< Size Management error */ |
Kojto | 115:87f2f5183dfb | 135 | /** |
Kojto | 115:87f2f5183dfb | 136 | * @} |
Kojto | 115:87f2f5183dfb | 137 | */ |
Kojto | 115:87f2f5183dfb | 138 | |
Kojto | 115:87f2f5183dfb | 139 | /** @defgroup I2C_handle_Structure_definition I2C handle Structure definition |
Kojto | 115:87f2f5183dfb | 140 | * @brief I2C handle Structure definition |
Kojto | 115:87f2f5183dfb | 141 | * @{ |
Kojto | 115:87f2f5183dfb | 142 | */ |
Kojto | 115:87f2f5183dfb | 143 | typedef struct |
Kojto | 115:87f2f5183dfb | 144 | { |
Kojto | 115:87f2f5183dfb | 145 | I2C_TypeDef *Instance; /*!< I2C registers base address */ |
Kojto | 115:87f2f5183dfb | 146 | |
Kojto | 115:87f2f5183dfb | 147 | I2C_InitTypeDef Init; /*!< I2C communication parameters */ |
Kojto | 115:87f2f5183dfb | 148 | |
Kojto | 115:87f2f5183dfb | 149 | uint8_t *pBuffPtr; /*!< Pointer to I2C transfer buffer */ |
Kojto | 115:87f2f5183dfb | 150 | |
Kojto | 115:87f2f5183dfb | 151 | uint16_t XferSize; /*!< I2C transfer size */ |
Kojto | 115:87f2f5183dfb | 152 | |
Kojto | 115:87f2f5183dfb | 153 | __IO uint16_t XferCount; /*!< I2C transfer counter */ |
Kojto | 115:87f2f5183dfb | 154 | |
Kojto | 115:87f2f5183dfb | 155 | DMA_HandleTypeDef *hdmatx; /*!< I2C Tx DMA handle parameters */ |
Kojto | 115:87f2f5183dfb | 156 | |
Kojto | 115:87f2f5183dfb | 157 | DMA_HandleTypeDef *hdmarx; /*!< I2C Rx DMA handle parameters */ |
Kojto | 115:87f2f5183dfb | 158 | |
Kojto | 115:87f2f5183dfb | 159 | HAL_LockTypeDef Lock; /*!< I2C locking object */ |
Kojto | 115:87f2f5183dfb | 160 | |
Kojto | 115:87f2f5183dfb | 161 | __IO HAL_I2C_StateTypeDef State; /*!< I2C communication state */ |
Kojto | 115:87f2f5183dfb | 162 | |
Kojto | 115:87f2f5183dfb | 163 | __IO uint32_t ErrorCode; /*!< I2C Error code */ |
Kojto | 115:87f2f5183dfb | 164 | |
Kojto | 115:87f2f5183dfb | 165 | }I2C_HandleTypeDef; |
Kojto | 115:87f2f5183dfb | 166 | /** |
Kojto | 115:87f2f5183dfb | 167 | * @} |
Kojto | 115:87f2f5183dfb | 168 | */ |
Kojto | 115:87f2f5183dfb | 169 | |
Kojto | 115:87f2f5183dfb | 170 | /** |
Kojto | 115:87f2f5183dfb | 171 | * @} |
Kojto | 115:87f2f5183dfb | 172 | */ |
Kojto | 115:87f2f5183dfb | 173 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 174 | |
Kojto | 115:87f2f5183dfb | 175 | /** @defgroup I2C_Exported_Constants I2C Exported Constants |
Kojto | 115:87f2f5183dfb | 176 | * @{ |
Kojto | 115:87f2f5183dfb | 177 | */ |
Kojto | 115:87f2f5183dfb | 178 | |
Kojto | 115:87f2f5183dfb | 179 | /** @defgroup I2C_addressing_mode I2C addressing mode |
Kojto | 115:87f2f5183dfb | 180 | * @{ |
Kojto | 115:87f2f5183dfb | 181 | */ |
Kojto | 115:87f2f5183dfb | 182 | #define I2C_ADDRESSINGMODE_7BIT ((uint32_t)0x00000001) |
Kojto | 115:87f2f5183dfb | 183 | #define I2C_ADDRESSINGMODE_10BIT ((uint32_t)0x00000002) |
Kojto | 115:87f2f5183dfb | 184 | /** |
Kojto | 115:87f2f5183dfb | 185 | * @} |
Kojto | 115:87f2f5183dfb | 186 | */ |
Kojto | 115:87f2f5183dfb | 187 | |
Kojto | 115:87f2f5183dfb | 188 | /** @defgroup I2C_dual_addressing_mode I2C dual addressing mode |
Kojto | 115:87f2f5183dfb | 189 | * @{ |
Kojto | 115:87f2f5183dfb | 190 | */ |
Kojto | 115:87f2f5183dfb | 191 | #define I2C_DUALADDRESS_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 192 | #define I2C_DUALADDRESS_ENABLE I2C_OAR2_OA2EN |
Kojto | 115:87f2f5183dfb | 193 | /** |
Kojto | 115:87f2f5183dfb | 194 | * @} |
Kojto | 115:87f2f5183dfb | 195 | */ |
Kojto | 115:87f2f5183dfb | 196 | |
Kojto | 115:87f2f5183dfb | 197 | /** @defgroup I2C_own_address2_masks I2C own address2 masks |
Kojto | 115:87f2f5183dfb | 198 | * @{ |
Kojto | 115:87f2f5183dfb | 199 | */ |
Kojto | 115:87f2f5183dfb | 200 | #define I2C_OA2_NOMASK ((uint8_t)0x00) |
Kojto | 115:87f2f5183dfb | 201 | #define I2C_OA2_MASK01 ((uint8_t)0x01) |
Kojto | 115:87f2f5183dfb | 202 | #define I2C_OA2_MASK02 ((uint8_t)0x02) |
Kojto | 115:87f2f5183dfb | 203 | #define I2C_OA2_MASK03 ((uint8_t)0x03) |
Kojto | 115:87f2f5183dfb | 204 | #define I2C_OA2_MASK04 ((uint8_t)0x04) |
Kojto | 115:87f2f5183dfb | 205 | #define I2C_OA2_MASK05 ((uint8_t)0x05) |
Kojto | 115:87f2f5183dfb | 206 | #define I2C_OA2_MASK06 ((uint8_t)0x06) |
Kojto | 115:87f2f5183dfb | 207 | #define I2C_OA2_MASK07 ((uint8_t)0x07) |
Kojto | 115:87f2f5183dfb | 208 | /** |
Kojto | 115:87f2f5183dfb | 209 | * @} |
Kojto | 115:87f2f5183dfb | 210 | */ |
Kojto | 115:87f2f5183dfb | 211 | |
Kojto | 115:87f2f5183dfb | 212 | /** @defgroup I2C_general_call_addressing_mode I2C general call addressing mode |
Kojto | 115:87f2f5183dfb | 213 | * @{ |
Kojto | 115:87f2f5183dfb | 214 | */ |
Kojto | 115:87f2f5183dfb | 215 | #define I2C_GENERALCALL_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 216 | #define I2C_GENERALCALL_ENABLE I2C_CR1_GCEN |
Kojto | 115:87f2f5183dfb | 217 | /** |
Kojto | 115:87f2f5183dfb | 218 | * @} |
Kojto | 115:87f2f5183dfb | 219 | */ |
Kojto | 115:87f2f5183dfb | 220 | |
Kojto | 115:87f2f5183dfb | 221 | /** @defgroup I2C_nostretch_mode I2C nostretch mode |
Kojto | 115:87f2f5183dfb | 222 | * @{ |
Kojto | 115:87f2f5183dfb | 223 | */ |
Kojto | 115:87f2f5183dfb | 224 | #define I2C_NOSTRETCH_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 225 | #define I2C_NOSTRETCH_ENABLE I2C_CR1_NOSTRETCH |
Kojto | 115:87f2f5183dfb | 226 | /** |
Kojto | 115:87f2f5183dfb | 227 | * @} |
Kojto | 115:87f2f5183dfb | 228 | */ |
Kojto | 115:87f2f5183dfb | 229 | |
Kojto | 115:87f2f5183dfb | 230 | /** @defgroup I2C_Memory_Address_Size I2C Memory Address Size |
Kojto | 115:87f2f5183dfb | 231 | * @{ |
Kojto | 115:87f2f5183dfb | 232 | */ |
Kojto | 115:87f2f5183dfb | 233 | #define I2C_MEMADD_SIZE_8BIT ((uint32_t)0x00000001) |
Kojto | 115:87f2f5183dfb | 234 | #define I2C_MEMADD_SIZE_16BIT ((uint32_t)0x00000002) |
Kojto | 115:87f2f5183dfb | 235 | /** |
Kojto | 115:87f2f5183dfb | 236 | * @} |
Kojto | 115:87f2f5183dfb | 237 | */ |
Kojto | 115:87f2f5183dfb | 238 | |
Kojto | 115:87f2f5183dfb | 239 | /** @defgroup I2C_ReloadEndMode_definition I2C ReloadEndMode definition |
Kojto | 115:87f2f5183dfb | 240 | * @{ |
Kojto | 115:87f2f5183dfb | 241 | */ |
Kojto | 115:87f2f5183dfb | 242 | #define I2C_RELOAD_MODE I2C_CR2_RELOAD |
Kojto | 115:87f2f5183dfb | 243 | #define I2C_AUTOEND_MODE I2C_CR2_AUTOEND |
Kojto | 115:87f2f5183dfb | 244 | #define I2C_SOFTEND_MODE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 245 | /** |
Kojto | 115:87f2f5183dfb | 246 | * @} |
Kojto | 115:87f2f5183dfb | 247 | */ |
Kojto | 115:87f2f5183dfb | 248 | |
Kojto | 115:87f2f5183dfb | 249 | /** @defgroup I2C_StartStopMode_definition I2C StartStopMode definition |
Kojto | 115:87f2f5183dfb | 250 | * @{ |
Kojto | 115:87f2f5183dfb | 251 | */ |
Kojto | 115:87f2f5183dfb | 252 | #define I2C_NO_STARTSTOP ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 253 | #define I2C_GENERATE_STOP I2C_CR2_STOP |
Kojto | 115:87f2f5183dfb | 254 | #define I2C_GENERATE_START_READ (uint32_t)(I2C_CR2_START | I2C_CR2_RD_WRN) |
Kojto | 115:87f2f5183dfb | 255 | #define I2C_GENERATE_START_WRITE I2C_CR2_START |
Kojto | 115:87f2f5183dfb | 256 | /** |
Kojto | 115:87f2f5183dfb | 257 | * @} |
Kojto | 115:87f2f5183dfb | 258 | */ |
Kojto | 115:87f2f5183dfb | 259 | |
Kojto | 115:87f2f5183dfb | 260 | /** @defgroup I2C_Interrupt_configuration_definition I2C Interrupt configuration definition |
Kojto | 115:87f2f5183dfb | 261 | * @brief I2C Interrupt definition |
Kojto | 115:87f2f5183dfb | 262 | * Elements values convention: 0xXXXXXXXX |
Kojto | 115:87f2f5183dfb | 263 | * - XXXXXXXX : Interrupt control mask |
Kojto | 115:87f2f5183dfb | 264 | * @{ |
Kojto | 115:87f2f5183dfb | 265 | */ |
Kojto | 115:87f2f5183dfb | 266 | #define I2C_IT_ERRI I2C_CR1_ERRIE |
Kojto | 115:87f2f5183dfb | 267 | #define I2C_IT_TCI I2C_CR1_TCIE |
Kojto | 115:87f2f5183dfb | 268 | #define I2C_IT_STOPI I2C_CR1_STOPIE |
Kojto | 115:87f2f5183dfb | 269 | #define I2C_IT_NACKI I2C_CR1_NACKIE |
Kojto | 115:87f2f5183dfb | 270 | #define I2C_IT_ADDRI I2C_CR1_ADDRIE |
Kojto | 115:87f2f5183dfb | 271 | #define I2C_IT_RXI I2C_CR1_RXIE |
Kojto | 115:87f2f5183dfb | 272 | #define I2C_IT_TXI I2C_CR1_TXIE |
Kojto | 115:87f2f5183dfb | 273 | |
Kojto | 115:87f2f5183dfb | 274 | /** |
Kojto | 115:87f2f5183dfb | 275 | * @} |
Kojto | 115:87f2f5183dfb | 276 | */ |
Kojto | 115:87f2f5183dfb | 277 | |
Kojto | 115:87f2f5183dfb | 278 | /** @defgroup I2C_Flag_definition I2C Flag definition |
Kojto | 115:87f2f5183dfb | 279 | * @{ |
Kojto | 115:87f2f5183dfb | 280 | */ |
Kojto | 115:87f2f5183dfb | 281 | #define I2C_FLAG_TXE I2C_ISR_TXE |
Kojto | 115:87f2f5183dfb | 282 | #define I2C_FLAG_TXIS I2C_ISR_TXIS |
Kojto | 115:87f2f5183dfb | 283 | #define I2C_FLAG_RXNE I2C_ISR_RXNE |
Kojto | 115:87f2f5183dfb | 284 | #define I2C_FLAG_ADDR I2C_ISR_ADDR |
Kojto | 115:87f2f5183dfb | 285 | #define I2C_FLAG_AF I2C_ISR_NACKF |
Kojto | 115:87f2f5183dfb | 286 | #define I2C_FLAG_STOPF I2C_ISR_STOPF |
Kojto | 115:87f2f5183dfb | 287 | #define I2C_FLAG_TC I2C_ISR_TC |
Kojto | 115:87f2f5183dfb | 288 | #define I2C_FLAG_TCR I2C_ISR_TCR |
Kojto | 115:87f2f5183dfb | 289 | #define I2C_FLAG_BERR I2C_ISR_BERR |
Kojto | 115:87f2f5183dfb | 290 | #define I2C_FLAG_ARLO I2C_ISR_ARLO |
Kojto | 115:87f2f5183dfb | 291 | #define I2C_FLAG_OVR I2C_ISR_OVR |
Kojto | 115:87f2f5183dfb | 292 | #define I2C_FLAG_PECERR I2C_ISR_PECERR |
Kojto | 115:87f2f5183dfb | 293 | #define I2C_FLAG_TIMEOUT I2C_ISR_TIMEOUT |
Kojto | 115:87f2f5183dfb | 294 | #define I2C_FLAG_ALERT I2C_ISR_ALERT |
Kojto | 115:87f2f5183dfb | 295 | #define I2C_FLAG_BUSY I2C_ISR_BUSY |
Kojto | 115:87f2f5183dfb | 296 | #define I2C_FLAG_DIR I2C_ISR_DIR |
Kojto | 115:87f2f5183dfb | 297 | /** |
Kojto | 115:87f2f5183dfb | 298 | * @} |
Kojto | 115:87f2f5183dfb | 299 | */ |
Kojto | 115:87f2f5183dfb | 300 | |
Kojto | 115:87f2f5183dfb | 301 | /** |
Kojto | 115:87f2f5183dfb | 302 | * @} |
Kojto | 115:87f2f5183dfb | 303 | */ |
Kojto | 115:87f2f5183dfb | 304 | |
Kojto | 115:87f2f5183dfb | 305 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 306 | |
Kojto | 115:87f2f5183dfb | 307 | /** @defgroup I2C_Exported_Macros I2C Exported Macros |
Kojto | 115:87f2f5183dfb | 308 | * @{ |
Kojto | 115:87f2f5183dfb | 309 | */ |
Kojto | 115:87f2f5183dfb | 310 | |
Kojto | 115:87f2f5183dfb | 311 | /** @brief Reset I2C handle state |
Kojto | 115:87f2f5183dfb | 312 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 313 | * @retval None |
Kojto | 115:87f2f5183dfb | 314 | */ |
Kojto | 115:87f2f5183dfb | 315 | #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2C_STATE_RESET) |
Kojto | 115:87f2f5183dfb | 316 | |
Kojto | 115:87f2f5183dfb | 317 | /** @brief Enable the specified I2C interrupts. |
Kojto | 115:87f2f5183dfb | 318 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 319 | * @param __INTERRUPT__: specifies the interrupt source to enable. |
Kojto | 115:87f2f5183dfb | 320 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 321 | * @arg I2C_IT_ERRI: Errors interrupt enable |
Kojto | 115:87f2f5183dfb | 322 | * @arg I2C_IT_TCI: Transfer complete interrupt enable |
Kojto | 115:87f2f5183dfb | 323 | * @arg I2C_IT_STOPI: STOP detection interrupt enable |
Kojto | 115:87f2f5183dfb | 324 | * @arg I2C_IT_NACKI: NACK received interrupt enable |
Kojto | 115:87f2f5183dfb | 325 | * @arg I2C_IT_ADDRI: Address match interrupt enable |
Kojto | 115:87f2f5183dfb | 326 | * @arg I2C_IT_RXI: RX interrupt enable |
Kojto | 115:87f2f5183dfb | 327 | * @arg I2C_IT_TXI: TX interrupt enable |
Kojto | 115:87f2f5183dfb | 328 | * |
Kojto | 115:87f2f5183dfb | 329 | * @retval None |
Kojto | 115:87f2f5183dfb | 330 | */ |
Kojto | 115:87f2f5183dfb | 331 | |
Kojto | 115:87f2f5183dfb | 332 | #define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__)) |
Kojto | 115:87f2f5183dfb | 333 | |
Kojto | 115:87f2f5183dfb | 334 | /** @brief Disable the specified I2C interrupts. |
Kojto | 115:87f2f5183dfb | 335 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 336 | * @param __INTERRUPT__: specifies the interrupt source to disable. |
Kojto | 115:87f2f5183dfb | 337 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 338 | * @arg I2C_IT_ERRI: Errors interrupt enable |
Kojto | 115:87f2f5183dfb | 339 | * @arg I2C_IT_TCI: Transfer complete interrupt enable |
Kojto | 115:87f2f5183dfb | 340 | * @arg I2C_IT_STOPI: STOP detection interrupt enable |
Kojto | 115:87f2f5183dfb | 341 | * @arg I2C_IT_NACKI: NACK received interrupt enable |
Kojto | 115:87f2f5183dfb | 342 | * @arg I2C_IT_ADDRI: Address match interrupt enable |
Kojto | 115:87f2f5183dfb | 343 | * @arg I2C_IT_RXI: RX interrupt enable |
Kojto | 115:87f2f5183dfb | 344 | * @arg I2C_IT_TXI: TX interrupt enable |
Kojto | 115:87f2f5183dfb | 345 | * |
Kojto | 115:87f2f5183dfb | 346 | * @retval None |
Kojto | 115:87f2f5183dfb | 347 | */ |
Kojto | 115:87f2f5183dfb | 348 | #define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__))) |
Kojto | 115:87f2f5183dfb | 349 | |
Kojto | 115:87f2f5183dfb | 350 | /** @brief Checks if the specified I2C interrupt source is enabled or disabled. |
Kojto | 115:87f2f5183dfb | 351 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 352 | * @param __INTERRUPT__: specifies the I2C interrupt source to check. |
Kojto | 115:87f2f5183dfb | 353 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 354 | * @arg I2C_IT_ERRI: Errors interrupt enable |
Kojto | 115:87f2f5183dfb | 355 | * @arg I2C_IT_TCI: Transfer complete interrupt enable |
Kojto | 115:87f2f5183dfb | 356 | * @arg I2C_IT_STOPI: STOP detection interrupt enable |
Kojto | 115:87f2f5183dfb | 357 | * @arg I2C_IT_NACKI: NACK received interrupt enable |
Kojto | 115:87f2f5183dfb | 358 | * @arg I2C_IT_ADDRI: Address match interrupt enable |
Kojto | 115:87f2f5183dfb | 359 | * @arg I2C_IT_RXI: RX interrupt enable |
Kojto | 115:87f2f5183dfb | 360 | * @arg I2C_IT_TXI: TX interrupt enable |
Kojto | 115:87f2f5183dfb | 361 | * |
Kojto | 115:87f2f5183dfb | 362 | * @retval The new state of __INTERRUPT__ (TRUE or FALSE). |
Kojto | 115:87f2f5183dfb | 363 | */ |
Kojto | 115:87f2f5183dfb | 364 | #define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
Kojto | 115:87f2f5183dfb | 365 | |
Kojto | 115:87f2f5183dfb | 366 | /** @brief Checks whether the specified I2C flag is set or not. |
Kojto | 115:87f2f5183dfb | 367 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 368 | * @param __FLAG__: specifies the flag to check. |
Kojto | 115:87f2f5183dfb | 369 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 370 | * @arg I2C_FLAG_TXE: Transmit data register empty |
Kojto | 115:87f2f5183dfb | 371 | * @arg I2C_FLAG_TXIS: Transmit interrupt status |
Kojto | 115:87f2f5183dfb | 372 | * @arg I2C_FLAG_RXNE: Receive data register not empty |
Kojto | 115:87f2f5183dfb | 373 | * @arg I2C_FLAG_ADDR: Address matched (slave mode) |
Kojto | 115:87f2f5183dfb | 374 | * @arg I2C_FLAG_AF: Acknowledge failure received flag |
Kojto | 115:87f2f5183dfb | 375 | * @arg I2C_FLAG_STOPF: STOP detection flag |
Kojto | 115:87f2f5183dfb | 376 | * @arg I2C_FLAG_TC: Transfer complete (master mode) |
Kojto | 115:87f2f5183dfb | 377 | * @arg I2C_FLAG_TCR: Transfer complete reload |
Kojto | 115:87f2f5183dfb | 378 | * @arg I2C_FLAG_BERR: Bus error |
Kojto | 115:87f2f5183dfb | 379 | * @arg I2C_FLAG_ARLO: Arbitration lost |
Kojto | 115:87f2f5183dfb | 380 | * @arg I2C_FLAG_OVR: Overrun/Underrun |
Kojto | 115:87f2f5183dfb | 381 | * @arg I2C_FLAG_PECERR: PEC error in reception |
Kojto | 115:87f2f5183dfb | 382 | * @arg I2C_FLAG_TIMEOUT: Timeout or Tlow detection flag |
Kojto | 115:87f2f5183dfb | 383 | * @arg I2C_FLAG_ALERT: SMBus alert |
Kojto | 115:87f2f5183dfb | 384 | * @arg I2C_FLAG_BUSY: Bus busy |
Kojto | 115:87f2f5183dfb | 385 | * @arg I2C_FLAG_DIR: Transfer direction (slave mode) |
Kojto | 115:87f2f5183dfb | 386 | * |
Kojto | 115:87f2f5183dfb | 387 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 115:87f2f5183dfb | 388 | */ |
Kojto | 115:87f2f5183dfb | 389 | #define I2C_FLAG_MASK ((uint32_t)0x0001FFFF) |
Kojto | 115:87f2f5183dfb | 390 | #define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK))) |
Kojto | 115:87f2f5183dfb | 391 | |
Kojto | 115:87f2f5183dfb | 392 | /** @brief Clears the I2C pending flags which are cleared by writing 1 in a specific bit. |
Kojto | 115:87f2f5183dfb | 393 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 394 | * @param __FLAG__: specifies the flag to clear. |
Kojto | 115:87f2f5183dfb | 395 | * This parameter can be any combination of the following values: |
Kojto | 115:87f2f5183dfb | 396 | * @arg I2C_FLAG_ADDR: Address matched (slave mode) |
Kojto | 115:87f2f5183dfb | 397 | * @arg I2C_FLAG_AF: Acknowledge failure received flag |
Kojto | 115:87f2f5183dfb | 398 | * @arg I2C_FLAG_STOPF: STOP detection flag |
Kojto | 115:87f2f5183dfb | 399 | * @arg I2C_FLAG_BERR: Bus error |
Kojto | 115:87f2f5183dfb | 400 | * @arg I2C_FLAG_ARLO: Arbitration lost |
Kojto | 115:87f2f5183dfb | 401 | * @arg I2C_FLAG_OVR: Overrun/Underrun |
Kojto | 115:87f2f5183dfb | 402 | * @arg I2C_FLAG_PECERR: PEC error in reception |
Kojto | 115:87f2f5183dfb | 403 | * @arg I2C_FLAG_TIMEOUT: Timeout or Tlow detection flag |
Kojto | 115:87f2f5183dfb | 404 | * @arg I2C_FLAG_ALERT: SMBus alert |
Kojto | 115:87f2f5183dfb | 405 | * |
Kojto | 115:87f2f5183dfb | 406 | * @retval None |
Kojto | 115:87f2f5183dfb | 407 | */ |
Kojto | 115:87f2f5183dfb | 408 | #define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = ((__FLAG__) & I2C_FLAG_MASK)) |
Kojto | 115:87f2f5183dfb | 409 | |
Kojto | 115:87f2f5183dfb | 410 | /** @brief Enable the specified I2C peripheral. |
Kojto | 115:87f2f5183dfb | 411 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 412 | * @retval None |
Kojto | 115:87f2f5183dfb | 413 | */ |
Kojto | 115:87f2f5183dfb | 414 | #define __HAL_I2C_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) |
Kojto | 115:87f2f5183dfb | 415 | |
Kojto | 115:87f2f5183dfb | 416 | /** @brief Disable the specified I2C peripheral. |
Kojto | 115:87f2f5183dfb | 417 | * @param __HANDLE__: specifies the I2C Handle. |
Kojto | 115:87f2f5183dfb | 418 | * @retval None |
Kojto | 115:87f2f5183dfb | 419 | */ |
Kojto | 115:87f2f5183dfb | 420 | #define __HAL_I2C_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) |
Kojto | 115:87f2f5183dfb | 421 | |
Kojto | 115:87f2f5183dfb | 422 | /** |
Kojto | 115:87f2f5183dfb | 423 | * @} |
Kojto | 115:87f2f5183dfb | 424 | */ |
Kojto | 115:87f2f5183dfb | 425 | |
Kojto | 115:87f2f5183dfb | 426 | /* Include I2C HAL Extension module */ |
Kojto | 115:87f2f5183dfb | 427 | #include "stm32f7xx_hal_i2c_ex.h" |
Kojto | 115:87f2f5183dfb | 428 | |
Kojto | 115:87f2f5183dfb | 429 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 430 | /** @addtogroup I2C_Exported_Functions |
Kojto | 115:87f2f5183dfb | 431 | * @{ |
Kojto | 115:87f2f5183dfb | 432 | */ |
Kojto | 115:87f2f5183dfb | 433 | |
Kojto | 115:87f2f5183dfb | 434 | /** @addtogroup I2C_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 115:87f2f5183dfb | 435 | * @{ |
Kojto | 115:87f2f5183dfb | 436 | */ |
Kojto | 115:87f2f5183dfb | 437 | /* Initialization and de-initialization functions******************************/ |
Kojto | 115:87f2f5183dfb | 438 | HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 439 | HAL_StatusTypeDef HAL_I2C_DeInit (I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 440 | void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 441 | void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 442 | /** |
Kojto | 115:87f2f5183dfb | 443 | * @} |
Kojto | 115:87f2f5183dfb | 444 | */ |
Kojto | 115:87f2f5183dfb | 445 | |
Kojto | 115:87f2f5183dfb | 446 | /** @addtogroup I2C_Exported_Functions_Group2 Input and Output operation functions |
Kojto | 115:87f2f5183dfb | 447 | * @{ |
Kojto | 115:87f2f5183dfb | 448 | */ |
Kojto | 115:87f2f5183dfb | 449 | /* IO operation functions ****************************************************/ |
Kojto | 115:87f2f5183dfb | 450 | /******* Blocking mode: Polling */ |
Kojto | 115:87f2f5183dfb | 451 | HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 452 | HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 453 | HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 454 | HAL_StatusTypeDef HAL_I2C_Slave_Receive(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 455 | 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); |
Kojto | 115:87f2f5183dfb | 456 | 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); |
Kojto | 115:87f2f5183dfb | 457 | HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 458 | |
Kojto | 115:87f2f5183dfb | 459 | /******* Non-Blocking mode: Interrupt */ |
Kojto | 115:87f2f5183dfb | 460 | HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 461 | HAL_StatusTypeDef HAL_I2C_Master_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 462 | HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 463 | HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 464 | 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); |
Kojto | 115:87f2f5183dfb | 465 | 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); |
Kojto | 115:87f2f5183dfb | 466 | |
Kojto | 115:87f2f5183dfb | 467 | /******* Non-Blocking mode: DMA */ |
Kojto | 115:87f2f5183dfb | 468 | HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 469 | HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 470 | HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 471 | HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 472 | 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); |
Kojto | 115:87f2f5183dfb | 473 | 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); |
Kojto | 115:87f2f5183dfb | 474 | /** |
Kojto | 115:87f2f5183dfb | 475 | * @} |
Kojto | 115:87f2f5183dfb | 476 | */ |
Kojto | 115:87f2f5183dfb | 477 | |
Kojto | 115:87f2f5183dfb | 478 | /** @addtogroup IRQ_Handler_and_Callbacks IRQ Handler and Callbacks |
Kojto | 115:87f2f5183dfb | 479 | * @{ |
Kojto | 115:87f2f5183dfb | 480 | */ |
Kojto | 115:87f2f5183dfb | 481 | /******* I2C IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ |
Kojto | 115:87f2f5183dfb | 482 | void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 483 | void HAL_I2C_ER_IRQHandler(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 484 | void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 485 | void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 486 | void HAL_I2C_SlaveTxCpltCallback(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 487 | void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 488 | void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 489 | void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 490 | void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 491 | /** |
Kojto | 115:87f2f5183dfb | 492 | * @} |
Kojto | 115:87f2f5183dfb | 493 | */ |
Kojto | 115:87f2f5183dfb | 494 | |
Kojto | 115:87f2f5183dfb | 495 | /** @addtogroup I2C_Exported_Functions_Group3 Peripheral State and Errors functions |
Kojto | 115:87f2f5183dfb | 496 | * @{ |
Kojto | 115:87f2f5183dfb | 497 | */ |
Kojto | 115:87f2f5183dfb | 498 | /* Peripheral State and Errors functions *************************************/ |
Kojto | 115:87f2f5183dfb | 499 | HAL_I2C_StateTypeDef HAL_I2C_GetState(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 500 | uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c); |
Kojto | 115:87f2f5183dfb | 501 | |
Kojto | 115:87f2f5183dfb | 502 | /** |
Kojto | 115:87f2f5183dfb | 503 | * @} |
Kojto | 115:87f2f5183dfb | 504 | */ |
Kojto | 115:87f2f5183dfb | 505 | |
Kojto | 115:87f2f5183dfb | 506 | /** |
Kojto | 115:87f2f5183dfb | 507 | * @} |
Kojto | 115:87f2f5183dfb | 508 | */ |
Kojto | 115:87f2f5183dfb | 509 | |
Kojto | 115:87f2f5183dfb | 510 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 511 | /** @defgroup I2C_Private_Constants I2C Private Constants |
Kojto | 115:87f2f5183dfb | 512 | * @{ |
Kojto | 115:87f2f5183dfb | 513 | */ |
Kojto | 115:87f2f5183dfb | 514 | |
Kojto | 115:87f2f5183dfb | 515 | /** |
Kojto | 115:87f2f5183dfb | 516 | * @} |
Kojto | 115:87f2f5183dfb | 517 | */ |
Kojto | 115:87f2f5183dfb | 518 | |
Kojto | 115:87f2f5183dfb | 519 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 520 | /** @defgroup I2C_Private_Macro I2C Private Macros |
Kojto | 115:87f2f5183dfb | 521 | * @{ |
Kojto | 115:87f2f5183dfb | 522 | */ |
Kojto | 115:87f2f5183dfb | 523 | |
Kojto | 115:87f2f5183dfb | 524 | #define IS_I2C_ADDRESSING_MODE(MODE) (((MODE) == I2C_ADDRESSINGMODE_7BIT) || \ |
Kojto | 115:87f2f5183dfb | 525 | ((MODE) == I2C_ADDRESSINGMODE_10BIT)) |
Kojto | 115:87f2f5183dfb | 526 | |
Kojto | 115:87f2f5183dfb | 527 | #define IS_I2C_DUAL_ADDRESS(ADDRESS) (((ADDRESS) == I2C_DUALADDRESS_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 528 | ((ADDRESS) == I2C_DUALADDRESS_ENABLE)) |
Kojto | 115:87f2f5183dfb | 529 | |
Kojto | 115:87f2f5183dfb | 530 | #define IS_I2C_OWN_ADDRESS2_MASK(MASK) (((MASK) == I2C_OA2_NOMASK) || \ |
Kojto | 115:87f2f5183dfb | 531 | ((MASK) == I2C_OA2_MASK01) || \ |
Kojto | 115:87f2f5183dfb | 532 | ((MASK) == I2C_OA2_MASK02) || \ |
Kojto | 115:87f2f5183dfb | 533 | ((MASK) == I2C_OA2_MASK03) || \ |
Kojto | 115:87f2f5183dfb | 534 | ((MASK) == I2C_OA2_MASK04) || \ |
Kojto | 115:87f2f5183dfb | 535 | ((MASK) == I2C_OA2_MASK05) || \ |
Kojto | 115:87f2f5183dfb | 536 | ((MASK) == I2C_OA2_MASK06) || \ |
Kojto | 115:87f2f5183dfb | 537 | ((MASK) == I2C_OA2_MASK07)) |
Kojto | 115:87f2f5183dfb | 538 | |
Kojto | 115:87f2f5183dfb | 539 | #define IS_I2C_GENERAL_CALL(CALL) (((CALL) == I2C_GENERALCALL_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 540 | ((CALL) == I2C_GENERALCALL_ENABLE)) |
Kojto | 115:87f2f5183dfb | 541 | |
Kojto | 115:87f2f5183dfb | 542 | #define IS_I2C_NO_STRETCH(STRETCH) (((STRETCH) == I2C_NOSTRETCH_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 543 | ((STRETCH) == I2C_NOSTRETCH_ENABLE)) |
Kojto | 115:87f2f5183dfb | 544 | |
Kojto | 115:87f2f5183dfb | 545 | #define IS_I2C_MEMADD_SIZE(SIZE) (((SIZE) == I2C_MEMADD_SIZE_8BIT) || \ |
Kojto | 115:87f2f5183dfb | 546 | ((SIZE) == I2C_MEMADD_SIZE_16BIT)) |
Kojto | 115:87f2f5183dfb | 547 | |
Kojto | 115:87f2f5183dfb | 548 | |
Kojto | 115:87f2f5183dfb | 549 | #define IS_TRANSFER_MODE(MODE) (((MODE) == I2C_RELOAD_MODE) || \ |
Kojto | 115:87f2f5183dfb | 550 | ((MODE) == I2C_AUTOEND_MODE) || \ |
Kojto | 115:87f2f5183dfb | 551 | ((MODE) == I2C_SOFTEND_MODE)) |
Kojto | 115:87f2f5183dfb | 552 | |
Kojto | 115:87f2f5183dfb | 553 | #define IS_TRANSFER_REQUEST(REQUEST) (((REQUEST) == I2C_GENERATE_STOP) || \ |
Kojto | 115:87f2f5183dfb | 554 | ((REQUEST) == I2C_GENERATE_START_READ) || \ |
Kojto | 115:87f2f5183dfb | 555 | ((REQUEST) == I2C_GENERATE_START_WRITE) || \ |
Kojto | 115:87f2f5183dfb | 556 | ((REQUEST) == I2C_NO_STARTSTOP)) |
Kojto | 115:87f2f5183dfb | 557 | |
Kojto | 115:87f2f5183dfb | 558 | |
Kojto | 115:87f2f5183dfb | 559 | #define I2C_RESET_CR2(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= (uint32_t)~((uint32_t)(I2C_CR2_SADD | I2C_CR2_HEAD10R | I2C_CR2_NBYTES | I2C_CR2_RELOAD | I2C_CR2_RD_WRN))) |
Kojto | 115:87f2f5183dfb | 560 | |
Kojto | 115:87f2f5183dfb | 561 | #define IS_I2C_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= (uint32_t)0x000003FF) |
Kojto | 115:87f2f5183dfb | 562 | #define IS_I2C_OWN_ADDRESS2(ADDRESS2) ((ADDRESS2) <= (uint16_t)0x00FF) |
Kojto | 115:87f2f5183dfb | 563 | |
Kojto | 115:87f2f5183dfb | 564 | #define I2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00))) >> 8))) |
Kojto | 115:87f2f5183dfb | 565 | #define I2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF)))) |
Kojto | 115:87f2f5183dfb | 566 | |
Kojto | 115:87f2f5183dfb | 567 | #define I2C_GENERATE_START(__ADDMODE__,__ADDRESS__) (((__ADDMODE__) == I2C_ADDRESSINGMODE_7BIT) ? (uint32_t)((((uint32_t)(__ADDRESS__) & (I2C_CR2_SADD)) | (I2C_CR2_START) | (I2C_CR2_AUTOEND)) & (~I2C_CR2_RD_WRN)) : \ |
Kojto | 115:87f2f5183dfb | 568 | (uint32_t)((((uint32_t)(__ADDRESS__) & (I2C_CR2_SADD)) | (I2C_CR2_ADD10) | (I2C_CR2_START)) & (~I2C_CR2_RD_WRN))) |
Kojto | 115:87f2f5183dfb | 569 | /** |
Kojto | 115:87f2f5183dfb | 570 | * @} |
Kojto | 115:87f2f5183dfb | 571 | */ |
Kojto | 115:87f2f5183dfb | 572 | |
Kojto | 115:87f2f5183dfb | 573 | /* Private Functions ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 574 | /** @defgroup I2C_Private_Functions I2C Private Functions |
Kojto | 115:87f2f5183dfb | 575 | * @{ |
Kojto | 115:87f2f5183dfb | 576 | */ |
Kojto | 115:87f2f5183dfb | 577 | /* Private functions are defined in stm32f7xx_hal_i2c.c file */ |
Kojto | 115:87f2f5183dfb | 578 | /** |
Kojto | 115:87f2f5183dfb | 579 | * @} |
Kojto | 115:87f2f5183dfb | 580 | */ |
Kojto | 115:87f2f5183dfb | 581 | |
Kojto | 115:87f2f5183dfb | 582 | /** |
Kojto | 115:87f2f5183dfb | 583 | * @} |
Kojto | 115:87f2f5183dfb | 584 | */ |
Kojto | 115:87f2f5183dfb | 585 | |
Kojto | 115:87f2f5183dfb | 586 | /** |
Kojto | 115:87f2f5183dfb | 587 | * @} |
Kojto | 115:87f2f5183dfb | 588 | */ |
Kojto | 115:87f2f5183dfb | 589 | |
Kojto | 115:87f2f5183dfb | 590 | #ifdef __cplusplus |
Kojto | 115:87f2f5183dfb | 591 | } |
Kojto | 115:87f2f5183dfb | 592 | #endif |
Kojto | 115:87f2f5183dfb | 593 | |
Kojto | 115:87f2f5183dfb | 594 | |
Kojto | 115:87f2f5183dfb | 595 | #endif /* __STM32F7xx_HAL_I2C_H */ |
Kojto | 115:87f2f5183dfb | 596 | |
Kojto | 115:87f2f5183dfb | 597 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Kojto | 115:87f2f5183dfb | 598 |