text: #include "spi.h"
  #include "main.h"
  #include "uart.h"
  
  SPI_HandleTypeDef hspi1;
  
  void initSPI(void)
  {
  	hspi1.Instance = SPI1;
  	hspi1.Init.Mode = SPI_MODE_MASTER;
  	hspi1.Init.Direction = SPI_DIRECTION_1LINE;
  	hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
  	hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
  	hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
  	hspi1.Init.NSS = SPI_NSS_SOFT;
  	hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
  	hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
  	hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
  	hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
  	hspi1.Init.CRCPolynomial = 10;
  
  	if (HAL_SPI_Init(&hspi1) != HAL_OK)
  	{
  		DEBUG_PRINTF("SPI ERROR\n");
  	}
  }
  