The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NUCLEO_F429ZI/stm32f4xx_hal_fmpi2c.h@122:f9eeca106725, 2016-07-07 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 07 14:34:11 2016 +0100
- Revision:
- 122:f9eeca106725
Release 122 of the mbed library
Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 122:f9eeca106725 | 1 | /** |
Kojto | 122:f9eeca106725 | 2 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 3 | * @file stm32f4xx_hal_fmpi2c.h |
Kojto | 122:f9eeca106725 | 4 | * @author MCD Application Team |
Kojto | 122:f9eeca106725 | 5 | * @version V1.5.0 |
Kojto | 122:f9eeca106725 | 6 | * @date 06-May-2016 |
Kojto | 122:f9eeca106725 | 7 | * @brief Header file of FMPI2C HAL module. |
Kojto | 122:f9eeca106725 | 8 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 9 | * @attention |
Kojto | 122:f9eeca106725 | 10 | * |
Kojto | 122:f9eeca106725 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
Kojto | 122:f9eeca106725 | 12 | * |
Kojto | 122:f9eeca106725 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 122:f9eeca106725 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 122:f9eeca106725 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 122:f9eeca106725 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 122:f9eeca106725 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 122:f9eeca106725 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 122:f9eeca106725 | 19 | * and/or other materials provided with the distribution. |
Kojto | 122:f9eeca106725 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 122:f9eeca106725 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 122:f9eeca106725 | 22 | * without specific prior written permission. |
Kojto | 122:f9eeca106725 | 23 | * |
Kojto | 122:f9eeca106725 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 122:f9eeca106725 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 122:f9eeca106725 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 122:f9eeca106725 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 122:f9eeca106725 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 122:f9eeca106725 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 122:f9eeca106725 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 122:f9eeca106725 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 122:f9eeca106725 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 122:f9eeca106725 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 122:f9eeca106725 | 34 | * |
Kojto | 122:f9eeca106725 | 35 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 36 | */ |
Kojto | 122:f9eeca106725 | 37 | |
Kojto | 122:f9eeca106725 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 122:f9eeca106725 | 39 | #ifndef __STM32F4xx_HAL_FMPI2C_H |
Kojto | 122:f9eeca106725 | 40 | #define __STM32F4xx_HAL_FMPI2C_H |
Kojto | 122:f9eeca106725 | 41 | |
Kojto | 122:f9eeca106725 | 42 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 43 | extern "C" { |
Kojto | 122:f9eeca106725 | 44 | #endif |
Kojto | 122:f9eeca106725 | 45 | |
Kojto | 122:f9eeca106725 | 46 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ |
Kojto | 122:f9eeca106725 | 47 | defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) |
Kojto | 122:f9eeca106725 | 48 | |
Kojto | 122:f9eeca106725 | 49 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 50 | #include "stm32f4xx_hal_def.h" |
Kojto | 122:f9eeca106725 | 51 | |
Kojto | 122:f9eeca106725 | 52 | /** @addtogroup STM32F4xx_HAL_Driver |
Kojto | 122:f9eeca106725 | 53 | * @{ |
Kojto | 122:f9eeca106725 | 54 | */ |
Kojto | 122:f9eeca106725 | 55 | |
Kojto | 122:f9eeca106725 | 56 | /** @addtogroup FMPI2C |
Kojto | 122:f9eeca106725 | 57 | * @{ |
Kojto | 122:f9eeca106725 | 58 | */ |
Kojto | 122:f9eeca106725 | 59 | |
Kojto | 122:f9eeca106725 | 60 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 61 | /** @defgroup FMPI2C_Exported_Types FMPI2C Exported Types |
Kojto | 122:f9eeca106725 | 62 | * @{ |
Kojto | 122:f9eeca106725 | 63 | */ |
Kojto | 122:f9eeca106725 | 64 | |
Kojto | 122:f9eeca106725 | 65 | /** @defgroup FMPI2C_Configuration_Structure_definition FMPI2C Configuration Structure definition |
Kojto | 122:f9eeca106725 | 66 | * @brief FMPI2C Configuration Structure definition |
Kojto | 122:f9eeca106725 | 67 | * @{ |
Kojto | 122:f9eeca106725 | 68 | */ |
Kojto | 122:f9eeca106725 | 69 | typedef struct |
Kojto | 122:f9eeca106725 | 70 | { |
Kojto | 122:f9eeca106725 | 71 | uint32_t Timing; /*!< Specifies the FMPI2C_TIMINGR_register value. |
Kojto | 122:f9eeca106725 | 72 | This parameter calculated by referring to FMPI2C initialization |
Kojto | 122:f9eeca106725 | 73 | section in Reference manual */ |
Kojto | 122:f9eeca106725 | 74 | |
Kojto | 122:f9eeca106725 | 75 | uint32_t OwnAddress1; /*!< Specifies the first device own address. |
Kojto | 122:f9eeca106725 | 76 | This parameter can be a 7-bit or 10-bit address. */ |
Kojto | 122:f9eeca106725 | 77 | |
Kojto | 122:f9eeca106725 | 78 | uint32_t AddressingMode; /*!< Specifies if 7-bit or 10-bit addressing mode is selected. |
Kojto | 122:f9eeca106725 | 79 | This parameter can be a value of @ref FMPI2C_ADDRESSING_MODE */ |
Kojto | 122:f9eeca106725 | 80 | |
Kojto | 122:f9eeca106725 | 81 | uint32_t DualAddressMode; /*!< Specifies if dual addressing mode is selected. |
Kojto | 122:f9eeca106725 | 82 | This parameter can be a value of @ref FMPI2C_DUAL_ADDRESSING_MODE */ |
Kojto | 122:f9eeca106725 | 83 | |
Kojto | 122:f9eeca106725 | 84 | uint32_t OwnAddress2; /*!< Specifies the second device own address if dual addressing mode is selected |
Kojto | 122:f9eeca106725 | 85 | This parameter can be a 7-bit address. */ |
Kojto | 122:f9eeca106725 | 86 | |
Kojto | 122:f9eeca106725 | 87 | uint32_t OwnAddress2Masks; /*!< Specifies the acknowledge mask address second device own address if dual addressing mode is selected |
Kojto | 122:f9eeca106725 | 88 | This parameter can be a value of @ref FMPI2C_OWN_ADDRESS2_MASKS */ |
Kojto | 122:f9eeca106725 | 89 | |
Kojto | 122:f9eeca106725 | 90 | uint32_t GeneralCallMode; /*!< Specifies if general call mode is selected. |
Kojto | 122:f9eeca106725 | 91 | This parameter can be a value of @ref FMPI2C_GENERAL_CALL_ADDRESSING_MODE */ |
Kojto | 122:f9eeca106725 | 92 | |
Kojto | 122:f9eeca106725 | 93 | uint32_t NoStretchMode; /*!< Specifies if nostretch mode is selected. |
Kojto | 122:f9eeca106725 | 94 | This parameter can be a value of @ref FMPI2C_NOSTRETCH_MODE */ |
Kojto | 122:f9eeca106725 | 95 | |
Kojto | 122:f9eeca106725 | 96 | }FMPI2C_InitTypeDef; |
Kojto | 122:f9eeca106725 | 97 | |
Kojto | 122:f9eeca106725 | 98 | /** |
Kojto | 122:f9eeca106725 | 99 | * @} |
Kojto | 122:f9eeca106725 | 100 | */ |
Kojto | 122:f9eeca106725 | 101 | |
Kojto | 122:f9eeca106725 | 102 | /** @defgroup HAL_state_structure_definition HAL state structure definition |
Kojto | 122:f9eeca106725 | 103 | * @brief HAL State structure definition |
Kojto | 122:f9eeca106725 | 104 | * @note HAL FMPI2C State value coding follow below described bitmap : |
Kojto | 122:f9eeca106725 | 105 | * b7-b6 Error information |
Kojto | 122:f9eeca106725 | 106 | * 00 : No Error |
Kojto | 122:f9eeca106725 | 107 | * 01 : Abort (Abort user request on going) |
Kojto | 122:f9eeca106725 | 108 | * 10 : Timeout |
Kojto | 122:f9eeca106725 | 109 | * 11 : Error |
Kojto | 122:f9eeca106725 | 110 | * b5 IP initilisation status |
Kojto | 122:f9eeca106725 | 111 | * 0 : Reset (IP not initialized) |
Kojto | 122:f9eeca106725 | 112 | * 1 : Init done (IP initialized and ready to use. HAL FMPI2C Init function called) |
Kojto | 122:f9eeca106725 | 113 | * b4 (not used) |
Kojto | 122:f9eeca106725 | 114 | * x : Should be set to 0 |
Kojto | 122:f9eeca106725 | 115 | * b3 |
Kojto | 122:f9eeca106725 | 116 | * 0 : Ready or Busy (No Listen mode ongoing) |
Kojto | 122:f9eeca106725 | 117 | * 1 : Listen (IP in Address Listen Mode) |
Kojto | 122:f9eeca106725 | 118 | * b2 Intrinsic process state |
Kojto | 122:f9eeca106725 | 119 | * 0 : Ready |
Kojto | 122:f9eeca106725 | 120 | * 1 : Busy (IP busy with some configuration or internal operations) |
Kojto | 122:f9eeca106725 | 121 | * b1 Rx state |
Kojto | 122:f9eeca106725 | 122 | * 0 : Ready (no Rx operation ongoing) |
Kojto | 122:f9eeca106725 | 123 | * 1 : Busy (Rx operation ongoing) |
Kojto | 122:f9eeca106725 | 124 | * b0 Tx state |
Kojto | 122:f9eeca106725 | 125 | * 0 : Ready (no Tx operation ongoing) |
Kojto | 122:f9eeca106725 | 126 | * 1 : Busy (Tx operation ongoing) |
Kojto | 122:f9eeca106725 | 127 | * @{ |
Kojto | 122:f9eeca106725 | 128 | */ |
Kojto | 122:f9eeca106725 | 129 | typedef enum |
Kojto | 122:f9eeca106725 | 130 | { |
Kojto | 122:f9eeca106725 | 131 | HAL_FMPI2C_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized */ |
Kojto | 122:f9eeca106725 | 132 | HAL_FMPI2C_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use */ |
Kojto | 122:f9eeca106725 | 133 | HAL_FMPI2C_STATE_BUSY = 0x24U, /*!< An internal process is ongoing */ |
Kojto | 122:f9eeca106725 | 134 | HAL_FMPI2C_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing */ |
Kojto | 122:f9eeca106725 | 135 | HAL_FMPI2C_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing */ |
Kojto | 122:f9eeca106725 | 136 | HAL_FMPI2C_STATE_LISTEN = 0x28U, /*!< Address Listen Mode is ongoing */ |
Kojto | 122:f9eeca106725 | 137 | HAL_FMPI2C_STATE_BUSY_TX_LISTEN = 0x29U, /*!< Address Listen Mode and Data Transmission |
Kojto | 122:f9eeca106725 | 138 | process is ongoing */ |
Kojto | 122:f9eeca106725 | 139 | HAL_FMPI2C_STATE_BUSY_RX_LISTEN = 0x2AU, /*!< Address Listen Mode and Data Reception |
Kojto | 122:f9eeca106725 | 140 | process is ongoing */ |
Kojto | 122:f9eeca106725 | 141 | HAL_FMPI2C_STATE_ABORT = 0x60U, /*!< Abort user request ongoing */ |
Kojto | 122:f9eeca106725 | 142 | HAL_FMPI2C_STATE_TIMEOUT = 0xA0U, /*!< Timeout state */ |
Kojto | 122:f9eeca106725 | 143 | HAL_FMPI2C_STATE_ERROR = 0xE0U /*!< Error */ |
Kojto | 122:f9eeca106725 | 144 | |
Kojto | 122:f9eeca106725 | 145 | }HAL_FMPI2C_StateTypeDef; |
Kojto | 122:f9eeca106725 | 146 | |
Kojto | 122:f9eeca106725 | 147 | /** |
Kojto | 122:f9eeca106725 | 148 | * @} |
Kojto | 122:f9eeca106725 | 149 | */ |
Kojto | 122:f9eeca106725 | 150 | |
Kojto | 122:f9eeca106725 | 151 | /** @defgroup HAL_mode_structure_definition HAL mode structure definition |
Kojto | 122:f9eeca106725 | 152 | * @brief HAL Mode structure definition |
Kojto | 122:f9eeca106725 | 153 | * @note HAL FMPI2C Mode value coding follow below described bitmap : |
Kojto | 122:f9eeca106725 | 154 | * b7 (not used) |
Kojto | 122:f9eeca106725 | 155 | * x : Should be set to 0 |
Kojto | 122:f9eeca106725 | 156 | * b6 |
Kojto | 122:f9eeca106725 | 157 | * 0 : None |
Kojto | 122:f9eeca106725 | 158 | * 1 : Memory (HAL FMPI2C communication is in Memory Mode) |
Kojto | 122:f9eeca106725 | 159 | * b5 |
Kojto | 122:f9eeca106725 | 160 | * 0 : None |
Kojto | 122:f9eeca106725 | 161 | * 1 : Slave (HAL FMPI2C communication is in Slave Mode) |
Kojto | 122:f9eeca106725 | 162 | * b4 |
Kojto | 122:f9eeca106725 | 163 | * 0 : None |
Kojto | 122:f9eeca106725 | 164 | * 1 : Master (HAL FMPI2C communication is in Master Mode) |
Kojto | 122:f9eeca106725 | 165 | * b3-b2-b1-b0 (not used) |
Kojto | 122:f9eeca106725 | 166 | * xxxx : Should be set to 0000 |
Kojto | 122:f9eeca106725 | 167 | * @{ |
Kojto | 122:f9eeca106725 | 168 | */ |
Kojto | 122:f9eeca106725 | 169 | typedef enum |
Kojto | 122:f9eeca106725 | 170 | { |
Kojto | 122:f9eeca106725 | 171 | HAL_FMPI2C_MODE_NONE = 0x00U, /*!< No FMPI2C communication on going */ |
Kojto | 122:f9eeca106725 | 172 | HAL_FMPI2C_MODE_MASTER = 0x10U, /*!< FMPI2C communication is in Master Mode */ |
Kojto | 122:f9eeca106725 | 173 | HAL_FMPI2C_MODE_SLAVE = 0x20U, /*!< FMPI2C communication is in Slave Mode */ |
Kojto | 122:f9eeca106725 | 174 | HAL_FMPI2C_MODE_MEM = 0x40U /*!< FMPI2C communication is in Memory Mode */ |
Kojto | 122:f9eeca106725 | 175 | |
Kojto | 122:f9eeca106725 | 176 | }HAL_FMPI2C_ModeTypeDef; |
Kojto | 122:f9eeca106725 | 177 | |
Kojto | 122:f9eeca106725 | 178 | /** |
Kojto | 122:f9eeca106725 | 179 | * @} |
Kojto | 122:f9eeca106725 | 180 | */ |
Kojto | 122:f9eeca106725 | 181 | |
Kojto | 122:f9eeca106725 | 182 | /** @defgroup FMPI2C_Error_Code_definition FMPI2C Error Code definition |
Kojto | 122:f9eeca106725 | 183 | * @brief FMPI2C Error Code definition |
Kojto | 122:f9eeca106725 | 184 | * @{ |
Kojto | 122:f9eeca106725 | 185 | */ |
Kojto | 122:f9eeca106725 | 186 | #define HAL_FMPI2C_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ |
Kojto | 122:f9eeca106725 | 187 | #define HAL_FMPI2C_ERROR_BERR ((uint32_t)0x00000001U) /*!< BERR error */ |
Kojto | 122:f9eeca106725 | 188 | #define HAL_FMPI2C_ERROR_ARLO ((uint32_t)0x00000002U) /*!< ARLO error */ |
Kojto | 122:f9eeca106725 | 189 | #define HAL_FMPI2C_ERROR_AF ((uint32_t)0x00000004U) /*!< ACKF error */ |
Kojto | 122:f9eeca106725 | 190 | #define HAL_FMPI2C_ERROR_OVR ((uint32_t)0x00000008U) /*!< OVR error */ |
Kojto | 122:f9eeca106725 | 191 | #define HAL_FMPI2C_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */ |
Kojto | 122:f9eeca106725 | 192 | #define HAL_FMPI2C_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< Timeout error */ |
Kojto | 122:f9eeca106725 | 193 | #define HAL_FMPI2C_ERROR_SIZE ((uint32_t)0x00000040U) /*!< Size Management error */ |
Kojto | 122:f9eeca106725 | 194 | /** |
Kojto | 122:f9eeca106725 | 195 | * @} |
Kojto | 122:f9eeca106725 | 196 | */ |
Kojto | 122:f9eeca106725 | 197 | |
Kojto | 122:f9eeca106725 | 198 | /** @defgroup FMPI2C_handle_Structure_definition FMPI2C handle Structure definition |
Kojto | 122:f9eeca106725 | 199 | * @brief FMPI2C handle Structure definition |
Kojto | 122:f9eeca106725 | 200 | * @{ |
Kojto | 122:f9eeca106725 | 201 | */ |
Kojto | 122:f9eeca106725 | 202 | typedef struct __FMPI2C_HandleTypeDef |
Kojto | 122:f9eeca106725 | 203 | { |
Kojto | 122:f9eeca106725 | 204 | FMPI2C_TypeDef *Instance; /*!< FMPI2C registers base address */ |
Kojto | 122:f9eeca106725 | 205 | |
Kojto | 122:f9eeca106725 | 206 | FMPI2C_InitTypeDef Init; /*!< FMPI2C communication parameters */ |
Kojto | 122:f9eeca106725 | 207 | |
Kojto | 122:f9eeca106725 | 208 | uint8_t *pBuffPtr; /*!< Pointer to FMPI2C transfer buffer */ |
Kojto | 122:f9eeca106725 | 209 | |
Kojto | 122:f9eeca106725 | 210 | uint16_t XferSize; /*!< FMPI2C transfer size */ |
Kojto | 122:f9eeca106725 | 211 | |
Kojto | 122:f9eeca106725 | 212 | __IO uint16_t XferCount; /*!< FMPI2C transfer counter */ |
Kojto | 122:f9eeca106725 | 213 | |
Kojto | 122:f9eeca106725 | 214 | __IO uint32_t XferOptions; /*!< FMPI2C sequantial transfer options, this parameter can |
Kojto | 122:f9eeca106725 | 215 | be a value of @ref FMPI2C_XFEROPTIONS */ |
Kojto | 122:f9eeca106725 | 216 | |
Kojto | 122:f9eeca106725 | 217 | __IO uint32_t PreviousState; /*!< FMPI2C communication Previous state */ |
Kojto | 122:f9eeca106725 | 218 | |
Kojto | 122:f9eeca106725 | 219 | HAL_StatusTypeDef (*XferISR)(struct __FMPI2C_HandleTypeDef *hfmpi2c, uint32_t ITFlags, uint32_t ITSources); /*!< FMPI2C transfer IRQ handler function pointer */ |
Kojto | 122:f9eeca106725 | 220 | |
Kojto | 122:f9eeca106725 | 221 | DMA_HandleTypeDef *hdmatx; /*!< FMPI2C Tx DMA handle parameters */ |
Kojto | 122:f9eeca106725 | 222 | |
Kojto | 122:f9eeca106725 | 223 | DMA_HandleTypeDef *hdmarx; /*!< FMPI2C Rx DMA handle parameters */ |
Kojto | 122:f9eeca106725 | 224 | |
Kojto | 122:f9eeca106725 | 225 | HAL_LockTypeDef Lock; /*!< FMPI2C locking object */ |
Kojto | 122:f9eeca106725 | 226 | |
Kojto | 122:f9eeca106725 | 227 | __IO HAL_FMPI2C_StateTypeDef State; /*!< FMPI2C communication state */ |
Kojto | 122:f9eeca106725 | 228 | |
Kojto | 122:f9eeca106725 | 229 | __IO HAL_FMPI2C_ModeTypeDef Mode; /*!< FMPI2C communication mode */ |
Kojto | 122:f9eeca106725 | 230 | |
Kojto | 122:f9eeca106725 | 231 | __IO uint32_t ErrorCode; /*!< FMPI2C Error code */ |
Kojto | 122:f9eeca106725 | 232 | |
Kojto | 122:f9eeca106725 | 233 | __IO uint32_t AddrEventCount; /*!< FMPI2C Address Event counter */ |
Kojto | 122:f9eeca106725 | 234 | }FMPI2C_HandleTypeDef; |
Kojto | 122:f9eeca106725 | 235 | /** |
Kojto | 122:f9eeca106725 | 236 | * @} |
Kojto | 122:f9eeca106725 | 237 | */ |
Kojto | 122:f9eeca106725 | 238 | |
Kojto | 122:f9eeca106725 | 239 | /** |
Kojto | 122:f9eeca106725 | 240 | * @} |
Kojto | 122:f9eeca106725 | 241 | */ |
Kojto | 122:f9eeca106725 | 242 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 243 | |
Kojto | 122:f9eeca106725 | 244 | /** @defgroup FMPI2C_Exported_Constants FMPI2C Exported Constants |
Kojto | 122:f9eeca106725 | 245 | * @{ |
Kojto | 122:f9eeca106725 | 246 | */ |
Kojto | 122:f9eeca106725 | 247 | |
Kojto | 122:f9eeca106725 | 248 | /** @defgroup FMPI2C_XFEROPTIONS FMPI2C Sequential Transfer Options |
Kojto | 122:f9eeca106725 | 249 | * @{ |
Kojto | 122:f9eeca106725 | 250 | */ |
Kojto | 122:f9eeca106725 | 251 | #define FMPI2C_NO_OPTION_FRAME ((uint32_t)0xFFFF0000U) |
Kojto | 122:f9eeca106725 | 252 | #define FMPI2C_FIRST_FRAME ((uint32_t)FMPI2C_SOFTEND_MODE) |
Kojto | 122:f9eeca106725 | 253 | #define FMPI2C_NEXT_FRAME ((uint32_t)(FMPI2C_RELOAD_MODE | FMPI2C_SOFTEND_MODE)) |
Kojto | 122:f9eeca106725 | 254 | #define FMPI2C_FIRST_AND_LAST_FRAME ((uint32_t)FMPI2C_AUTOEND_MODE) |
Kojto | 122:f9eeca106725 | 255 | #define FMPI2C_LAST_FRAME ((uint32_t)FMPI2C_AUTOEND_MODE) |
Kojto | 122:f9eeca106725 | 256 | /** |
Kojto | 122:f9eeca106725 | 257 | * @} |
Kojto | 122:f9eeca106725 | 258 | */ |
Kojto | 122:f9eeca106725 | 259 | |
Kojto | 122:f9eeca106725 | 260 | /** @defgroup FMPI2C_ADDRESSING_MODE FMPI2C Addressing Mode |
Kojto | 122:f9eeca106725 | 261 | * @{ |
Kojto | 122:f9eeca106725 | 262 | */ |
Kojto | 122:f9eeca106725 | 263 | #define FMPI2C_ADDRESSINGMODE_7BIT ((uint32_t)0x00000001U) |
Kojto | 122:f9eeca106725 | 264 | #define FMPI2C_ADDRESSINGMODE_10BIT ((uint32_t)0x00000002U) |
Kojto | 122:f9eeca106725 | 265 | /** |
Kojto | 122:f9eeca106725 | 266 | * @} |
Kojto | 122:f9eeca106725 | 267 | */ |
Kojto | 122:f9eeca106725 | 268 | |
Kojto | 122:f9eeca106725 | 269 | /** @defgroup FMPI2C_DUAL_ADDRESSING_MODE FMPI2C Dual Addressing Mode |
Kojto | 122:f9eeca106725 | 270 | * @{ |
Kojto | 122:f9eeca106725 | 271 | */ |
Kojto | 122:f9eeca106725 | 272 | #define FMPI2C_DUALADDRESS_DISABLE ((uint32_t)0x00000000U) |
Kojto | 122:f9eeca106725 | 273 | #define FMPI2C_DUALADDRESS_ENABLE FMPI2C_OAR2_OA2EN |
Kojto | 122:f9eeca106725 | 274 | /** |
Kojto | 122:f9eeca106725 | 275 | * @} |
Kojto | 122:f9eeca106725 | 276 | */ |
Kojto | 122:f9eeca106725 | 277 | |
Kojto | 122:f9eeca106725 | 278 | /** @defgroup FMPI2C_OWN_ADDRESS2_MASKS FMPI2C Own Address2 Masks |
Kojto | 122:f9eeca106725 | 279 | * @{ |
Kojto | 122:f9eeca106725 | 280 | */ |
Kojto | 122:f9eeca106725 | 281 | |
Kojto | 122:f9eeca106725 | 282 | #define FMPI2C_OA2_NOMASK ((uint8_t)0x00U) |
Kojto | 122:f9eeca106725 | 283 | #define FMPI2C_OA2_MASK01 ((uint8_t)0x01U) |
Kojto | 122:f9eeca106725 | 284 | #define FMPI2C_OA2_MASK02 ((uint8_t)0x02U) |
Kojto | 122:f9eeca106725 | 285 | #define FMPI2C_OA2_MASK03 ((uint8_t)0x03U) |
Kojto | 122:f9eeca106725 | 286 | #define FMPI2C_OA2_MASK04 ((uint8_t)0x04U) |
Kojto | 122:f9eeca106725 | 287 | #define FMPI2C_OA2_MASK05 ((uint8_t)0x05U) |
Kojto | 122:f9eeca106725 | 288 | #define FMPI2C_OA2_MASK06 ((uint8_t)0x06U) |
Kojto | 122:f9eeca106725 | 289 | #define FMPI2C_OA2_MASK07 ((uint8_t)0x07U) |
Kojto | 122:f9eeca106725 | 290 | |
Kojto | 122:f9eeca106725 | 291 | /** |
Kojto | 122:f9eeca106725 | 292 | * @} |
Kojto | 122:f9eeca106725 | 293 | */ |
Kojto | 122:f9eeca106725 | 294 | |
Kojto | 122:f9eeca106725 | 295 | /** @defgroup FMPI2C_GENERAL_CALL_ADDRESSING_MODE FMPI2C General Call Addressing Mode |
Kojto | 122:f9eeca106725 | 296 | * @{ |
Kojto | 122:f9eeca106725 | 297 | */ |
Kojto | 122:f9eeca106725 | 298 | #define FMPI2C_GENERALCALL_DISABLE ((uint32_t)0x00000000U) |
Kojto | 122:f9eeca106725 | 299 | #define FMPI2C_GENERALCALL_ENABLE FMPI2C_CR1_GCEN |
Kojto | 122:f9eeca106725 | 300 | /** |
Kojto | 122:f9eeca106725 | 301 | * @} |
Kojto | 122:f9eeca106725 | 302 | */ |
Kojto | 122:f9eeca106725 | 303 | |
Kojto | 122:f9eeca106725 | 304 | /** @defgroup FMPI2C_NOSTRETCH_MODE FMPI2C No-Stretch Mode |
Kojto | 122:f9eeca106725 | 305 | * @{ |
Kojto | 122:f9eeca106725 | 306 | */ |
Kojto | 122:f9eeca106725 | 307 | #define FMPI2C_NOSTRETCH_DISABLE ((uint32_t)0x00000000U) |
Kojto | 122:f9eeca106725 | 308 | #define FMPI2C_NOSTRETCH_ENABLE FMPI2C_CR1_NOSTRETCH |
Kojto | 122:f9eeca106725 | 309 | /** |
Kojto | 122:f9eeca106725 | 310 | * @} |
Kojto | 122:f9eeca106725 | 311 | */ |
Kojto | 122:f9eeca106725 | 312 | |
Kojto | 122:f9eeca106725 | 313 | /** @defgroup FMPI2C_MEMORY_ADDRESS_SIZE FMPI2C Memory Address Size |
Kojto | 122:f9eeca106725 | 314 | * @{ |
Kojto | 122:f9eeca106725 | 315 | */ |
Kojto | 122:f9eeca106725 | 316 | #define FMPI2C_MEMADD_SIZE_8BIT ((uint32_t)0x00000001U) |
Kojto | 122:f9eeca106725 | 317 | #define FMPI2C_MEMADD_SIZE_16BIT ((uint32_t)0x00000002U) |
Kojto | 122:f9eeca106725 | 318 | |
Kojto | 122:f9eeca106725 | 319 | /** |
Kojto | 122:f9eeca106725 | 320 | * @} |
Kojto | 122:f9eeca106725 | 321 | */ |
Kojto | 122:f9eeca106725 | 322 | |
Kojto | 122:f9eeca106725 | 323 | /** @defgroup FMPI2C_XferDirection FMPI2C Transfer Direction |
Kojto | 122:f9eeca106725 | 324 | * @{ |
Kojto | 122:f9eeca106725 | 325 | */ |
Kojto | 122:f9eeca106725 | 326 | #define FMPI2C_DIRECTION_RECEIVE ((uint32_t)0x00000000U) |
Kojto | 122:f9eeca106725 | 327 | #define FMPI2C_DIRECTION_TRANSMIT ((uint32_t)0x00000001U) |
Kojto | 122:f9eeca106725 | 328 | |
Kojto | 122:f9eeca106725 | 329 | /** |
Kojto | 122:f9eeca106725 | 330 | * @} |
Kojto | 122:f9eeca106725 | 331 | */ |
Kojto | 122:f9eeca106725 | 332 | |
Kojto | 122:f9eeca106725 | 333 | /** @defgroup FMPI2C_RELOAD_END_MODE FMPI2C Reload End Mode |
Kojto | 122:f9eeca106725 | 334 | * @{ |
Kojto | 122:f9eeca106725 | 335 | */ |
Kojto | 122:f9eeca106725 | 336 | #define FMPI2C_RELOAD_MODE FMPI2C_CR2_RELOAD |
Kojto | 122:f9eeca106725 | 337 | #define FMPI2C_AUTOEND_MODE FMPI2C_CR2_AUTOEND |
Kojto | 122:f9eeca106725 | 338 | #define FMPI2C_SOFTEND_MODE ((uint32_t)0x00000000U) |
Kojto | 122:f9eeca106725 | 339 | |
Kojto | 122:f9eeca106725 | 340 | /** |
Kojto | 122:f9eeca106725 | 341 | * @} |
Kojto | 122:f9eeca106725 | 342 | */ |
Kojto | 122:f9eeca106725 | 343 | |
Kojto | 122:f9eeca106725 | 344 | /** @defgroup FMPI2C_START_STOP_MODE FMPI2C Start or Stop Mode |
Kojto | 122:f9eeca106725 | 345 | * @{ |
Kojto | 122:f9eeca106725 | 346 | */ |
Kojto | 122:f9eeca106725 | 347 | |
Kojto | 122:f9eeca106725 | 348 | #define FMPI2C_NO_STARTSTOP ((uint32_t)0x00000000U) |
Kojto | 122:f9eeca106725 | 349 | #define FMPI2C_GENERATE_STOP FMPI2C_CR2_STOP |
Kojto | 122:f9eeca106725 | 350 | #define FMPI2C_GENERATE_START_READ (uint32_t)(FMPI2C_CR2_START | FMPI2C_CR2_RD_WRN) |
Kojto | 122:f9eeca106725 | 351 | #define FMPI2C_GENERATE_START_WRITE FMPI2C_CR2_START |
Kojto | 122:f9eeca106725 | 352 | |
Kojto | 122:f9eeca106725 | 353 | /** |
Kojto | 122:f9eeca106725 | 354 | * @} |
Kojto | 122:f9eeca106725 | 355 | */ |
Kojto | 122:f9eeca106725 | 356 | |
Kojto | 122:f9eeca106725 | 357 | /** @defgroup FMPI2C_Interrupt_configuration_definition FMPI2C Interrupt configuration definition |
Kojto | 122:f9eeca106725 | 358 | * @brief FMPI2C Interrupt definition |
Kojto | 122:f9eeca106725 | 359 | * Elements values convention: 0xXXXXXXXX |
Kojto | 122:f9eeca106725 | 360 | * - XXXXXXXX : Interrupt control mask |
Kojto | 122:f9eeca106725 | 361 | * @{ |
Kojto | 122:f9eeca106725 | 362 | */ |
Kojto | 122:f9eeca106725 | 363 | #define FMPI2C_IT_ERRI FMPI2C_CR1_ERRIE |
Kojto | 122:f9eeca106725 | 364 | #define FMPI2C_IT_TCI FMPI2C_CR1_TCIE |
Kojto | 122:f9eeca106725 | 365 | #define FMPI2C_IT_STOPI FMPI2C_CR1_STOPIE |
Kojto | 122:f9eeca106725 | 366 | #define FMPI2C_IT_NACKI FMPI2C_CR1_NACKIE |
Kojto | 122:f9eeca106725 | 367 | #define FMPI2C_IT_ADDRI FMPI2C_CR1_ADDRIE |
Kojto | 122:f9eeca106725 | 368 | #define FMPI2C_IT_RXI FMPI2C_CR1_RXIE |
Kojto | 122:f9eeca106725 | 369 | #define FMPI2C_IT_TXI FMPI2C_CR1_TXIE |
Kojto | 122:f9eeca106725 | 370 | /** |
Kojto | 122:f9eeca106725 | 371 | * @} |
Kojto | 122:f9eeca106725 | 372 | */ |
Kojto | 122:f9eeca106725 | 373 | |
Kojto | 122:f9eeca106725 | 374 | /** @defgroup FMPI2C_Flag_definition FMPI2C Flag definition |
Kojto | 122:f9eeca106725 | 375 | * @{ |
Kojto | 122:f9eeca106725 | 376 | */ |
Kojto | 122:f9eeca106725 | 377 | #define FMPI2C_FLAG_TXE FMPI2C_ISR_TXE |
Kojto | 122:f9eeca106725 | 378 | #define FMPI2C_FLAG_TXIS FMPI2C_ISR_TXIS |
Kojto | 122:f9eeca106725 | 379 | #define FMPI2C_FLAG_RXNE FMPI2C_ISR_RXNE |
Kojto | 122:f9eeca106725 | 380 | #define FMPI2C_FLAG_ADDR FMPI2C_ISR_ADDR |
Kojto | 122:f9eeca106725 | 381 | #define FMPI2C_FLAG_AF FMPI2C_ISR_NACKF |
Kojto | 122:f9eeca106725 | 382 | #define FMPI2C_FLAG_STOPF FMPI2C_ISR_STOPF |
Kojto | 122:f9eeca106725 | 383 | #define FMPI2C_FLAG_TC FMPI2C_ISR_TC |
Kojto | 122:f9eeca106725 | 384 | #define FMPI2C_FLAG_TCR FMPI2C_ISR_TCR |
Kojto | 122:f9eeca106725 | 385 | #define FMPI2C_FLAG_BERR FMPI2C_ISR_BERR |
Kojto | 122:f9eeca106725 | 386 | #define FMPI2C_FLAG_ARLO FMPI2C_ISR_ARLO |
Kojto | 122:f9eeca106725 | 387 | #define FMPI2C_FLAG_OVR FMPI2C_ISR_OVR |
Kojto | 122:f9eeca106725 | 388 | #define FMPI2C_FLAG_PECERR FMPI2C_ISR_PECERR |
Kojto | 122:f9eeca106725 | 389 | #define FMPI2C_FLAG_TIMEOUT FMPI2C_ISR_TIMEOUT |
Kojto | 122:f9eeca106725 | 390 | #define FMPI2C_FLAG_ALERT FMPI2C_ISR_ALERT |
Kojto | 122:f9eeca106725 | 391 | #define FMPI2C_FLAG_BUSY FMPI2C_ISR_BUSY |
Kojto | 122:f9eeca106725 | 392 | #define FMPI2C_FLAG_DIR FMPI2C_ISR_DIR |
Kojto | 122:f9eeca106725 | 393 | /** |
Kojto | 122:f9eeca106725 | 394 | * @} |
Kojto | 122:f9eeca106725 | 395 | */ |
Kojto | 122:f9eeca106725 | 396 | |
Kojto | 122:f9eeca106725 | 397 | /** |
Kojto | 122:f9eeca106725 | 398 | * @} |
Kojto | 122:f9eeca106725 | 399 | */ |
Kojto | 122:f9eeca106725 | 400 | |
Kojto | 122:f9eeca106725 | 401 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 402 | |
Kojto | 122:f9eeca106725 | 403 | /** @defgroup FMPI2C_Exported_Macros FMPI2C Exported Macros |
Kojto | 122:f9eeca106725 | 404 | * @{ |
Kojto | 122:f9eeca106725 | 405 | */ |
Kojto | 122:f9eeca106725 | 406 | |
Kojto | 122:f9eeca106725 | 407 | /** @brief Reset FMPI2C handle state. |
Kojto | 122:f9eeca106725 | 408 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 409 | * @retval None |
Kojto | 122:f9eeca106725 | 410 | */ |
Kojto | 122:f9eeca106725 | 411 | #define __HAL_FMPI2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_FMPI2C_STATE_RESET) |
Kojto | 122:f9eeca106725 | 412 | |
Kojto | 122:f9eeca106725 | 413 | /** @brief Enable the specified FMPI2C interrupt. |
Kojto | 122:f9eeca106725 | 414 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 415 | * @param __INTERRUPT__ specifies the interrupt source to enable. |
Kojto | 122:f9eeca106725 | 416 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 417 | * @arg @ref FMPI2C_IT_ERRI Errors interrupt enable |
Kojto | 122:f9eeca106725 | 418 | * @arg @ref FMPI2C_IT_TCI Transfer complete interrupt enable |
Kojto | 122:f9eeca106725 | 419 | * @arg @ref FMPI2C_IT_STOPI STOP detection interrupt enable |
Kojto | 122:f9eeca106725 | 420 | * @arg @ref FMPI2C_IT_NACKI NACK received interrupt enable |
Kojto | 122:f9eeca106725 | 421 | * @arg @ref FMPI2C_IT_ADDRI Address match interrupt enable |
Kojto | 122:f9eeca106725 | 422 | * @arg @ref FMPI2C_IT_RXI RX interrupt enable |
Kojto | 122:f9eeca106725 | 423 | * @arg @ref FMPI2C_IT_TXI TX interrupt enable |
Kojto | 122:f9eeca106725 | 424 | * |
Kojto | 122:f9eeca106725 | 425 | * @retval None |
Kojto | 122:f9eeca106725 | 426 | */ |
Kojto | 122:f9eeca106725 | 427 | #define __HAL_FMPI2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__)) |
Kojto | 122:f9eeca106725 | 428 | |
Kojto | 122:f9eeca106725 | 429 | /** @brief Disable the specified FMPI2C interrupt. |
Kojto | 122:f9eeca106725 | 430 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 431 | * @param __INTERRUPT__ specifies the interrupt source to disable. |
Kojto | 122:f9eeca106725 | 432 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 433 | * @arg @ref FMPI2C_IT_ERRI Errors interrupt enable |
Kojto | 122:f9eeca106725 | 434 | * @arg @ref FMPI2C_IT_TCI Transfer complete interrupt enable |
Kojto | 122:f9eeca106725 | 435 | * @arg @ref FMPI2C_IT_STOPI STOP detection interrupt enable |
Kojto | 122:f9eeca106725 | 436 | * @arg @ref FMPI2C_IT_NACKI NACK received interrupt enable |
Kojto | 122:f9eeca106725 | 437 | * @arg @ref FMPI2C_IT_ADDRI Address match interrupt enable |
Kojto | 122:f9eeca106725 | 438 | * @arg @ref FMPI2C_IT_RXI RX interrupt enable |
Kojto | 122:f9eeca106725 | 439 | * @arg @ref FMPI2C_IT_TXI TX interrupt enable |
Kojto | 122:f9eeca106725 | 440 | * |
Kojto | 122:f9eeca106725 | 441 | * @retval None |
Kojto | 122:f9eeca106725 | 442 | */ |
Kojto | 122:f9eeca106725 | 443 | #define __HAL_FMPI2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__))) |
Kojto | 122:f9eeca106725 | 444 | |
Kojto | 122:f9eeca106725 | 445 | /** @brief Check whether the specified FMPI2C interrupt source is enabled or not. |
Kojto | 122:f9eeca106725 | 446 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 447 | * @param __INTERRUPT__ specifies the FMPI2C interrupt source to check. |
Kojto | 122:f9eeca106725 | 448 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 449 | * @arg @ref FMPI2C_IT_ERRI Errors interrupt enable |
Kojto | 122:f9eeca106725 | 450 | * @arg @ref FMPI2C_IT_TCI Transfer complete interrupt enable |
Kojto | 122:f9eeca106725 | 451 | * @arg @ref FMPI2C_IT_STOPI STOP detection interrupt enable |
Kojto | 122:f9eeca106725 | 452 | * @arg @ref FMPI2C_IT_NACKI NACK received interrupt enable |
Kojto | 122:f9eeca106725 | 453 | * @arg @ref FMPI2C_IT_ADDRI Address match interrupt enable |
Kojto | 122:f9eeca106725 | 454 | * @arg @ref FMPI2C_IT_RXI RX interrupt enable |
Kojto | 122:f9eeca106725 | 455 | * @arg @ref FMPI2C_IT_TXI TX interrupt enable |
Kojto | 122:f9eeca106725 | 456 | * |
Kojto | 122:f9eeca106725 | 457 | * @retval The new state of __INTERRUPT__ (SET or RESET). |
Kojto | 122:f9eeca106725 | 458 | */ |
Kojto | 122:f9eeca106725 | 459 | #define __HAL_FMPI2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
Kojto | 122:f9eeca106725 | 460 | |
Kojto | 122:f9eeca106725 | 461 | /** @brief Check whether the specified FMPI2C flag is set or not. |
Kojto | 122:f9eeca106725 | 462 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 463 | * @param __FLAG__ specifies the flag to check. |
Kojto | 122:f9eeca106725 | 464 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 465 | * @arg @ref FMPI2C_FLAG_TXE Transmit data register empty |
Kojto | 122:f9eeca106725 | 466 | * @arg @ref FMPI2C_FLAG_TXIS Transmit interrupt status |
Kojto | 122:f9eeca106725 | 467 | * @arg @ref FMPI2C_FLAG_RXNE Receive data register not empty |
Kojto | 122:f9eeca106725 | 468 | * @arg @ref FMPI2C_FLAG_ADDR Address matched (slave mode) |
Kojto | 122:f9eeca106725 | 469 | * @arg @ref FMPI2C_FLAG_AF Acknowledge failure received flag |
Kojto | 122:f9eeca106725 | 470 | * @arg @ref FMPI2C_FLAG_STOPF STOP detection flag |
Kojto | 122:f9eeca106725 | 471 | * @arg @ref FMPI2C_FLAG_TC Transfer complete (master mode) |
Kojto | 122:f9eeca106725 | 472 | * @arg @ref FMPI2C_FLAG_TCR Transfer complete reload |
Kojto | 122:f9eeca106725 | 473 | * @arg @ref FMPI2C_FLAG_BERR Bus error |
Kojto | 122:f9eeca106725 | 474 | * @arg @ref FMPI2C_FLAG_ARLO Arbitration lost |
Kojto | 122:f9eeca106725 | 475 | * @arg @ref FMPI2C_FLAG_OVR Overrun/Underrun |
Kojto | 122:f9eeca106725 | 476 | * @arg @ref FMPI2C_FLAG_PECERR PEC error in reception |
Kojto | 122:f9eeca106725 | 477 | * @arg @ref FMPI2C_FLAG_TIMEOUT Timeout or Tlow detection flag |
Kojto | 122:f9eeca106725 | 478 | * @arg @ref FMPI2C_FLAG_ALERT SMBus alert |
Kojto | 122:f9eeca106725 | 479 | * @arg @ref FMPI2C_FLAG_BUSY Bus busy |
Kojto | 122:f9eeca106725 | 480 | * @arg @ref FMPI2C_FLAG_DIR Transfer direction (slave mode) |
Kojto | 122:f9eeca106725 | 481 | * |
Kojto | 122:f9eeca106725 | 482 | * @retval The new state of __FLAG__ (SET or RESET). |
Kojto | 122:f9eeca106725 | 483 | */ |
Kojto | 122:f9eeca106725 | 484 | #define __HAL_FMPI2C_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__)) ? SET : RESET) |
Kojto | 122:f9eeca106725 | 485 | |
Kojto | 122:f9eeca106725 | 486 | /** @brief Clear the FMPI2C pending flags which are cleared by writing 1 in a specific bit. |
Kojto | 122:f9eeca106725 | 487 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 488 | * @param __FLAG__ specifies the flag to clear. |
Kojto | 122:f9eeca106725 | 489 | * This parameter can be any combination of the following values: |
Kojto | 122:f9eeca106725 | 490 | * @arg @ref FMPI2C_FLAG_TXE Transmit data register empty |
Kojto | 122:f9eeca106725 | 491 | * @arg @ref FMPI2C_FLAG_ADDR Address matched (slave mode) |
Kojto | 122:f9eeca106725 | 492 | * @arg @ref FMPI2C_FLAG_AF Acknowledge failure received flag |
Kojto | 122:f9eeca106725 | 493 | * @arg @ref FMPI2C_FLAG_STOPF STOP detection flag |
Kojto | 122:f9eeca106725 | 494 | * @arg @ref FMPI2C_FLAG_BERR Bus error |
Kojto | 122:f9eeca106725 | 495 | * @arg @ref FMPI2C_FLAG_ARLO Arbitration lost |
Kojto | 122:f9eeca106725 | 496 | * @arg @ref FMPI2C_FLAG_OVR Overrun/Underrun |
Kojto | 122:f9eeca106725 | 497 | * @arg @ref FMPI2C_FLAG_PECERR PEC error in reception |
Kojto | 122:f9eeca106725 | 498 | * @arg @ref FMPI2C_FLAG_TIMEOUT Timeout or Tlow detection flag |
Kojto | 122:f9eeca106725 | 499 | * @arg @ref FMPI2C_FLAG_ALERT SMBus alert |
Kojto | 122:f9eeca106725 | 500 | * |
Kojto | 122:f9eeca106725 | 501 | * @retval None |
Kojto | 122:f9eeca106725 | 502 | */ |
Kojto | 122:f9eeca106725 | 503 | #define __HAL_FMPI2C_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__FLAG__) == FMPI2C_FLAG_TXE) ? ((__HANDLE__)->Instance->ISR |= (__FLAG__)) \ |
Kojto | 122:f9eeca106725 | 504 | : ((__HANDLE__)->Instance->ICR = (__FLAG__))) |
Kojto | 122:f9eeca106725 | 505 | |
Kojto | 122:f9eeca106725 | 506 | /** @brief Enable the specified FMPI2C peripheral. |
Kojto | 122:f9eeca106725 | 507 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 508 | * @retval None |
Kojto | 122:f9eeca106725 | 509 | */ |
Kojto | 122:f9eeca106725 | 510 | #define __HAL_FMPI2C_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, FMPI2C_CR1_PE)) |
Kojto | 122:f9eeca106725 | 511 | |
Kojto | 122:f9eeca106725 | 512 | /** @brief Disable the specified FMPI2C peripheral. |
Kojto | 122:f9eeca106725 | 513 | * @param __HANDLE__ specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 514 | * @retval None |
Kojto | 122:f9eeca106725 | 515 | */ |
Kojto | 122:f9eeca106725 | 516 | #define __HAL_FMPI2C_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, FMPI2C_CR1_PE)) |
Kojto | 122:f9eeca106725 | 517 | |
Kojto | 122:f9eeca106725 | 518 | /** @brief Generate a Non-Acknowledge FMPI2C peripheral in Slave mode. |
Kojto | 122:f9eeca106725 | 519 | * @param __HANDLE__: specifies the FMPI2C Handle. |
Kojto | 122:f9eeca106725 | 520 | * @retval None |
Kojto | 122:f9eeca106725 | 521 | */ |
Kojto | 122:f9eeca106725 | 522 | #define __HAL_FMPI2C_GENERATE_NACK(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR2, FMPI2C_CR2_NACK)) |
Kojto | 122:f9eeca106725 | 523 | /** |
Kojto | 122:f9eeca106725 | 524 | * @} |
Kojto | 122:f9eeca106725 | 525 | */ |
Kojto | 122:f9eeca106725 | 526 | |
Kojto | 122:f9eeca106725 | 527 | /* Include FMPI2C HAL Extended module */ |
Kojto | 122:f9eeca106725 | 528 | #include "stm32f4xx_hal_fmpi2c_ex.h" |
Kojto | 122:f9eeca106725 | 529 | |
Kojto | 122:f9eeca106725 | 530 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 531 | /** @addtogroup FMPI2C_Exported_Functions |
Kojto | 122:f9eeca106725 | 532 | * @{ |
Kojto | 122:f9eeca106725 | 533 | */ |
Kojto | 122:f9eeca106725 | 534 | |
Kojto | 122:f9eeca106725 | 535 | /** @addtogroup FMPI2C_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 122:f9eeca106725 | 536 | * @{ |
Kojto | 122:f9eeca106725 | 537 | */ |
Kojto | 122:f9eeca106725 | 538 | /* Initialization and de-initialization functions******************************/ |
Kojto | 122:f9eeca106725 | 539 | HAL_StatusTypeDef HAL_FMPI2C_Init(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 540 | HAL_StatusTypeDef HAL_FMPI2C_DeInit (FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 541 | void HAL_FMPI2C_MspInit(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 542 | void HAL_FMPI2C_MspDeInit(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 543 | /** |
Kojto | 122:f9eeca106725 | 544 | * @} |
Kojto | 122:f9eeca106725 | 545 | */ |
Kojto | 122:f9eeca106725 | 546 | |
Kojto | 122:f9eeca106725 | 547 | /** @addtogroup FMPI2C_Exported_Functions_Group2 Input and Output operation functions |
Kojto | 122:f9eeca106725 | 548 | * @{ |
Kojto | 122:f9eeca106725 | 549 | */ |
Kojto | 122:f9eeca106725 | 550 | /* IO operation functions ****************************************************/ |
Kojto | 122:f9eeca106725 | 551 | /******* Blocking mode: Polling */ |
Kojto | 122:f9eeca106725 | 552 | HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 553 | HAL_StatusTypeDef HAL_FMPI2C_Master_Receive(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 554 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 555 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 556 | 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 | 122:f9eeca106725 | 557 | 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 | 122:f9eeca106725 | 558 | HAL_StatusTypeDef HAL_FMPI2C_IsDeviceReady(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 559 | |
Kojto | 122:f9eeca106725 | 560 | /******* Non-Blocking mode: Interrupt */ |
Kojto | 122:f9eeca106725 | 561 | HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 562 | HAL_StatusTypeDef HAL_FMPI2C_Master_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 563 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 564 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 565 | 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 | 122:f9eeca106725 | 566 | 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 | 122:f9eeca106725 | 567 | |
Kojto | 122:f9eeca106725 | 568 | HAL_StatusTypeDef HAL_FMPI2C_Master_Sequential_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); |
Kojto | 122:f9eeca106725 | 569 | HAL_StatusTypeDef HAL_FMPI2C_Master_Sequential_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); |
Kojto | 122:f9eeca106725 | 570 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Sequential_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); |
Kojto | 122:f9eeca106725 | 571 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Sequential_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); |
Kojto | 122:f9eeca106725 | 572 | HAL_StatusTypeDef HAL_FMPI2C_EnableListen_IT(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 573 | HAL_StatusTypeDef HAL_FMPI2C_DisableListen_IT(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 574 | HAL_StatusTypeDef HAL_FMPI2C_Master_Abort_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress); |
Kojto | 122:f9eeca106725 | 575 | |
Kojto | 122:f9eeca106725 | 576 | /******* Non-Blocking mode: DMA */ |
Kojto | 122:f9eeca106725 | 577 | HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 578 | HAL_StatusTypeDef HAL_FMPI2C_Master_Receive_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 579 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 580 | HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 581 | 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 | 122:f9eeca106725 | 582 | 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 | 122:f9eeca106725 | 583 | /** |
Kojto | 122:f9eeca106725 | 584 | * @} |
Kojto | 122:f9eeca106725 | 585 | */ |
Kojto | 122:f9eeca106725 | 586 | |
Kojto | 122:f9eeca106725 | 587 | /** @addtogroup FMPI2C_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks |
Kojto | 122:f9eeca106725 | 588 | * @{ |
Kojto | 122:f9eeca106725 | 589 | */ |
Kojto | 122:f9eeca106725 | 590 | /******* FMPI2C IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ |
Kojto | 122:f9eeca106725 | 591 | void HAL_FMPI2C_EV_IRQHandler(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 592 | void HAL_FMPI2C_ER_IRQHandler(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 593 | void HAL_FMPI2C_MasterTxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 594 | void HAL_FMPI2C_MasterRxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 595 | void HAL_FMPI2C_SlaveTxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 596 | void HAL_FMPI2C_SlaveRxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 597 | void HAL_FMPI2C_AddrCallback(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t TransferDirection, uint16_t AddrMatchCode); |
Kojto | 122:f9eeca106725 | 598 | void HAL_FMPI2C_ListenCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 599 | void HAL_FMPI2C_MemTxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 600 | void HAL_FMPI2C_MemRxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 601 | void HAL_FMPI2C_ErrorCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 602 | void HAL_FMPI2C_AbortCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 603 | /** |
Kojto | 122:f9eeca106725 | 604 | * @} |
Kojto | 122:f9eeca106725 | 605 | */ |
Kojto | 122:f9eeca106725 | 606 | |
Kojto | 122:f9eeca106725 | 607 | /** @addtogroup FMPI2C_Exported_Functions_Group3 Peripheral State, Mode and Error functions |
Kojto | 122:f9eeca106725 | 608 | * @{ |
Kojto | 122:f9eeca106725 | 609 | */ |
Kojto | 122:f9eeca106725 | 610 | /* Peripheral State, Mode and Error functions *********************************/ |
Kojto | 122:f9eeca106725 | 611 | HAL_FMPI2C_StateTypeDef HAL_FMPI2C_GetState(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 612 | HAL_FMPI2C_ModeTypeDef HAL_FMPI2C_GetMode(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 613 | uint32_t HAL_FMPI2C_GetError(FMPI2C_HandleTypeDef *hfmpi2c); |
Kojto | 122:f9eeca106725 | 614 | |
Kojto | 122:f9eeca106725 | 615 | /** |
Kojto | 122:f9eeca106725 | 616 | * @} |
Kojto | 122:f9eeca106725 | 617 | */ |
Kojto | 122:f9eeca106725 | 618 | |
Kojto | 122:f9eeca106725 | 619 | /** |
Kojto | 122:f9eeca106725 | 620 | * @} |
Kojto | 122:f9eeca106725 | 621 | */ |
Kojto | 122:f9eeca106725 | 622 | |
Kojto | 122:f9eeca106725 | 623 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 624 | /** @defgroup FMPI2C_Private_Constants FMPI2C Private Constants |
Kojto | 122:f9eeca106725 | 625 | * @{ |
Kojto | 122:f9eeca106725 | 626 | */ |
Kojto | 122:f9eeca106725 | 627 | |
Kojto | 122:f9eeca106725 | 628 | /** |
Kojto | 122:f9eeca106725 | 629 | * @} |
Kojto | 122:f9eeca106725 | 630 | */ |
Kojto | 122:f9eeca106725 | 631 | |
Kojto | 122:f9eeca106725 | 632 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 633 | /** @defgroup FMPI2C_Private_Macro FMPI2C Private Macros |
Kojto | 122:f9eeca106725 | 634 | * @{ |
Kojto | 122:f9eeca106725 | 635 | */ |
Kojto | 122:f9eeca106725 | 636 | |
Kojto | 122:f9eeca106725 | 637 | #define IS_FMPI2C_ADDRESSING_MODE(MODE) (((MODE) == FMPI2C_ADDRESSINGMODE_7BIT) || \ |
Kojto | 122:f9eeca106725 | 638 | ((MODE) == FMPI2C_ADDRESSINGMODE_10BIT)) |
Kojto | 122:f9eeca106725 | 639 | |
Kojto | 122:f9eeca106725 | 640 | #define IS_FMPI2C_DUAL_ADDRESS(ADDRESS) (((ADDRESS) == FMPI2C_DUALADDRESS_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 641 | ((ADDRESS) == FMPI2C_DUALADDRESS_ENABLE)) |
Kojto | 122:f9eeca106725 | 642 | |
Kojto | 122:f9eeca106725 | 643 | #define IS_FMPI2C_OWN_ADDRESS2_MASK(MASK) (((MASK) == FMPI2C_OA2_NOMASK) || \ |
Kojto | 122:f9eeca106725 | 644 | ((MASK) == FMPI2C_OA2_MASK01) || \ |
Kojto | 122:f9eeca106725 | 645 | ((MASK) == FMPI2C_OA2_MASK02) || \ |
Kojto | 122:f9eeca106725 | 646 | ((MASK) == FMPI2C_OA2_MASK03) || \ |
Kojto | 122:f9eeca106725 | 647 | ((MASK) == FMPI2C_OA2_MASK04) || \ |
Kojto | 122:f9eeca106725 | 648 | ((MASK) == FMPI2C_OA2_MASK05) || \ |
Kojto | 122:f9eeca106725 | 649 | ((MASK) == FMPI2C_OA2_MASK06) || \ |
Kojto | 122:f9eeca106725 | 650 | ((MASK) == FMPI2C_OA2_MASK07)) |
Kojto | 122:f9eeca106725 | 651 | |
Kojto | 122:f9eeca106725 | 652 | #define IS_FMPI2C_GENERAL_CALL(CALL) (((CALL) == FMPI2C_GENERALCALL_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 653 | ((CALL) == FMPI2C_GENERALCALL_ENABLE)) |
Kojto | 122:f9eeca106725 | 654 | |
Kojto | 122:f9eeca106725 | 655 | #define IS_FMPI2C_NO_STRETCH(STRETCH) (((STRETCH) == FMPI2C_NOSTRETCH_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 656 | ((STRETCH) == FMPI2C_NOSTRETCH_ENABLE)) |
Kojto | 122:f9eeca106725 | 657 | |
Kojto | 122:f9eeca106725 | 658 | #define IS_FMPI2C_MEMADD_SIZE(SIZE) (((SIZE) == FMPI2C_MEMADD_SIZE_8BIT) || \ |
Kojto | 122:f9eeca106725 | 659 | ((SIZE) == FMPI2C_MEMADD_SIZE_16BIT)) |
Kojto | 122:f9eeca106725 | 660 | |
Kojto | 122:f9eeca106725 | 661 | #define IS_TRANSFER_MODE(MODE) (((MODE) == FMPI2C_RELOAD_MODE) || \ |
Kojto | 122:f9eeca106725 | 662 | ((MODE) == FMPI2C_AUTOEND_MODE) || \ |
Kojto | 122:f9eeca106725 | 663 | ((MODE) == FMPI2C_SOFTEND_MODE)) |
Kojto | 122:f9eeca106725 | 664 | |
Kojto | 122:f9eeca106725 | 665 | #define IS_TRANSFER_REQUEST(REQUEST) (((REQUEST) == FMPI2C_GENERATE_STOP) || \ |
Kojto | 122:f9eeca106725 | 666 | ((REQUEST) == FMPI2C_GENERATE_START_READ) || \ |
Kojto | 122:f9eeca106725 | 667 | ((REQUEST) == FMPI2C_GENERATE_START_WRITE) || \ |
Kojto | 122:f9eeca106725 | 668 | ((REQUEST) == FMPI2C_NO_STARTSTOP)) |
Kojto | 122:f9eeca106725 | 669 | |
Kojto | 122:f9eeca106725 | 670 | #define IS_FMPI2C_TRANSFER_OPTIONS_REQUEST(REQUEST) (((REQUEST) == FMPI2C_FIRST_FRAME) || \ |
Kojto | 122:f9eeca106725 | 671 | ((REQUEST) == FMPI2C_NEXT_FRAME) || \ |
Kojto | 122:f9eeca106725 | 672 | ((REQUEST) == FMPI2C_FIRST_AND_LAST_FRAME) || \ |
Kojto | 122:f9eeca106725 | 673 | ((REQUEST) == FMPI2C_LAST_FRAME)) |
Kojto | 122:f9eeca106725 | 674 | |
Kojto | 122:f9eeca106725 | 675 | #define 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 | 122:f9eeca106725 | 676 | |
Kojto | 122:f9eeca106725 | 677 | #define FMPI2C_GET_ADDR_MATCH(__HANDLE__) (((__HANDLE__)->Instance->ISR & FMPI2C_ISR_ADDCODE) >> 16) |
Kojto | 122:f9eeca106725 | 678 | #define FMPI2C_GET_DIR(__HANDLE__) (((__HANDLE__)->Instance->ISR & FMPI2C_ISR_DIR) >> 16) |
Kojto | 122:f9eeca106725 | 679 | #define FMPI2C_GET_STOP_MODE(__HANDLE__) ((__HANDLE__)->Instance->CR2 & FMPI2C_CR2_AUTOEND) |
Kojto | 122:f9eeca106725 | 680 | #define FMPI2C_GET_OWN_ADDRESS1(__HANDLE__) ((__HANDLE__)->Instance->OAR1 & FMPI2C_OAR1_OA1) |
Kojto | 122:f9eeca106725 | 681 | #define FMPI2C_GET_OWN_ADDRESS2(__HANDLE__) ((__HANDLE__)->Instance->OAR2 & FMPI2C_OAR2_OA2) |
Kojto | 122:f9eeca106725 | 682 | |
Kojto | 122:f9eeca106725 | 683 | #define IS_FMPI2C_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= (uint32_t)0x000003FFU) |
Kojto | 122:f9eeca106725 | 684 | #define IS_FMPI2C_OWN_ADDRESS2(ADDRESS2) ((ADDRESS2) <= (uint16_t)0x00FFU) |
Kojto | 122:f9eeca106725 | 685 | |
Kojto | 122:f9eeca106725 | 686 | #define FMPI2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00U))) >> 8U))) |
Kojto | 122:f9eeca106725 | 687 | #define FMPI2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FFU)))) |
Kojto | 122:f9eeca106725 | 688 | |
Kojto | 122:f9eeca106725 | 689 | #define 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 | 122:f9eeca106725 | 690 | (uint32_t)((((uint32_t)(__ADDRESS__) & (FMPI2C_CR2_SADD)) | (FMPI2C_CR2_ADD10) | (FMPI2C_CR2_START)) & (~FMPI2C_CR2_RD_WRN))) |
Kojto | 122:f9eeca106725 | 691 | /** |
Kojto | 122:f9eeca106725 | 692 | * @} |
Kojto | 122:f9eeca106725 | 693 | */ |
Kojto | 122:f9eeca106725 | 694 | |
Kojto | 122:f9eeca106725 | 695 | /* Private Functions ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 696 | /** @defgroup FMPI2C_Private_Functions FMPI2C Private Functions |
Kojto | 122:f9eeca106725 | 697 | * @{ |
Kojto | 122:f9eeca106725 | 698 | */ |
Kojto | 122:f9eeca106725 | 699 | /* Private functions are defined in stm32f4xx_hal_fmpi2c.c file */ |
Kojto | 122:f9eeca106725 | 700 | /** |
Kojto | 122:f9eeca106725 | 701 | * @} |
Kojto | 122:f9eeca106725 | 702 | */ |
Kojto | 122:f9eeca106725 | 703 | |
Kojto | 122:f9eeca106725 | 704 | /** |
Kojto | 122:f9eeca106725 | 705 | * @} |
Kojto | 122:f9eeca106725 | 706 | */ |
Kojto | 122:f9eeca106725 | 707 | |
Kojto | 122:f9eeca106725 | 708 | /** |
Kojto | 122:f9eeca106725 | 709 | * @} |
Kojto | 122:f9eeca106725 | 710 | */ |
Kojto | 122:f9eeca106725 | 711 | #endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ |
Kojto | 122:f9eeca106725 | 712 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 713 | } |
Kojto | 122:f9eeca106725 | 714 | #endif |
Kojto | 122:f9eeca106725 | 715 | |
Kojto | 122:f9eeca106725 | 716 | |
Kojto | 122:f9eeca106725 | 717 | #endif /* __STM32F4xx_HAL_FMPI2C_H */ |
Kojto | 122:f9eeca106725 | 718 | |
Kojto | 122:f9eeca106725 | 719 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |