firmware/src/platform/std_periph/src/stm32f4xx_spi.c
/**
  * @brief  De-initialize the SPIx peripheral registers to their default reset values.
  * @param  SPIx: To select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 
  *         in SPI mode or 2 or 3 in I2S mode.   
  *         
  * @note   The extended I2S blocks (ie. I2S2ext and I2S3ext blocks) are de-initialized
  *         when the relative I2S peripheral is de-initialized (the extended block's clock
  *         is managed by the I2S peripheral clock).
  *             
  * @retval None
  */
@brief  De-initialize the SPIx peripheral registers to their default reset values.
@param  SPIx: To select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6
in SPI mode or 2 or 3 in I2S mode.

@note   The extended I2S blocks  are de-initialized
when the relative I2S peripheral is de-initialized (the extended block's clock
is managed by the I2S peripheral clock).

@retval None
@brief De - initialize the SPIx peripheral registers to their default reset values . @param SPIx : To select the SPIx / I2Sx peripheral where x can be : 1 2 3 4 5 or 6 in SPI mode or 2 or 3 in I2S mode . @note The extended I2S blocks are de - initialized when the relative I2S peripheral is de - initialized ( the extended block ' s clock is managed by the I2S peripheral clock ) . @retval None
void SPI_I2S_DeInit(SPI_TypeDef* SPIx)
{
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  if (SPIx == SPI1)
  {
    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
  }
  else if (SPIx == SPI2)
  {
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
  }
  else if (SPIx == SPI3)
  {
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
  }
  else if (SPIx == SPI4)
  {
    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI4, ENABLE);
    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI4, DISABLE);
  }
  else if (SPIx == SPI5)
  {
    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI5, ENABLE);
    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI5, DISABLE);
  }
  else 
  {
    if (SPIx == SPI6)
    {
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI6, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI6, DISABLE);
    }
  }
}
void SPI_I2S_DeInit ( SPI_TypeDef * SPIx ) { assert_param ( IS_SPI_ALL_PERIPH ( SPIx ) ) ; if ( SPIx == SPI1 ) { RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI1 , ENABLE ) ; RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI1 , DISABLE ) ; } else if ( SPIx == SPI2 ) { RCC_APB1PeriphResetCmd ( RCC_APB1Periph_SPI2 , ENABLE ) ; RCC_APB1PeriphResetCmd ( RCC_APB1Periph_SPI2 , DISABLE ) ; } else if ( SPIx == SPI3 ) { RCC_APB1PeriphResetCmd ( RCC_APB1Periph_SPI3 , ENABLE ) ; RCC_APB1PeriphResetCmd ( RCC_APB1Periph_SPI3 , DISABLE ) ; } else if ( SPIx == SPI4 ) { RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI4 , ENABLE ) ; RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI4 , DISABLE ) ; } else if ( SPIx == SPI5 ) { RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI5 , ENABLE ) ; RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI5 , DISABLE ) ; } else { if ( SPIx == SPI6 ) { RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI6 , ENABLE ) ; RCC_APB2PeriphResetCmd ( RCC_APB2Periph_SPI6 , DISABLE ) ; } } }
@brief  De-initialize the SPIx peripheral registers to their default reset values.
@brief De - initialize the SPIx peripheral registers to their default reset values .
/* Check the parameters */ /* Enable SPI1 reset state */ /* Release SPI1 from reset state */ /* Enable SPI2 reset state */ /* Release SPI2 from reset state */ /* Enable SPI3 reset state */ /* Release SPI3 from reset state */ /* Enable SPI4 reset state */ /* Release SPI4 from reset state */ /* Enable SPI5 reset state */ /* Release SPI5 from reset state */ /* Enable SPI6 reset state */ /* Release SPI6 from reset state */