annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc/stm32f4xx_hal_i2c.h @ 85:923c4566a2a1 kittz

increased interCPU baudrate, cpu2: i2c in SPI1 IRQ
author Dmitry Romanov <kitt@bk.ru>
date Wed, 21 Nov 2018 12:49:54 +0300
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file stm32f4xx_hal_i2c.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.2.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-December-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief Header file of I2C HAL module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #ifndef __STM32F4xx_HAL_I2C_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #define __STM32F4xx_HAL_I2C_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 #include "stm32f4xx_hal_def.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 /** @addtogroup STM32F4xx_HAL_Driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /** @addtogroup I2C
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Exported types ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 /** @defgroup I2C_Exported_Types I2C Exported Types
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 * @brief I2C Configuration Structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 uint32_t ClockSpeed; /*!< Specifies the clock frequency.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 This parameter must be set to a value lower than 400kHz */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 uint32_t DutyCycle; /*!< Specifies the I2C fast mode duty cycle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 This parameter can be a value of @ref I2C_duty_cycle_in_fast_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 uint32_t OwnAddress1; /*!< Specifies the first device own address.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 This parameter can be a 7-bit or 10-bit address. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 uint32_t AddressingMode; /*!< Specifies if 7-bit or 10-bit addressing mode is selected.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 This parameter can be a value of @ref I2C_addressing_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 uint32_t DualAddressMode; /*!< Specifies if dual addressing mode is selected.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 This parameter can be a value of @ref I2C_dual_addressing_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 uint32_t OwnAddress2; /*!< Specifies the second device own address if dual addressing mode is selected
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 This parameter can be a 7-bit address. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 uint32_t GeneralCallMode; /*!< Specifies if general call mode is selected.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 This parameter can be a value of @ref I2C_general_call_addressing_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 uint32_t NoStretchMode; /*!< Specifies if nostretch mode is selected.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 This parameter can be a value of @ref I2C_nostretch_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 }I2C_InitTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 * @brief HAL State structures definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 typedef enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 HAL_I2C_STATE_RESET = 0x00, /*!< I2C not yet initialized or disabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 HAL_I2C_STATE_READY = 0x01, /*!< I2C initialized and ready for use */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 HAL_I2C_STATE_BUSY = 0x02, /*!< I2C internal process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 HAL_I2C_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 HAL_I2C_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 HAL_I2C_STATE_MEM_BUSY_TX = 0x32, /*!< Memory Data Transmission process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 HAL_I2C_STATE_MEM_BUSY_RX = 0x42, /*!< Memory Data Reception process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 HAL_I2C_STATE_TIMEOUT = 0x03, /*!< I2C timeout state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 HAL_I2C_STATE_ERROR = 0x04 /*!< I2C error state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 }HAL_I2C_StateTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 * @brief I2C handle Structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 I2C_TypeDef *Instance; /*!< I2C registers base address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 I2C_InitTypeDef Init; /*!< I2C communication parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 uint8_t *pBuffPtr; /*!< Pointer to I2C transfer buffer */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 uint16_t XferSize; /*!< I2C transfer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 __IO uint16_t XferCount; /*!< I2C transfer counter */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 DMA_HandleTypeDef *hdmatx; /*!< I2C Tx DMA handle parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 DMA_HandleTypeDef *hdmarx; /*!< I2C Rx DMA handle parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 HAL_LockTypeDef Lock; /*!< I2C locking object */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 __IO HAL_I2C_StateTypeDef State; /*!< I2C communication state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 __IO uint32_t ErrorCode; /*!< I2C Error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 }I2C_HandleTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 /* Exported constants --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 /** @defgroup I2C_Exported_Constants I2C Exported Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 /** @defgroup I2C_Error_Code I2C Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 * @brief I2C Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 #define HAL_I2C_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 #define HAL_I2C_ERROR_BERR ((uint32_t)0x00000001) /*!< BERR error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 #define HAL_I2C_ERROR_ARLO ((uint32_t)0x00000002) /*!< ARLO error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 #define HAL_I2C_ERROR_AF ((uint32_t)0x00000004) /*!< AF error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 #define HAL_I2C_ERROR_OVR ((uint32_t)0x00000008) /*!< OVR error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 #define HAL_I2C_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 #define HAL_I2C_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout Error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 /** @defgroup I2C_duty_cycle_in_fast_mode I2C duty cycle in fast mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 #define I2C_DUTYCYCLE_2 ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 #define I2C_DUTYCYCLE_16_9 I2C_CCR_DUTY
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 /** @defgroup I2C_addressing_mode I2C addressing mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 #define I2C_ADDRESSINGMODE_7BIT ((uint32_t)0x00004000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 #define I2C_ADDRESSINGMODE_10BIT (I2C_OAR1_ADDMODE | ((uint32_t)0x00004000))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 /** @defgroup I2C_dual_addressing_mode I2C dual addressing mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 #define I2C_DUALADDRESS_DISABLE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 #define I2C_DUALADDRESS_ENABLE I2C_OAR2_ENDUAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 /** @defgroup I2C_general_call_addressing_mode I2C general call addressing mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 #define I2C_GENERALCALL_DISABLE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 #define I2C_GENERALCALL_ENABLE I2C_CR1_ENGC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 /** @defgroup I2C_nostretch_mode I2C nostretch mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 #define I2C_NOSTRETCH_DISABLE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 #define I2C_NOSTRETCH_ENABLE I2C_CR1_NOSTRETCH
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 /** @defgroup I2C_Memory_Address_Size I2C Memory Address Size
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 #define I2C_MEMADD_SIZE_8BIT ((uint32_t)0x00000001)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 #define I2C_MEMADD_SIZE_16BIT ((uint32_t)0x00000010)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 /** @defgroup I2C_Interrupt_configuration_definition I2C Interrupt configuration definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 #define I2C_IT_BUF I2C_CR2_ITBUFEN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 #define I2C_IT_EVT I2C_CR2_ITEVTEN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 #define I2C_IT_ERR I2C_CR2_ITERREN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 /** @defgroup I2C_Flag_definition I2C Flag definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 #define I2C_FLAG_SMBALERT ((uint32_t)0x00018000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 #define I2C_FLAG_TIMEOUT ((uint32_t)0x00014000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 #define I2C_FLAG_PECERR ((uint32_t)0x00011000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 #define I2C_FLAG_OVR ((uint32_t)0x00010800)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 #define I2C_FLAG_AF ((uint32_t)0x00010400)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 #define I2C_FLAG_ARLO ((uint32_t)0x00010200)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 #define I2C_FLAG_BERR ((uint32_t)0x00010100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 #define I2C_FLAG_TXE ((uint32_t)0x00010080)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 #define I2C_FLAG_RXNE ((uint32_t)0x00010040)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 #define I2C_FLAG_STOPF ((uint32_t)0x00010010)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 #define I2C_FLAG_ADD10 ((uint32_t)0x00010008)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 #define I2C_FLAG_BTF ((uint32_t)0x00010004)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 #define I2C_FLAG_ADDR ((uint32_t)0x00010002)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 #define I2C_FLAG_SB ((uint32_t)0x00010001)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 #define I2C_FLAG_DUALF ((uint32_t)0x00100080)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 #define I2C_FLAG_SMBHOST ((uint32_t)0x00100040)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 #define I2C_FLAG_SMBDEFAULT ((uint32_t)0x00100020)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 #define I2C_FLAG_GENCALL ((uint32_t)0x00100010)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 #define I2C_FLAG_TRA ((uint32_t)0x00100004)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 #define I2C_FLAG_BUSY ((uint32_t)0x00100002)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 #define I2C_FLAG_MSL ((uint32_t)0x00100001)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 /* Exported macro ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 /** @defgroup I2C_Exported_Macros I2C Exported Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 /** @brief Reset I2C handle state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 * @param __HANDLE__: specifies the I2C Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2C_STATE_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 /** @brief Enable or disable the specified I2C interrupts.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 * @param __HANDLE__: specifies the I2C Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 * @param __INTERRUPT__: specifies the interrupt source to enable or disable.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 * @arg I2C_IT_BUF: Buffer interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 * @arg I2C_IT_EVT: Event interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 * @arg I2C_IT_ERR: Error interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 #define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 #define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 /** @brief Checks if the specified I2C interrupt source is enabled or disabled.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 * @param __HANDLE__: specifies the I2C Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 * @param __INTERRUPT__: specifies the I2C interrupt source to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 * @arg I2C_IT_BUF: Buffer interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 * @arg I2C_IT_EVT: Event interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 * @arg I2C_IT_ERR: Error interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 #define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 /** @brief Checks whether the specified I2C flag is set or not.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 * @param __HANDLE__: specifies the I2C Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 * @param __FLAG__: specifies the flag to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 * @arg I2C_FLAG_SMBALERT: SMBus Alert flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 * @arg I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 * @arg I2C_FLAG_PECERR: PEC error in reception flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 * @arg I2C_FLAG_OVR: Overrun/Underrun flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 * @arg I2C_FLAG_AF: Acknowledge failure flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 * @arg I2C_FLAG_ARLO: Arbitration lost flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 * @arg I2C_FLAG_BERR: Bus error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 * @arg I2C_FLAG_TXE: Data register empty flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 * @arg I2C_FLAG_RXNE: Data register not empty flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 * @arg I2C_FLAG_STOPF: Stop detection flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 * @arg I2C_FLAG_ADD10: 10-bit header sent flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 * @arg I2C_FLAG_BTF: Byte transfer finished flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 * @arg I2C_FLAG_ADDR: Address sent flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 * Address matched flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 * @arg I2C_FLAG_SB: Start bit flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 * @arg I2C_FLAG_DUALF: Dual flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 * @arg I2C_FLAG_SMBHOST: SMBus host header
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 * @arg I2C_FLAG_SMBDEFAULT: SMBus default header
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 * @arg I2C_FLAG_GENCALL: General call header flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 * @arg I2C_FLAG_TRA: Transmitter/Receiver flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 * @arg I2C_FLAG_BUSY: Bus busy flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 * @arg I2C_FLAG_MSL: Master/Slave flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 * @retval The new state of __FLAG__ (TRUE or FALSE).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 #define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__) ((((uint8_t)((__FLAG__) >> 16)) == 0x01)?((((__HANDLE__)->Instance->SR1) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)): \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 ((((__HANDLE__)->Instance->SR2) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 /** @brief Clears the I2C pending flags which are cleared by writing 0 in a specific bit.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 * @param __HANDLE__: specifies the I2C Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 * @param __FLAG__: specifies the flag to clear.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 * This parameter can be any combination of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 * @arg I2C_FLAG_SMBALERT: SMBus Alert flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 * @arg I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 * @arg I2C_FLAG_PECERR: PEC error in reception flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 * @arg I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 * @arg I2C_FLAG_AF: Acknowledge failure flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 * @arg I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 * @arg I2C_FLAG_BERR: Bus error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 #define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR1 = ~((__FLAG__) & I2C_FLAG_MASK))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 /** @brief Clears the I2C ADDR pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 * @param __HANDLE__: specifies the I2C Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 #define __HAL_I2C_CLEAR_ADDRFLAG(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 __IO uint32_t tmpreg; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 tmpreg = (__HANDLE__)->Instance->SR1; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 tmpreg = (__HANDLE__)->Instance->SR2; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 UNUSED(tmpreg); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 /** @brief Clears the I2C STOPF pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 * @param __HANDLE__: specifies the I2C Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 * This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 #define __HAL_I2C_CLEAR_STOPFLAG(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 __IO uint32_t tmpreg; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 tmpreg = (__HANDLE__)->Instance->SR1; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 (__HANDLE__)->Instance->CR1 |= I2C_CR1_PE; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 UNUSED(tmpreg); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 #define __HAL_I2C_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= I2C_CR1_PE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 #define __HAL_I2C_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~I2C_CR1_PE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 /* Include I2C HAL Extension module */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 #include "stm32f4xx_hal_i2c_ex.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 /** @addtogroup I2C_Exported_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 /** @addtogroup I2C_Exported_Functions_Group1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 /* Initialization/de-initialization functions **********************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 HAL_StatusTypeDef HAL_I2C_DeInit (I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 /** @addtogroup I2C_Exported_Functions_Group2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 /* I/O operation functions *****************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 /******* Blocking mode: Polling */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 HAL_StatusTypeDef HAL_I2C_Slave_Receive(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 /******* Non-Blocking mode: Interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 HAL_StatusTypeDef HAL_I2C_Master_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 HAL_StatusTypeDef HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 HAL_StatusTypeDef HAL_I2C_Mem_Read_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 /******* Non-Blocking mode: DMA */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 /******* I2C IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 void HAL_I2C_ER_IRQHandler(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 void HAL_I2C_SlaveTxCpltCallback(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 /** @addtogroup I2C_Exported_Functions_Group3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 /* Peripheral Control and State functions **************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 HAL_I2C_StateTypeDef HAL_I2C_GetState(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 /* Private constants ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 /** @defgroup I2C_Private_Constants I2C Private Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 #define I2C_FLAG_MASK ((uint32_t)0x0000FFFF)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 /* Private macros ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 /** @defgroup I2C_Private_Macros I2C Private Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 #define I2C_FREQRANGE(__PCLK__) ((__PCLK__)/1000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 #define I2C_RISE_TIME(__FREQRANGE__, __SPEED__) (((__SPEED__) <= 100000) ? ((__FREQRANGE__) + 1) : ((((__FREQRANGE__) * 300) / 1000) + 1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 #define I2C_SPEED_STANDARD(__PCLK__, __SPEED__) (((((__PCLK__)/((__SPEED__) << 1)) & I2C_CCR_CCR) < 4)? 4:((__PCLK__) / ((__SPEED__) << 1)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 #define I2C_SPEED_FAST(__PCLK__, __SPEED__, __DUTYCYCLE__) (((__DUTYCYCLE__) == I2C_DUTYCYCLE_2)? ((__PCLK__) / ((__SPEED__) * 3)) : (((__PCLK__) / ((__SPEED__) * 25)) | I2C_DUTYCYCLE_16_9))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 #define I2C_SPEED(__PCLK__, __SPEED__, __DUTYCYCLE__) (((__SPEED__) <= 100000)? (I2C_SPEED_STANDARD((__PCLK__), (__SPEED__))) : \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 ((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__)) & I2C_CCR_CCR) == 0)? 1 : \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 ((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__))) | I2C_CCR_FS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 #define I2C_7BIT_ADD_WRITE(__ADDRESS__) ((uint8_t)((__ADDRESS__) & (~I2C_OAR1_ADD0)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 #define I2C_7BIT_ADD_READ(__ADDRESS__) ((uint8_t)((__ADDRESS__) | I2C_OAR1_ADD0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 #define I2C_10BIT_ADDRESS(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF))))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 #define I2C_10BIT_HEADER_WRITE(__ADDRESS__) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF0))))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 #define I2C_10BIT_HEADER_READ(__ADDRESS__) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF1))))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 #define I2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00))) >> 8)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 #define I2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF))))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 /** @defgroup I2C_IS_RTC_Definitions I2C Private macros to check input parameters
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 #define IS_I2C_DUTY_CYCLE(CYCLE) (((CYCLE) == I2C_DUTYCYCLE_2) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 ((CYCLE) == I2C_DUTYCYCLE_16_9))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 #define IS_I2C_ADDRESSING_MODE(ADDRESS) (((ADDRESS) == I2C_ADDRESSINGMODE_7BIT) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 ((ADDRESS) == I2C_ADDRESSINGMODE_10BIT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 #define IS_I2C_DUAL_ADDRESS(ADDRESS) (((ADDRESS) == I2C_DUALADDRESS_DISABLE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 ((ADDRESS) == I2C_DUALADDRESS_ENABLE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 #define IS_I2C_GENERAL_CALL(CALL) (((CALL) == I2C_GENERALCALL_DISABLE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 ((CALL) == I2C_GENERALCALL_ENABLE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 #define IS_I2C_NO_STRETCH(STRETCH) (((STRETCH) == I2C_NOSTRETCH_DISABLE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 ((STRETCH) == I2C_NOSTRETCH_ENABLE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 #define IS_I2C_MEMADD_SIZE(SIZE) (((SIZE) == I2C_MEMADD_SIZE_8BIT) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 ((SIZE) == I2C_MEMADD_SIZE_16BIT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 #define IS_I2C_CLOCK_SPEED(SPEED) (((SPEED) > 0) && ((SPEED) <= 400000))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 #define IS_I2C_OWN_ADDRESS1(ADDRESS1) (((ADDRESS1) & (uint32_t)(0xFFFFFC00)) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 #define IS_I2C_OWN_ADDRESS2(ADDRESS2) (((ADDRESS2) & (uint32_t)(0xFFFFFF01)) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 /** @defgroup I2C_Private_Functions I2C Private Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 #endif /* __STM32F4xx_HAL_I2C_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/