Subversion Repositories canSerial

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 3
Line 19... Line 19...
19
  */
19
  */
20
/* USER CODE END Header */
20
/* USER CODE END Header */
21
 
21
 
22
/* Includes ------------------------------------------------------------------*/
22
/* Includes ------------------------------------------------------------------*/
23
#include "main.h"
23
#include "main.h"
-
 
24
 
24
/* USER CODE BEGIN Includes */
25
/* USER CODE BEGIN Includes */
25
 
26
 
26
/* USER CODE END Includes */
27
/* USER CODE END Includes */
27
 
28
 
28
/* Private typedef -----------------------------------------------------------*/
29
/* Private typedef -----------------------------------------------------------*/
Line 159... Line 160...
159
  }
160
  }
160
 
161
 
161
}
162
}
162
 
163
 
163
/**
164
/**
-
 
165
* @brief SPI MSP Initialization
-
 
166
* This function configures the hardware resources used in this example
-
 
167
* @param hspi: SPI handle pointer
-
 
168
* @retval None
-
 
169
*/
-
 
170
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
-
 
171
{
-
 
172
  GPIO_InitTypeDef GPIO_InitStruct = {0};
-
 
173
  if(hspi->Instance==SPI1)
-
 
174
  {
-
 
175
  /* USER CODE BEGIN SPI1_MspInit 0 */
-
 
176
 
-
 
177
  /* USER CODE END SPI1_MspInit 0 */
-
 
178
    /* Peripheral clock enable */
-
 
179
    __HAL_RCC_SPI1_CLK_ENABLE();
-
 
180
 
-
 
181
    __HAL_RCC_GPIOA_CLK_ENABLE();
-
 
182
    /**SPI1 GPIO Configuration
-
 
183
    PA5     ------> SPI1_SCK
-
 
184
    PA7     ------> SPI1_MOSI
-
 
185
    */
-
 
186
    GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_7;
-
 
187
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-
 
188
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
-
 
189
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
 
190
 
-
 
191
  /* USER CODE BEGIN SPI1_MspInit 1 */
-
 
192
 
-
 
193
  /* USER CODE END SPI1_MspInit 1 */
-
 
194
  }
-
 
195
 
-
 
196
}
-
 
197
 
-
 
198
/**
-
 
199
* @brief SPI MSP De-Initialization
-
 
200
* This function freeze the hardware resources used in this example
-
 
201
* @param hspi: SPI handle pointer
-
 
202
* @retval None
-
 
203
*/
-
 
204
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
-
 
205
{
-
 
206
  if(hspi->Instance==SPI1)
-
 
207
  {
-
 
208
  /* USER CODE BEGIN SPI1_MspDeInit 0 */
-
 
209
 
-
 
210
  /* USER CODE END SPI1_MspDeInit 0 */
-
 
211
    /* Peripheral clock disable */
-
 
212
    __HAL_RCC_SPI1_CLK_DISABLE();
-
 
213
 
-
 
214
    /**SPI1 GPIO Configuration
-
 
215
    PA5     ------> SPI1_SCK
-
 
216
    PA7     ------> SPI1_MOSI
-
 
217
    */
-
 
218
    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_7);
-
 
219
 
-
 
220
  /* USER CODE BEGIN SPI1_MspDeInit 1 */
-
 
221
 
-
 
222
  /* USER CODE END SPI1_MspDeInit 1 */
-
 
223
  }
-
 
224
 
-
 
225
}
-
 
226
 
-
 
227
/**
164
* @brief UART MSP Initialization
228
* @brief UART MSP Initialization
165
* This function configures the hardware resources used in this example
229
* This function configures the hardware resources used in this example
166
* @param huart: UART handle pointer
230
* @param huart: UART handle pointer
167
* @retval None
231
* @retval None
168
*/
232
*/