demo-stm32f303-receiver/Core/Src/main.c
/**
  * @brief SPI3 Initialization Function
  * @param None
  * @retval None
  */
@brief SPI3 Initialization Function
@param None
@retval None
@brief SPI3 Initialization Function @param None @retval None
static void MX_SPI3_Init(void)
{
  LL_SPI_InitTypeDef SPI_InitStruct = {0};
  LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI3);
  LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
  GPIO_InitStruct.Pin = LL_GPIO_PIN_10|LL_GPIO_PIN_11|LL_GPIO_PIN_12;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
  LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
  SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
  SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
  SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
  SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE;
  SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
  SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4;
  SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
  SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
  SPI_InitStruct.CRCPoly = 7;
  LL_SPI_Init(SPI3, &SPI_InitStruct);
  LL_SPI_SetStandard(SPI3, LL_SPI_PROTOCOL_MOTOROLA);
  LL_SPI_DisableNSSPulseMgt(SPI3);
}
static void MX_SPI3_Init ( void ) { LL_SPI_InitTypeDef SPI_InitStruct = { 0 } ; LL_GPIO_InitTypeDef GPIO_InitStruct = { 0 } ; LL_APB1_GRP1_EnableClock ( LL_APB1_GRP1_PERIPH_SPI3 ) ; LL_AHB1_GRP1_EnableClock ( LL_AHB1_GRP1_PERIPH_GPIOC ) ; GPIO_InitStruct . Pin = LL_GPIO_PIN_10 | LL_GPIO_PIN_11 | LL_GPIO_PIN_12 ; GPIO_InitStruct . Mode = LL_GPIO_MODE_ALTERNATE ; GPIO_InitStruct . Speed = LL_GPIO_SPEED_FREQ_HIGH ; GPIO_InitStruct . OutputType = LL_GPIO_OUTPUT_PUSHPULL ; GPIO_InitStruct . Pull = LL_GPIO_PULL_NO ; GPIO_InitStruct . Alternate = LL_GPIO_AF_6 ; LL_GPIO_Init ( GPIOC , & GPIO_InitStruct ) ; SPI_InitStruct . TransferDirection = LL_SPI_FULL_DUPLEX ; SPI_InitStruct . Mode = LL_SPI_MODE_MASTER ; SPI_InitStruct . DataWidth = LL_SPI_DATAWIDTH_8BIT ; SPI_InitStruct . ClockPolarity = LL_SPI_POLARITY_LOW ; SPI_InitStruct . ClockPhase = LL_SPI_PHASE_1EDGE ; SPI_InitStruct . NSS = LL_SPI_NSS_SOFT ; SPI_InitStruct . BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4 ; SPI_InitStruct . BitOrder = LL_SPI_MSB_FIRST ; SPI_InitStruct . CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE ; SPI_InitStruct . CRCPoly = 7 ; LL_SPI_Init ( SPI3 , & SPI_InitStruct ) ; LL_SPI_SetStandard ( SPI3 , LL_SPI_PROTOCOL_MOTOROLA ) ; LL_SPI_DisableNSSPulseMgt ( SPI3 ) ; }
@brief SPI3 Initialization Function
 @param None
 @retval None
@brief SPI3 Initialization Function @param None @retval None
/* USER CODE BEGIN SPI3_Init 0 */ /* USER CODE END SPI3_Init 0 */ /* Peripheral clock enable */ /**SPI3 GPIO Configuration  
  PC10   ------> SPI3_SCK
  PC11   ------> SPI3_MISO
  PC12   ------> SPI3_MOSI 
  */ /* USER CODE BEGIN SPI3_Init 1 */ /* USER CODE END SPI3_Init 1 */ /* SPI3 parameter configuration*/ /* USER CODE BEGIN SPI3_Init 2 */ /* USER CODE END SPI3_Init 2 */