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