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_DISCO_F429ZI/stm32f4xx_hal_fmpi2c.h@121:672067c3ada4, 2016-04-14 (annotated)
- Committer:
- elijahorr
- Date:
- Thu Apr 14 07:28:54 2016 +0000
- Revision:
- 121:672067c3ada4
- Parent:
- 110:165afa46840b
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 110:165afa46840b | 1 | /** |
Kojto | 110:165afa46840b | 2 | ****************************************************************************** |
Kojto | 110:165afa46840b | 3 | * @file stm32f4xx_hal_fmpi2c.h |
Kojto | 110:165afa46840b | 4 | * @author MCD Application Team |
Kojto | 110:165afa46840b | 5 | * @version V1.4.1 |
Kojto | 110:165afa46840b | 6 | * @date 09-October-2015 |
Kojto | 110:165afa46840b | 7 | * @brief Header file of FMPI2C HAL module. |
Kojto | 110:165afa46840b | 8 | ****************************************************************************** |
Kojto | 110:165afa46840b | 9 | * @attention |
Kojto | 110:165afa46840b | 10 | * |
Kojto | 110:165afa46840b | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Kojto | 110:165afa46840b | 12 | * |
Kojto | 110:165afa46840b | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 110:165afa46840b | 14 | * are permitted provided that the following conditions are met: |
Kojto | 110:165afa46840b | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 110:165afa46840b | 16 | * this list of conditions and the following disclaimer. |
Kojto | 110:165afa46840b | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 110:165afa46840b | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 110:165afa46840b | 19 | * and/or other materials provided with the distribution. |
Kojto | 110:165afa46840b | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 110:165afa46840b | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 110:165afa46840b | 22 | * without specific prior written permission. |
Kojto | 110:165afa46840b | 23 | * |
Kojto | 110:165afa46840b | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 110:165afa46840b | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 110:165afa46840b | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 110:165afa46840b | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 110:165afa46840b | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 110:165afa46840b | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 110:165afa46840b | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 110:165afa46840b | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 110:165afa46840b | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 110:165afa46840b | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 110:165afa46840b | 34 | * |
Kojto | 110:165afa46840b | 35 | ****************************************************************************** |
Kojto | 110:165afa46840b | 36 | */ |
Kojto | 110:165afa46840b | 37 | |
Kojto | 110:165afa46840b | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 110:165afa46840b | 39 | #ifndef __STM32F4xx_HAL_FMPI2C_H |
Kojto | 110:165afa46840b | 40 | #define __STM32F4xx_HAL_FMPI2C_H |
Kojto | 110:165afa46840b | 41 | |
Kojto | 110:165afa46840b | 42 | #ifdef __cplusplus |
Kojto | 110:165afa46840b | 43 | extern "C" { |
Kojto | 110:165afa46840b | 44 | #endif |
Kojto | 110:165afa46840b | 45 | |
Kojto | 110:165afa46840b | 46 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) |
Kojto | 110:165afa46840b | 47 | |
Kojto | 110:165afa46840b | 48 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 49 | #include "stm32f4xx_hal_def.h" |
Kojto | 110:165afa46840b | 50 | |
Kojto | 110:165afa46840b | 51 | /** @addtogroup STM32F4xx_HAL_Driver |
Kojto | 110:165afa46840b | 52 | * @{ |
Kojto | 110:165afa46840b | 53 | */ |
Kojto | 110:165afa46840b | 54 | |
Kojto | 110:165afa46840b | 55 | /** @addtogroup FMPI2C |
Kojto | 110:165afa46840b | 56 | * @{ |
Kojto | 110:165afa46840b | 57 | */ |
Kojto | 110:165afa46840b | 58 | |
Kojto | 110:165afa46840b | 59 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 60 | /** @defgroup FMPI2C_Exported_Types FMPI2C Exported Types |
Kojto | 110:165afa46840b | 61 | * @{ |
Kojto | 110:165afa46840b | 62 | */ |
Kojto | 110:165afa46840b | 63 | |
Kojto | 110:165afa46840b | 64 | /** |
Kojto | 110:165afa46840b | 65 | * @brief FMPI2C Configuration Structure definition |
Kojto | 110:165afa46840b | 66 | */ |
Kojto | 110:165afa46840b | 67 | typedef struct |
Kojto | 110:165afa46840b | 68 | { |
Kojto | 110:165afa46840b | 69 | uint32_t Timing; /*!< Specifies the FMPI2C_TIMINGR_register value. |
Kojto | 110:165afa46840b | 70 | This parameter calculated by referring to FMPI2C initialization |
Kojto | 110:165afa46840b | 71 | section in Reference manual */ |
Kojto | 110:165afa46840b | 72 | |
Kojto | 110:165afa46840b | 73 | uint32_t OwnAddress1; /*!< Specifies the first device own address. |
Kojto | 110:165afa46840b | 74 | This parameter can be a 7-bit or 10-bit address. */ |
Kojto | 110:165afa46840b | 75 | |
Kojto | 110:165afa46840b | 76 | uint32_t AddressingMode; /*!< Specifies if 7-bit or 10-bit addressing mode is selected. |
Kojto | 110:165afa46840b | 77 | This parameter can be a value of @ref FMPI2C_addressing_mode */ |
Kojto | 110:165afa46840b | 78 | |
Kojto | 110:165afa46840b | 79 | uint32_t DualAddressMode; /*!< Specifies if dual addressing mode is selected. |
Kojto | 110:165afa46840b | 80 | This parameter can be a value of @ref FMPI2C_dual_addressing_mode */ |
Kojto | 110:165afa46840b | 81 | |
Kojto | 110:165afa46840b | 82 | uint32_t OwnAddress2; /*!< Specifies the second device own address if dual addressing mode is selected |
Kojto | 110:165afa46840b | 83 | This parameter can be a 7-bit address. */ |
Kojto | 110:165afa46840b | 84 | |
Kojto | 110:165afa46840b | 85 | uint32_t OwnAddress2Masks; /*!< Specifies the acknoledge mask address second device own address if dual addressing mode is selected |
Kojto | 110:165afa46840b | 86 | This parameter can be a value of @ref FMPI2C_own_address2_masks */ |
Kojto | 110:165afa46840b | 87 | |
Kojto | 110:165afa46840b | 88 | uint32_t GeneralCallMode; /*!< Specifies if general call mode is selected. |
Kojto | 110:165afa46840b | 89 | This parameter can be a value of @ref FMPI2C_general_call_addressing_mode */ |
Kojto | 110:165afa46840b | 90 | |
Kojto | 110:165afa46840b | 91 | uint32_t NoStretchMode; /*!< Specifies if nostretch mode is selected. |
Kojto | 110:165afa46840b | 92 | This parameter can be a value of @ref FMPI2C_nostretch_mode */ |
Kojto | 110:165afa46840b | 93 | |
Kojto | 110:165afa46840b | 94 | }FMPI2C_InitTypeDef; |
Kojto | 110:165afa46840b | 95 | |
Kojto | 110:165afa46840b | 96 | /** |
Kojto | 110:165afa46840b | 97 | * @brief HAL State structures definition |
Kojto | 110:165afa46840b | 98 | */ |
Kojto | 110:165afa46840b | 99 | typedef enum |
Kojto | 110:165afa46840b | 100 | { |
Kojto | 110:165afa46840b | 101 | HAL_FMPI2C_STATE_RESET = 0x00, /*!< FMPI2C not yet initialized or disabled */ |
Kojto | 110:165afa46840b | 102 | HAL_FMPI2C_STATE_READY = 0x01, /*!< FMPI2C initialized and ready for use */ |
Kojto | 110:165afa46840b | 103 | HAL_FMPI2C_STATE_BUSY = 0x02, /*!< FMPI2C internal process is ongoing */ |
Kojto | 110:165afa46840b | 104 | HAL_FMPI2C_STATE_MASTER_BUSY_TX = 0x12, /*!< Master Data Transmission process is ongoing */ |
Kojto | 110:165afa46840b | 105 | HAL_FMPI2C_STATE_MASTER_BUSY_RX = 0x22, /*!< Master Data Reception process is ongoing */ |
Kojto | 110:165afa46840b | 106 | HAL_FMPI2C_STATE_SLAVE_BUSY_TX = 0x32, /*!< Slave Data Transmission process is ongoing */ |
Kojto | 110:165afa46840b | 107 | HAL_FMPI2C_STATE_SLAVE_BUSY_RX = 0x42, /*!< Slave Data Reception process is ongoing */ |
Kojto | 110:165afa46840b | 108 | HAL_FMPI2C_STATE_MEM_BUSY_TX = 0x52, /*!< Memory Data Transmission process is ongoing */ |
Kojto | 110:165afa46840b | 109 | HAL_FMPI2C_STATE_MEM_BUSY_RX = 0x62, /*!< Memory Data Reception process is ongoing */ |
Kojto | 110:165afa46840b | 110 | HAL_FMPI2C_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 110:165afa46840b | 111 | HAL_FMPI2C_STATE_ERROR = 0x04 /*!< Reception process is ongoing */ |
Kojto | 110:165afa46840b | 112 | }HAL_FMPI2C_StateTypeDef; |
Kojto | 110:165afa46840b | 113 | |
Kojto | 110:165afa46840b | 114 | /** |
Kojto | 110:165afa46840b | 115 | * @brief HAL FMPI2C Error Code structure definition |
Kojto | 110:165afa46840b | 116 | */ |
Kojto | 110:165afa46840b | 117 | typedef enum |
Kojto | 110:165afa46840b | 118 | { |
Kojto | 110:165afa46840b | 119 | HAL_FMPI2C_ERROR_NONE = 0x00, /*!< No error */ |
Kojto | 110:165afa46840b | 120 | HAL_FMPI2C_ERROR_BERR = 0x01, /*!< BERR error */ |
Kojto | 110:165afa46840b | 121 | HAL_FMPI2C_ERROR_ARLO = 0x02, /*!< ARLO error */ |
Kojto | 110:165afa46840b | 122 | HAL_FMPI2C_ERROR_AF = 0x04, /*!< ACKF error */ |
Kojto | 110:165afa46840b | 123 | HAL_FMPI2C_ERROR_OVR = 0x08, /*!< OVR error */ |
Kojto | 110:165afa46840b | 124 | HAL_FMPI2C_ERROR_DMA = 0x10, /*!< DMA transfer error */ |
Kojto | 110:165afa46840b | 125 | HAL_FMPI2C_ERROR_TIMEOUT = 0x20, /*!< Timeout error */ |
Kojto | 110:165afa46840b | 126 | HAL_FMPI2C_ERROR_SIZE = 0x40 /*!< Size Management error */ |
Kojto | 110:165afa46840b | 127 | }HAL_FMPI2C_ErrorTypeDef; |
Kojto | 110:165afa46840b | 128 | |
Kojto | 110:165afa46840b | 129 | /** |
Kojto | 110:165afa46840b | 130 | * @brief FMPI2C handle Structure definition |
Kojto | 110:165afa46840b | 131 | */ |
Kojto | 110:165afa46840b | 132 | typedef struct |
Kojto | 110:165afa46840b | 133 | { |
Kojto | 110:165afa46840b | 134 | FMPI2C_TypeDef *Instance; /*!< FMPI2C registers base address */ |
Kojto | 110:165afa46840b | 135 | |
Kojto | 110:165afa46840b | 136 | FMPI2C_InitTypeDef Init; /*!< FMPI2C communication parameters */ |
Kojto | 110:165afa46840b | 137 | |
Kojto | 110:165afa46840b | 138 | uint8_t *pBuffPtr; /*!< Pointer to FMPI2C transfer buffer */ |
Kojto | 110:165afa46840b | 139 | |
Kojto | 110:165afa46840b | 140 | uint16_t XferSize; /*!< FMPI2C transfer size */ |
Kojto | 110:165afa46840b | 141 | |
Kojto | 110:165afa46840b | 142 | __IO uint16_t XferCount; /*!< FMPI2C transfer counter */ |
Kojto | 110:165afa46840b | 143 | |
Kojto | 110:165afa46840b | 144 | DMA_HandleTypeDef *hdmatx; /*!< FMPI2C Tx DMA handle parameters */ |
Kojto | 110:165afa46840b | 145 | |
Kojto | 110:165afa46840b | 146 | DMA_HandleTypeDef *hdmarx; /*!< FMPI2C Rx DMA handle parameters */ |
Kojto | 110:165afa46840b | 147 | |
Kojto | 110:165afa46840b | 148 | HAL_LockTypeDef Lock; /*!< FMPI2C locking object */ |
Kojto | 110:165afa46840b | 149 | |
Kojto | 110:165afa46840b | 150 | __IO HAL_FMPI2C_StateTypeDef State; /*!< FMPI2C communication state */ |
Kojto | 110:165afa46840b | 151 | |
Kojto | 110:165afa46840b | 152 | __IO HAL_FMPI2C_ErrorTypeDef ErrorCode; /* FMPI2C Error code */ |
Kojto | 110:165afa46840b | 153 | |
Kojto | 110:165afa46840b | 154 | }FMPI2C_HandleTypeDef; |
Kojto | 110:165afa46840b | 155 | /** |
Kojto | 110:165afa46840b | 156 | * @} |
Kojto | 110:165afa46840b | 157 | */ |
Kojto | 110:165afa46840b | 158 | |
Kojto | 110:165afa46840b | 159 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 160 | |
Kojto | 110:165afa46840b | 161 | /** @defgroup FMPI2C_Exported_Constants FMPI2C Exported Constants |
Kojto | 110:165afa46840b | 162 | * @{ |
Kojto | 110:165afa46840b | 163 | */ |
Kojto | 110:165afa46840b | 164 | |
Kojto | 110:165afa46840b | 165 | /** @defgroup FMPI2C_addressing_mode FMPI2C addressing mode |
Kojto | 110:165afa46840b | 166 | * @{ |
Kojto | 110:165afa46840b | 167 | */ |
Kojto | 110:165afa46840b | 168 | #define FMPI2C_ADDRESSINGMODE_7BIT ((uint32_t)0x00000001) |
Kojto | 110:165afa46840b | 169 | #define FMPI2C_ADDRESSINGMODE_10BIT ((uint32_t)0x00000002) |
Kojto | 110:165afa46840b | 170 | |
Kojto | 110:165afa46840b | 171 | /** |
Kojto | 110:165afa46840b | 172 | * @} |
Kojto | 110:165afa46840b | 173 | */ |
Kojto | 110:165afa46840b | 174 | |
Kojto | 110:165afa46840b | 175 | /** @defgroup FMPI2C_dual_addressing_mode FMPI2C dual addressing mode |
Kojto | 110:165afa46840b | 176 | * @{ |
Kojto | 110:165afa46840b | 177 | */ |
Kojto | 110:165afa46840b | 178 | |
Kojto | 110:165afa46840b | 179 | #define FMPI2C_DUALADDRESS_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 180 | #define FMPI2C_DUALADDRESS_ENABLE FMPI2C_OAR2_OA2EN |
Kojto | 110:165afa46840b | 181 | |
Kojto | 110:165afa46840b | 182 | /** |
Kojto | 110:165afa46840b | 183 | * @} |
Kojto | 110:165afa46840b | 184 | */ |
Kojto | 110:165afa46840b | 185 | |
Kojto | 110:165afa46840b | 186 | /** @defgroup FMPI2C_own_address2_masks FMPI2C own address2 masks |
Kojto | 110:165afa46840b | 187 | * @{ |
Kojto | 110:165afa46840b | 188 | */ |
Kojto | 110:165afa46840b | 189 | |
Kojto | 110:165afa46840b | 190 | #define FMPI2C_OA2_NOMASK ((uint8_t)0x00) |
Kojto | 110:165afa46840b | 191 | #define FMPI2C_OA2_MASK01 ((uint8_t)0x01) |
Kojto | 110:165afa46840b | 192 | #define FMPI2C_OA2_MASK02 ((uint8_t)0x02) |
Kojto | 110:165afa46840b | 193 | #define FMPI2C_OA2_MASK03 ((uint8_t)0x03) |
Kojto | 110:165afa46840b | 194 | #define FMPI2C_OA2_MASK04 ((uint8_t)0x04) |
Kojto | 110:165afa46840b | 195 | #define FMPI2C_OA2_MASK05 ((uint8_t)0x05) |
Kojto | 110:165afa46840b | 196 | #define FMPI2C_OA2_MASK06 ((uint8_t)0x06) |
Kojto | 110:165afa46840b | 197 | #define FMPI2C_OA2_MASK07 ((uint8_t)0x07) |
Kojto | 110:165afa46840b | 198 | |
Kojto | 110:165afa46840b | 199 | /** |
Kojto | 110:165afa46840b | 200 | * @} |
Kojto | 110:165afa46840b | 201 | */ |
Kojto | 110:165afa46840b | 202 | |
Kojto | 110:165afa46840b | 203 | /** @defgroup FMPI2C_general_call_addressing_mode FMPI2C general call addressing mode |
Kojto | 110:165afa46840b | 204 | * @{ |
Kojto | 110:165afa46840b | 205 | */ |
Kojto | 110:165afa46840b | 206 | #define FMPI2C_GENERALCALL_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 207 | #define FMPI2C_GENERALCALL_ENABLE FMPI2C_CR1_GCEN |
Kojto | 110:165afa46840b | 208 | |
Kojto | 110:165afa46840b | 209 | /** |
Kojto | 110:165afa46840b | 210 | * @} |
Kojto | 110:165afa46840b | 211 | */ |
Kojto | 110:165afa46840b | 212 | |
Kojto | 110:165afa46840b | 213 | /** @defgroup FMPI2C_nostretch_mode FMPI2C nostretch mode |
Kojto | 110:165afa46840b | 214 | * @{ |
Kojto | 110:165afa46840b | 215 | */ |
Kojto | 110:165afa46840b | 216 | #define FMPI2C_NOSTRETCH_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 217 | #define FMPI2C_NOSTRETCH_ENABLE FMPI2C_CR1_NOSTRETCH |
Kojto | 110:165afa46840b | 218 | |
Kojto | 110:165afa46840b | 219 | /** |
Kojto | 110:165afa46840b | 220 | * @} |
Kojto | 110:165afa46840b | 221 | */ |
Kojto | 110:165afa46840b | 222 | |
Kojto | 110:165afa46840b | 223 | /** @defgroup FMPI2C_Memory_Address_Size FMPI2C Memory Address Size |
Kojto | 110:165afa46840b | 224 | * @{ |
Kojto | 110:165afa46840b | 225 | */ |
Kojto | 110:165afa46840b | 226 | #define FMPI2C_MEMADD_SIZE_8BIT ((uint32_t)0x00000001) |
Kojto | 110:165afa46840b | 227 | #define FMPI2C_MEMADD_SIZE_16BIT ((uint32_t)0x00000002) |
Kojto | 110:165afa46840b | 228 | |
Kojto | 110:165afa46840b | 229 | /** |
Kojto | 110:165afa46840b | 230 | * @} |
Kojto | 110:165afa46840b | 231 | */ |
Kojto | 110:165afa46840b | 232 | |
Kojto | 110:165afa46840b | 233 | /** @defgroup FMPI2C_ReloadEndMode_definition FMPI2C ReloadEndMode definition |
Kojto | 110:165afa46840b | 234 | * @{ |
Kojto | 110:165afa46840b | 235 | */ |
Kojto | 110:165afa46840b | 236 | |
Kojto | 110:165afa46840b | 237 | #define FMPI2C_RELOAD_MODE FMPI2C_CR2_RELOAD |
Kojto | 110:165afa46840b | 238 | #define FMPI2C_AUTOEND_MODE FMPI2C_CR2_AUTOEND |
Kojto | 110:165afa46840b | 239 | #define FMPI2C_SOFTEND_MODE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 240 | |
Kojto | 110:165afa46840b | 241 | /** |
Kojto | 110:165afa46840b | 242 | * @} |
Kojto | 110:165afa46840b | 243 | */ |
Kojto | 110:165afa46840b | 244 | |
Kojto | 110:165afa46840b | 245 | /** @defgroup FMPI2C_StartStopMode_definition FMPI2C StartStopMode definition |
Kojto | 110:165afa46840b | 246 | * @{ |
Kojto | 110:165afa46840b | 247 | */ |
Kojto | 110:165afa46840b | 248 | |
Kojto | 110:165afa46840b | 249 | #define FMPI2C_NO_STARTSTOP ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 250 | #define FMPI2C_GENERATE_STOP FMPI2C_CR2_STOP |
Kojto | 110:165afa46840b | 251 | #define FMPI2C_GENERATE_START_READ (uint32_t)(FMPI2C_CR2_START | FMPI2C_CR2_RD_WRN) |
Kojto | 110:165afa46840b | 252 | #define FMPI2C_GENERATE_START_WRITE FMPI2C_CR2_START |
Kojto | 110:165afa46840b | 253 | |
Kojto | 110:165afa46840b | 254 | /** |
Kojto | 110:165afa46840b | 255 | * @} |
Kojto | 110:165afa46840b | 256 | */ |
Kojto | 110:165afa46840b | 257 | |
Kojto | 110:165afa46840b | 258 | /** @defgroup FMPI2C_Interrupt_configuration_definition FMPI2C Interrupt configuration definition |
Kojto | 110:165afa46840b | 259 | * @brief FMPI2C Interrupt definition |
Kojto | 110:165afa46840b | 260 | * Elements values convention: 0xXXXXXXXX |
Kojto | 110:165afa46840b | 261 | * - XXXXXXXX : Interrupt control mask |
Kojto | 110:165afa46840b | 262 | * @{ |
Kojto | 110:165afa46840b | 263 | */ |
Kojto | 110:165afa46840b | 264 | #define FMPI2C_IT_ERRI FMPI2C_CR1_ERRIE |
Kojto | 110:165afa46840b | 265 | #define FMPI2C_IT_TCI FMPI2C_CR1_TCIE |
Kojto | 110:165afa46840b | 266 | #define FMPI2C_IT_STOPI FMPI2C_CR1_STOPIE |
Kojto | 110:165afa46840b | 267 | #define FMPI2C_IT_NACKI FMPI2C_CR1_NACKIE |
Kojto | 110:165afa46840b | 268 | #define FMPI2C_IT_ADDRI FMPI2C_CR1_ADDRIE |
Kojto | 110:165afa46840b | 269 | #define FMPI2C_IT_RXI FMPI2C_CR1_RXIE |
Kojto | 110:165afa46840b | 270 | #define FMPI2C_IT_TXI FMPI2C_CR1_TXIE |
Kojto | 110:165afa46840b | 271 | |
Kojto | 110:165afa46840b | 272 | /** |
Kojto | 110:165afa46840b | 273 | * @} |
Kojto | 110:165afa46840b | 274 | */ |
Kojto | 110:165afa46840b | 275 | |
Kojto | 110:165afa46840b | 276 | |
Kojto | 110:165afa46840b | 277 | /** @defgroup FMPI2C_Flag_definition FMPI2C Flag definition |
Kojto | 110:165afa46840b | 278 | * @{ |
Kojto | 110:165afa46840b | 279 | */ |
Kojto | 110:165afa46840b | 280 | |
Kojto | 110:165afa46840b | 281 | #define FMPI2C_FLAG_TXE FMPI2C_ISR_TXE |
Kojto | 110:165afa46840b | 282 | #define FMPI2C_FLAG_TXIS FMPI2C_ISR_TXIS |
Kojto | 110:165afa46840b | 283 | #define FMPI2C_FLAG_RXNE FMPI2C_ISR_RXNE |
Kojto | 110:165afa46840b | 284 | #define FMPI2C_FLAG_ADDR FMPI2C_ISR_ADDR |
Kojto | 110:165afa46840b | 285 | #define FMPI2C_FLAG_AF FMPI2C_ISR_NACKF |
Kojto | 110:165afa46840b | 286 | #define FMPI2C_FLAG_STOPF FMPI2C_ISR_STOPF |
Kojto | 110:165afa46840b | 287 | #define FMPI2C_FLAG_TC FMPI2C_ISR_TC |
Kojto | 110:165afa46840b | 288 | #define FMPI2C_FLAG_TCR FMPI2C_ISR_TCR |
Kojto | 110:165afa46840b | 289 | #define FMPI2C_FLAG_BERR FMPI2C_ISR_BERR |
Kojto | 110:165afa46840b | 290 | #define FMPI2C_FLAG_ARLO FMPI2C_ISR_ARLO |
Kojto | 110:165afa46840b | 291 | #define FMPI2C_FLAG_OVR FMPI2C_ISR_OVR |
Kojto | 110:165afa46840b | 292 | #define FMPI2C_FLAG_PECERR FMPI2C_ISR_PECERR |
Kojto | 110:165afa46840b | 293 | #define FMPI2C_FLAG_TIMEOUT FMPI2C_ISR_TIMEOUT |
Kojto | 110:165afa46840b | 294 | #define FMPI2C_FLAG_ALERT FMPI2C_ISR_ALERT |
Kojto | 110:165afa46840b | 295 | #define FMPI2C_FLAG_BUSY FMPI2C_ISR_BUSY |
Kojto | 110:165afa46840b | 296 | #define FMPI2C_FLAG_DIR FMPI2C_ISR_DIR |
Kojto | 110:165afa46840b | 297 | |
Kojto | 110:165afa46840b | 298 | /** |
Kojto | 110:165afa46840b | 299 | * @} |
Kojto | 110:165afa46840b | 300 | */ |
Kojto | 110:165afa46840b | 301 | |
Kojto | 110:165afa46840b | 302 | /** |
Kojto | 110:165afa46840b | 303 | * @} |
Kojto | 110:165afa46840b | 304 | */ |
Kojto | 110:165afa46840b | 305 | |
Kojto | 110:165afa46840b | 306 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 307 | /** @defgroup FMPI2C_Exported_Macros FMPI2C Exported Macros |
Kojto | 110:165afa46840b | 308 | * @{ |
Kojto | 110:165afa46840b | 309 | */ |
Kojto | 110:165afa46840b | 310 | |
Kojto | 110:165afa46840b | 311 | /** @brief Reset FMPI2C handle state |
Kojto | 110:165afa46840b | 312 | * @param __HANDLE__: specifies the FMPI2C Handle. |
Kojto | 110:165afa46840b | 313 | * This parameter can be FMPI2C where x: 1 or 2 to select the FMPI2C peripheral. |
Kojto | 110:165afa46840b | 314 | * @retval None |
Kojto | 110:165afa46840b | 315 | */ |
Kojto | 110:165afa46840b | 316 | #define __HAL_FMPI2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_FMPI2C_STATE_RESET) |
Kojto | 110:165afa46840b | 317 | |
Kojto | 110:165afa46840b | 318 | /** @brief Enables or disables the specified FMPI2C interrupts. |
Kojto | 110:165afa46840b | 319 | * @param __HANDLE__: specifies the FMPI2C Handle. |
Kojto | 110:165afa46840b | 320 | * This parameter can be FMPI2C where x: 1 or 2 to select the FMPI2C peripheral. |
Kojto | 110:165afa46840b | 321 | * @param __INTERRUPT__: specifies the interrupt source to enable or disable. |
Kojto | 110:165afa46840b | 322 | * This parameter can be one of the following values: |
Kojto | 110:165afa46840b | 323 | * @arg FMPI2C_IT_ERRI: Errors interrupt enable |
Kojto | 110:165afa46840b | 324 | * @arg FMPI2C_IT_TCI: Transfer complete interrupt enable |
Kojto | 110:165afa46840b | 325 | * @arg FMPI2C_IT_STOPI: STOP detection interrupt enable |
Kojto | 110:165afa46840b | 326 | * @arg FMPI2C_IT_NACKI: NACK received interrupt enable |
Kojto | 110:165afa46840b | 327 | * @arg FMPI2C_IT_ADDRI: Address match interrupt enable |
Kojto | 110:165afa46840b | 328 | * @arg FMPI2C_IT_RXI: RX interrupt enable |
Kojto | 110:165afa46840b | 329 | * @arg FMPI2C_IT_TXI: TX interrupt enable |
Kojto | 110:165afa46840b | 330 | * |
Kojto | 110:165afa46840b | 331 | * @retval None |
Kojto | 110:165afa46840b | 332 | */ |
Kojto | 110:165afa46840b | 333 | |
Kojto | 110:165afa46840b | 334 | #define __HAL_FMPI2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__)) |
Kojto | 110:165afa46840b | 335 | #define __HAL_FMPI2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__))) |
Kojto | 110:165afa46840b | 336 | |
Kojto | 110:165afa46840b | 337 | /** @brief Checks if the specified FMPI2C interrupt source is enabled or disabled. |
Kojto | 110:165afa46840b | 338 | * @param __HANDLE__: specifies the FMPI2C Handle. |
Kojto | 110:165afa46840b | 339 | * This parameter can be FMPI2C where x: 1 or 2 to select the FMPI2C peripheral. |
Kojto | 110:165afa46840b | 340 | * @param __INTERRUPT__: specifies the FMPI2C interrupt source to check. |
Kojto | 110:165afa46840b | 341 | * This parameter can be one of the following values: |
Kojto | 110:165afa46840b | 342 | * @arg FMPI2C_IT_ERRI: Errors interrupt enable |
Kojto | 110:165afa46840b | 343 | * @arg FMPI2C_IT_TCI: Transfer complete interrupt enable |
Kojto | 110:165afa46840b | 344 | * @arg FMPI2C_IT_STOPI: STOP detection interrupt enable |
Kojto | 110:165afa46840b | 345 | * @arg FMPI2C_IT_NACKI: NACK received interrupt enable |
Kojto | 110:165afa46840b | 346 | * @arg FMPI2C_IT_ADDRI: Address match interrupt enable |
Kojto | 110:165afa46840b | 347 | * @arg FMPI2C_IT_RXI: RX interrupt enable |
Kojto | 110:165afa46840b | 348 | * @arg FMPI2C_IT_TXI: TX interrupt enable |
Kojto | 110:165afa46840b | 349 | * |
Kojto | 110:165afa46840b | 350 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 110:165afa46840b | 351 | */ |
Kojto | 110:165afa46840b | 352 | #define __HAL_FMPI2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
Kojto | 110:165afa46840b | 353 | |
Kojto | 110:165afa46840b | 354 | /** @brief Checks whether the specified FMPI2C flag is set or not. |
Kojto | 110:165afa46840b | 355 | * @param __HANDLE__: specifies the FMPI2C Handle. |
Kojto | 110:165afa46840b | 356 | * This parameter can be FMPI2C where x: 1 or 2 to select the FMPI2C peripheral. |
Kojto | 110:165afa46840b | 357 | * @param __FLAG__: specifies the flag to check. |
Kojto | 110:165afa46840b | 358 | * This parameter can be one of the following values: |
Kojto | 110:165afa46840b | 359 | * @arg FMPI2C_FLAG_TXE: Transmit data register empty |
Kojto | 110:165afa46840b | 360 | * @arg FMPI2C_FLAG_TXIS: Transmit interrupt status |
Kojto | 110:165afa46840b | 361 | * @arg FMPI2C_FLAG_RXNE: Receive data register not empty |
Kojto | 110:165afa46840b | 362 | * @arg FMPI2C_FLAG_ADDR: Address matched (slave mode) |
Kojto | 110:165afa46840b | 363 | * @arg FMPI2C_FLAG_AF: Acknowledge failure received flag |
Kojto | 110:165afa46840b | 364 | * @arg FMPI2C_FLAG_STOPF: STOP detection flag |
Kojto | 110:165afa46840b | 365 | * @arg FMPI2C_FLAG_TC: Transfer complete (master mode) |
Kojto | 110:165afa46840b | 366 | * @arg FMPI2C_FLAG_TCR: Transfer complete reload |
Kojto | 110:165afa46840b | 367 | * @arg FMPI2C_FLAG_BERR: Bus error |
Kojto | 110:165afa46840b | 368 | * @arg FMPI2C_FLAG_ARLO: Arbitration lost |
Kojto | 110:165afa46840b | 369 | * @arg FMPI2C_FLAG_OVR: Overrun/Underrun |
Kojto | 110:165afa46840b | 370 | * @arg FMPI2C_FLAG_PECERR: PEC error in reception |
Kojto | 110:165afa46840b | 371 | * @arg FMPI2C_FLAG_TIMEOUT: Timeout or Tlow detection flag |
Kojto | 110:165afa46840b | 372 | * @arg FMPI2C_FLAG_ALERT: SMBus alert |
Kojto | 110:165afa46840b | 373 | * @arg FMPI2C_FLAG_BUSY: Bus busy |
Kojto | 110:165afa46840b | 374 | * @arg FMPI2C_FLAG_DIR: Transfer direction (slave mode) |
Kojto | 110:165afa46840b | 375 | * |
Kojto | 110:165afa46840b | 376 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 110:165afa46840b | 377 | */ |
Kojto | 110:165afa46840b | 378 | #define __HAL_FMPI2C_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__) & FMPI2C_FLAG_MASK)) == ((__FLAG__) & FMPI2C_FLAG_MASK))) |
Kojto | 110:165afa46840b | 379 | |
Kojto | 110:165afa46840b | 380 | /** @brief Clears the FMPI2C pending flags which are cleared by writing 1 in a specific bit. |
Kojto | 110:165afa46840b | 381 | * @param __HANDLE__: specifies the FMPI2C Handle. |
Kojto | 110:165afa46840b | 382 | * This parameter can be FMPI2C where x: 1 or 2 to select the FMPI2C peripheral. |
Kojto | 110:165afa46840b | 383 | * @param __FLAG__: specifies the flag to clear. |
Kojto | 110:165afa46840b | 384 | * This parameter can be any combination of the following values: |
Kojto | 110:165afa46840b | 385 | * @arg FMPI2C_FLAG_ADDR: Address matched (slave mode) |
Kojto | 110:165afa46840b | 386 | * @arg FMPI2C_FLAG_AF: Acknowledge failure received flag |
Kojto | 110:165afa46840b | 387 | * @arg FMPI2C_FLAG_STOPF: STOP detection flag |
Kojto | 110:165afa46840b | 388 | * @arg FMPI2C_FLAG_BERR: Bus error |
Kojto | 110:165afa46840b | 389 | * @arg FMPI2C_FLAG_ARLO: Arbitration lost |
Kojto | 110:165afa46840b | 390 | * @arg FMPI2C_FLAG_OVR: Overrun/Underrun |
Kojto | 110:165afa46840b | 391 | * @arg FMPI2C_FLAG_PECERR: PEC error in reception |
Kojto | 110:165afa46840b | 392 | * @arg FMPI2C_FLAG_TIMEOUT: Timeout or Tlow detection flag |
Kojto | 110:165afa46840b | 393 | * @arg FMPI2C_FLAG_ALERT: SMBus alert |
Kojto | 110:165afa46840b | 394 | * |
Kojto | 110:165afa46840b | 395 | * @retval None |
Kojto | 110:165afa46840b | 396 | */ |
Kojto | 110:165afa46840b | 397 | #define __HAL_FMPI2C_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = ((__FLAG__) & FMPI2C_FLAG_MASK)) |
Kojto | 110:165afa46840b | 398 | |
Kojto | 110:165afa46840b | 399 | |
Kojto | 110:165afa46840b | 400 | #define __HAL_FMPI2C_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= FMPI2C_CR1_PE) |
Kojto | 110:165afa46840b | 401 | #define __HAL_FMPI2C_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~FMPI2C_CR1_PE) |
Kojto | 110:165afa46840b | 402 | |
Kojto | 110:165afa46840b | 403 | #define __HAL_FMPI2C_RESET_CR2(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= (uint32_t)~((uint32_t)(FMPI2C_CR2_SADD | FMPI2C_CR2_HEAD10R | FMPI2C_CR2_NBYTES | FMPI2C_CR2_RELOAD | FMPI2C_CR2_RD_WRN))) |
Kojto | 110:165afa46840b | 404 | |
Kojto | 110:165afa46840b | 405 | #define __HAL_FMPI2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00))) >> 8))) |
Kojto | 110:165afa46840b | 406 | #define __HAL_FMPI2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF)))) |
Kojto | 110:165afa46840b | 407 | |
Kojto | 110:165afa46840b | 408 | #define __HAL_FMPI2C_GENERATE_START(__ADDMODE__,__ADDRESS__) (((__ADDMODE__) == FMPI2C_ADDRESSINGMODE_7BIT) ? (uint32_t)((((uint32_t)(__ADDRESS__) & (FMPI2C_CR2_SADD)) | (FMPI2C_CR2_START) | (FMPI2C_CR2_AUTOEND)) & (~FMPI2C_CR2_RD_WRN)) : \ |
Kojto | 110:165afa46840b | 409 | (uint32_t)((((uint32_t)(__ADDRESS__) & (FMPI2C_CR2_SADD)) | (FMPI2C_CR2_ADD10) | (FMPI2C_CR2_START)) & (~FMPI2C_CR2_RD_WRN))) |
Kojto | 110:165afa46840b | 410 | |
Kojto | 110:165afa46840b | 411 | #define IS_FMPI2C_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= (uint32_t)0x000003FF) |
Kojto | 110:165afa46840b | 412 | #define IS_FMPI2C_OWN_ADDRESS2(ADDRESS2) ((ADDRESS2) <= (uint16_t)0x00FF) |
Kojto | 110:165afa46840b | 413 | |
Kojto | 110:165afa46840b | 414 | /** |
Kojto | 110:165afa46840b | 415 | * @} |
Kojto | 110:165afa46840b | 416 | */ |
Kojto | 110:165afa46840b | 417 | |
Kojto | 110:165afa46840b | 418 | /* Include FMPI2C HAL Extension module */ |
Kojto | 110:165afa46840b | 419 | #include "stm32f4xx_hal_fmpi2c_ex.h" |
Kojto | 110:165afa46840b | 420 | |
Kojto | 110:165afa46840b | 421 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 422 | /** @addtogroup FMPI2C_Exported_Functions |
Kojto | 110:165afa46840b | 423 | * @{ |
Kojto | 110:165afa46840b | 424 | */ |
Kojto | 110:165afa46840b | 425 | |
Kojto | 110:165afa46840b | 426 | /** @addtogroup FMPI2C_Exported_Functions_Group1 |
Kojto | 110:165afa46840b | 427 | * @{ |
Kojto | 110:165afa46840b | 428 | */ |
Kojto | 110:165afa46840b | 429 | |
Kojto | 110:165afa46840b | 430 | /* Initialization/de-initialization functions**********************************/ |
Kojto | 110:165afa46840b | 431 | HAL_StatusTypeDef HAL_FMPI2C_Init(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 432 | HAL_StatusTypeDef HAL_FMPI2C_DeInit (FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 433 | void HAL_FMPI2C_MspInit(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 434 | void HAL_FMPI2C_MspDeInit(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 435 | |
Kojto | 110:165afa46840b | 436 | /** |
Kojto | 110:165afa46840b | 437 | * @} |
Kojto | 110:165afa46840b | 438 | */ |
Kojto | 110:165afa46840b | 439 | |
Kojto | 110:165afa46840b | 440 | /** @addtogroup FMPI2C_Exported_Functions_Group2 |
Kojto | 110:165afa46840b | 441 | * @{ |
Kojto | 110:165afa46840b | 442 | */ |
Kojto | 110:165afa46840b | 443 | |
Kojto | 110:165afa46840b | 444 | /* I/O operation functions ***************************************************/ |
Kojto | 110:165afa46840b | 445 | /******* Blocking mode: Polling */ |
Kojto | 110:165afa46840b | 446 | HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 110:165afa46840b | 447 | HAL_StatusTypeDef HAL_FMPI2C_Master_Receive(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 110:165afa46840b | 448 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit(FMPI2C_HandleTypeDef *hFMPI2C, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 110:165afa46840b | 449 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive(FMPI2C_HandleTypeDef *hFMPI2C, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 110:165afa46840b | 450 | HAL_StatusTypeDef HAL_FMPI2C_Mem_Write(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 110:165afa46840b | 451 | HAL_StatusTypeDef HAL_FMPI2C_Mem_Read(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 110:165afa46840b | 452 | HAL_StatusTypeDef HAL_FMPI2C_IsDeviceReady(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout); |
Kojto | 110:165afa46840b | 453 | |
Kojto | 110:165afa46840b | 454 | /******* Non-Blocking mode: Interrupt */ |
Kojto | 110:165afa46840b | 455 | HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit_IT(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 456 | HAL_StatusTypeDef HAL_FMPI2C_Master_Receive_IT(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 457 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit_IT(FMPI2C_HandleTypeDef *hFMPI2C, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 458 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive_IT(FMPI2C_HandleTypeDef *hFMPI2C, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 459 | HAL_StatusTypeDef HAL_FMPI2C_Mem_Write_IT(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 460 | HAL_StatusTypeDef HAL_FMPI2C_Mem_Read_IT(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 461 | |
Kojto | 110:165afa46840b | 462 | /******* Non-Blocking mode: DMA */ |
Kojto | 110:165afa46840b | 463 | HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit_DMA(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 464 | HAL_StatusTypeDef HAL_FMPI2C_Master_Receive_DMA(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 465 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit_DMA(FMPI2C_HandleTypeDef *hFMPI2C, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 466 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive_DMA(FMPI2C_HandleTypeDef *hFMPI2C, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 467 | HAL_StatusTypeDef HAL_FMPI2C_Mem_Write_DMA(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 468 | HAL_StatusTypeDef HAL_FMPI2C_Mem_Read_DMA(FMPI2C_HandleTypeDef *hFMPI2C, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); |
Kojto | 110:165afa46840b | 469 | |
Kojto | 110:165afa46840b | 470 | /******* FMPI2C IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ |
Kojto | 110:165afa46840b | 471 | void HAL_FMPI2C_EV_IRQHandler(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 472 | void HAL_FMPI2C_ER_IRQHandler(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 473 | void HAL_FMPI2C_MasterTxCpltCallback(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 474 | void HAL_FMPI2C_MasterRxCpltCallback(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 475 | void HAL_FMPI2C_SlaveTxCpltCallback(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 476 | void HAL_FMPI2C_SlaveRxCpltCallback(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 477 | void HAL_FMPI2C_MemTxCpltCallback(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 478 | void HAL_FMPI2C_MemRxCpltCallback(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 479 | void HAL_FMPI2C_ErrorCallback(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 480 | /** |
Kojto | 110:165afa46840b | 481 | * @} |
Kojto | 110:165afa46840b | 482 | */ |
Kojto | 110:165afa46840b | 483 | |
Kojto | 110:165afa46840b | 484 | /** @addtogroup FMPI2C_Exported_Functions_Group3 |
Kojto | 110:165afa46840b | 485 | * @{ |
Kojto | 110:165afa46840b | 486 | */ |
Kojto | 110:165afa46840b | 487 | |
Kojto | 110:165afa46840b | 488 | /* Peripheral State functions ************************************************/ |
Kojto | 110:165afa46840b | 489 | HAL_FMPI2C_StateTypeDef HAL_FMPI2C_GetState(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 490 | uint32_t HAL_FMPI2C_GetError(FMPI2C_HandleTypeDef *hFMPI2C); |
Kojto | 110:165afa46840b | 491 | |
Kojto | 110:165afa46840b | 492 | /** |
Kojto | 110:165afa46840b | 493 | * @} |
Kojto | 110:165afa46840b | 494 | */ |
Kojto | 110:165afa46840b | 495 | |
Kojto | 110:165afa46840b | 496 | /** |
Kojto | 110:165afa46840b | 497 | * @} |
Kojto | 110:165afa46840b | 498 | */ |
Kojto | 110:165afa46840b | 499 | |
Kojto | 110:165afa46840b | 500 | /* Private types -------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 501 | |
Kojto | 110:165afa46840b | 502 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 503 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 504 | /** @defgroup FMPI2C_Private_Constants FMPI2C Private Constants |
Kojto | 110:165afa46840b | 505 | * @{ |
Kojto | 110:165afa46840b | 506 | */ |
Kojto | 110:165afa46840b | 507 | #define FMPI2C_FLAG_MASK ((uint32_t)0x0001FFFF) |
Kojto | 110:165afa46840b | 508 | /** |
Kojto | 110:165afa46840b | 509 | * @} |
Kojto | 110:165afa46840b | 510 | */ |
Kojto | 110:165afa46840b | 511 | |
Kojto | 110:165afa46840b | 512 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 513 | /** @defgroup FMPI2C_Private_Macros FMPI2C Private Macros |
Kojto | 110:165afa46840b | 514 | * @{ |
Kojto | 110:165afa46840b | 515 | */ |
Kojto | 110:165afa46840b | 516 | |
Kojto | 110:165afa46840b | 517 | #define IS_FMPI2C_ADDRESSING_MODE(MODE) (((MODE) == FMPI2C_ADDRESSINGMODE_7BIT) || \ |
Kojto | 110:165afa46840b | 518 | ((MODE) == FMPI2C_ADDRESSINGMODE_10BIT)) |
Kojto | 110:165afa46840b | 519 | |
Kojto | 110:165afa46840b | 520 | #define IS_FMPI2C_DUAL_ADDRESS(ADDRESS) (((ADDRESS) == FMPI2C_DUALADDRESS_DISABLE) || \ |
Kojto | 110:165afa46840b | 521 | ((ADDRESS) == FMPI2C_DUALADDRESS_ENABLE)) |
Kojto | 110:165afa46840b | 522 | |
Kojto | 110:165afa46840b | 523 | #define IS_FMPI2C_OWN_ADDRESS2_MASK(MASK) (((MASK) == FMPI2C_OA2_NOMASK) || \ |
Kojto | 110:165afa46840b | 524 | ((MASK) == FMPI2C_OA2_MASK01) || \ |
Kojto | 110:165afa46840b | 525 | ((MASK) == FMPI2C_OA2_MASK02) || \ |
Kojto | 110:165afa46840b | 526 | ((MASK) == FMPI2C_OA2_MASK03) || \ |
Kojto | 110:165afa46840b | 527 | ((MASK) == FMPI2C_OA2_MASK04) || \ |
Kojto | 110:165afa46840b | 528 | ((MASK) == FMPI2C_OA2_MASK05) || \ |
Kojto | 110:165afa46840b | 529 | ((MASK) == FMPI2C_OA2_MASK06) || \ |
Kojto | 110:165afa46840b | 530 | ((MASK) == FMPI2C_OA2_MASK07)) |
Kojto | 110:165afa46840b | 531 | |
Kojto | 110:165afa46840b | 532 | #define IS_FMPI2C_GENERAL_CALL(CALL) (((CALL) == FMPI2C_GENERALCALL_DISABLE) || \ |
Kojto | 110:165afa46840b | 533 | ((CALL) == FMPI2C_GENERALCALL_ENABLE)) |
Kojto | 110:165afa46840b | 534 | |
Kojto | 110:165afa46840b | 535 | #define IS_FMPI2C_NO_STRETCH(STRETCH) (((STRETCH) == FMPI2C_NOSTRETCH_DISABLE) || \ |
Kojto | 110:165afa46840b | 536 | ((STRETCH) == FMPI2C_NOSTRETCH_ENABLE)) |
Kojto | 110:165afa46840b | 537 | |
Kojto | 110:165afa46840b | 538 | #define IS_FMPI2C_MEMADD_SIZE(SIZE) (((SIZE) == FMPI2C_MEMADD_SIZE_8BIT) || \ |
Kojto | 110:165afa46840b | 539 | ((SIZE) == FMPI2C_MEMADD_SIZE_16BIT)) |
Kojto | 110:165afa46840b | 540 | |
Kojto | 110:165afa46840b | 541 | #define IS_TRANSFER_MODE(MODE) (((MODE) == FMPI2C_RELOAD_MODE) || \ |
Kojto | 110:165afa46840b | 542 | ((MODE) == FMPI2C_AUTOEND_MODE) || \ |
Kojto | 110:165afa46840b | 543 | ((MODE) == FMPI2C_SOFTEND_MODE)) |
Kojto | 110:165afa46840b | 544 | |
Kojto | 110:165afa46840b | 545 | #define IS_TRANSFER_REQUEST(REQUEST) (((REQUEST) == FMPI2C_GENERATE_STOP) || \ |
Kojto | 110:165afa46840b | 546 | ((REQUEST) == FMPI2C_GENERATE_START_READ) || \ |
Kojto | 110:165afa46840b | 547 | ((REQUEST) == FMPI2C_GENERATE_START_WRITE) || \ |
Kojto | 110:165afa46840b | 548 | ((REQUEST) == FMPI2C_NO_STARTSTOP)) |
Kojto | 110:165afa46840b | 549 | |
Kojto | 110:165afa46840b | 550 | /** |
Kojto | 110:165afa46840b | 551 | * @} |
Kojto | 110:165afa46840b | 552 | */ |
Kojto | 110:165afa46840b | 553 | /* Private functions ---------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 554 | /** @defgroup FMPI2C_Private_Functions FMPI2C Private Functions |
Kojto | 110:165afa46840b | 555 | * @brief FMPI2C private functions |
Kojto | 110:165afa46840b | 556 | * @{ |
Kojto | 110:165afa46840b | 557 | */ |
Kojto | 110:165afa46840b | 558 | /** |
Kojto | 110:165afa46840b | 559 | * @} |
Kojto | 110:165afa46840b | 560 | */ |
Kojto | 110:165afa46840b | 561 | |
Kojto | 110:165afa46840b | 562 | /** |
Kojto | 110:165afa46840b | 563 | * @} |
Kojto | 110:165afa46840b | 564 | */ |
Kojto | 110:165afa46840b | 565 | |
Kojto | 110:165afa46840b | 566 | /** |
Kojto | 110:165afa46840b | 567 | * @} |
Kojto | 110:165afa46840b | 568 | */ |
Kojto | 110:165afa46840b | 569 | #endif /* STM32F410xx || STM32F446xx */ |
Kojto | 110:165afa46840b | 570 | #ifdef __cplusplus |
Kojto | 110:165afa46840b | 571 | } |
Kojto | 110:165afa46840b | 572 | #endif |
Kojto | 110:165afa46840b | 573 | |
Kojto | 110:165afa46840b | 574 | |
Kojto | 110:165afa46840b | 575 | #endif /* __STM32F4xx_HAL_FMPI2C_H */ |
Kojto | 110:165afa46840b | 576 | |
Kojto | 110:165afa46840b | 577 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |