Rev 9 | Rev 13 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9 | Rev 11 | ||
---|---|---|---|
Line 148... | Line 148... | ||
148 | } |
148 | } |
149 | 149 | ||
150 | } |
150 | } |
151 | 151 | ||
152 | /** |
152 | /** |
- | 153 | * @brief I2C MSP Initialization |
|
- | 154 | * This function configures the hardware resources used in this example |
|
- | 155 | * @param hi2c: I2C handle pointer |
|
- | 156 | * @retval None |
|
- | 157 | */ |
|
- | 158 | void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c) |
|
- | 159 | { |
|
- | 160 | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|
- | 161 | if(hi2c->Instance==I2C2) |
|
- | 162 | { |
|
- | 163 | /* USER CODE BEGIN I2C2_MspInit 0 */ |
|
- | 164 | ||
- | 165 | /* USER CODE END I2C2_MspInit 0 */ |
|
- | 166 | ||
- | 167 | __HAL_RCC_GPIOB_CLK_ENABLE(); |
|
- | 168 | /**I2C2 GPIO Configuration |
|
- | 169 | PB10 ------> I2C2_SCL |
|
- | 170 | PB11 ------> I2C2_SDA |
|
- | 171 | */ |
|
- | 172 | GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11; |
|
- | 173 | GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; |
|
- | 174 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; |
|
- | 175 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
- | 176 | ||
- | 177 | /* Peripheral clock enable */ |
|
- | 178 | __HAL_RCC_I2C2_CLK_ENABLE(); |
|
- | 179 | /* USER CODE BEGIN I2C2_MspInit 1 */ |
|
- | 180 | ||
- | 181 | /* USER CODE END I2C2_MspInit 1 */ |
|
- | 182 | } |
|
- | 183 | ||
- | 184 | } |
|
- | 185 | ||
- | 186 | /** |
|
- | 187 | * @brief I2C MSP De-Initialization |
|
- | 188 | * This function freeze the hardware resources used in this example |
|
- | 189 | * @param hi2c: I2C handle pointer |
|
- | 190 | * @retval None |
|
- | 191 | */ |
|
- | 192 | void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c) |
|
- | 193 | { |
|
- | 194 | if(hi2c->Instance==I2C2) |
|
- | 195 | { |
|
- | 196 | /* USER CODE BEGIN I2C2_MspDeInit 0 */ |
|
- | 197 | ||
- | 198 | /* USER CODE END I2C2_MspDeInit 0 */ |
|
- | 199 | /* Peripheral clock disable */ |
|
- | 200 | __HAL_RCC_I2C2_CLK_DISABLE(); |
|
- | 201 | ||
- | 202 | /**I2C2 GPIO Configuration |
|
- | 203 | PB10 ------> I2C2_SCL |
|
- | 204 | PB11 ------> I2C2_SDA |
|
- | 205 | */ |
|
- | 206 | HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10); |
|
- | 207 | ||
- | 208 | HAL_GPIO_DeInit(GPIOB, GPIO_PIN_11); |
|
- | 209 | ||
- | 210 | /* USER CODE BEGIN I2C2_MspDeInit 1 */ |
|
- | 211 | ||
- | 212 | /* USER CODE END I2C2_MspDeInit 1 */ |
|
- | 213 | } |
|
- | 214 | ||
- | 215 | } |
|
- | 216 | ||
- | 217 | /** |
|
153 | * @brief SPI MSP Initialization |
218 | * @brief SPI MSP Initialization |
154 | * This function configures the hardware resources used in this example |
219 | * This function configures the hardware resources used in this example |
155 | * @param hspi: SPI handle pointer |
220 | * @param hspi: SPI handle pointer |
156 | * @retval None |
221 | * @retval None |
157 | */ |
222 | */ |