Rev 2 | Rev 8 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 4 | ||
|---|---|---|---|
| Line 79... | Line 79... | ||
| 79 | 79 | ||
| 80 | /* USER CODE END MspInit 1 */ |
80 | /* USER CODE END MspInit 1 */ |
| 81 | } |
81 | } |
| 82 | 82 | ||
| 83 | /** |
83 | /** |
| - | 84 | * @brief I2C MSP Initialization |
|
| - | 85 | * This function configures the hardware resources used in this example |
|
| - | 86 | * @param hi2c: I2C handle pointer |
|
| - | 87 | * @retval None |
|
| - | 88 | */ |
|
| - | 89 | void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c) |
|
| - | 90 | { |
|
| - | 91 | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|
| - | 92 | if(hi2c->Instance==I2C1) |
|
| - | 93 | { |
|
| - | 94 | /* USER CODE BEGIN I2C1_MspInit 0 */ |
|
| - | 95 | ||
| - | 96 | /* USER CODE END I2C1_MspInit 0 */ |
|
| - | 97 | ||
| - | 98 | __HAL_RCC_GPIOB_CLK_ENABLE(); |
|
| - | 99 | /**I2C1 GPIO Configuration |
|
| - | 100 | PB6 ------> I2C1_SCL |
|
| - | 101 | PB7 ------> I2C1_SDA |
|
| - | 102 | */ |
|
| - | 103 | GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7; |
|
| - | 104 | GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; |
|
| - | 105 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
|
| - | 106 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
| - | 107 | ||
| - | 108 | /* Peripheral clock enable */ |
|
| - | 109 | __HAL_RCC_I2C1_CLK_ENABLE(); |
|
| - | 110 | /* USER CODE BEGIN I2C1_MspInit 1 */ |
|
| - | 111 | ||
| - | 112 | /* USER CODE END I2C1_MspInit 1 */ |
|
| - | 113 | } |
|
| - | 114 | ||
| - | 115 | } |
|
| - | 116 | ||
| - | 117 | /** |
|
| - | 118 | * @brief I2C MSP De-Initialization |
|
| - | 119 | * This function freeze the hardware resources used in this example |
|
| - | 120 | * @param hi2c: I2C handle pointer |
|
| - | 121 | * @retval None |
|
| - | 122 | */ |
|
| - | 123 | void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c) |
|
| - | 124 | { |
|
| - | 125 | if(hi2c->Instance==I2C1) |
|
| - | 126 | { |
|
| - | 127 | /* USER CODE BEGIN I2C1_MspDeInit 0 */ |
|
| - | 128 | ||
| - | 129 | /* USER CODE END I2C1_MspDeInit 0 */ |
|
| - | 130 | /* Peripheral clock disable */ |
|
| - | 131 | __HAL_RCC_I2C1_CLK_DISABLE(); |
|
| - | 132 | ||
| - | 133 | /**I2C1 GPIO Configuration |
|
| - | 134 | PB6 ------> I2C1_SCL |
|
| - | 135 | PB7 ------> I2C1_SDA |
|
| - | 136 | */ |
|
| - | 137 | HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6); |
|
| - | 138 | ||
| - | 139 | HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7); |
|
| - | 140 | ||
| - | 141 | /* USER CODE BEGIN I2C1_MspDeInit 1 */ |
|
| - | 142 | ||
| - | 143 | /* USER CODE END I2C1_MspDeInit 1 */ |
|
| - | 144 | } |
|
| - | 145 | ||
| - | 146 | } |
|
| - | 147 | ||
| - | 148 | /** |
|
| 84 | * @brief SPI MSP Initialization |
149 | * @brief SPI MSP Initialization |
| 85 | * This function configures the hardware resources used in this example |
150 | * This function configures the hardware resources used in this example |
| 86 | * @param hspi: SPI handle pointer |
151 | * @param hspi: SPI handle pointer |
| 87 | * @retval None |
152 | * @retval None |
| 88 | */ |
153 | */ |