/* Deinitializes the SPIx peripheral registers to their default reset values (Affects also the I2Ss).  */
void SPI_I2S_DeInit(SPI_TypeDef *SPIx)
/* Deinitializes the SPIx peripheral registers to their default reset values (Affects also the I2Ss).  */
void SPI_I2S_DeInit(SPI_TypeDef *SPIx)
{
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  switch (*(uint32_t*)&SPIx)
  {
    case SPI1_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
      break;
    case SPI2_BASE:
      RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
      RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
      break;
    case SPI3_BASE:
      RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
      RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
      break;
    default:
      break;
  }
}