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