Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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