/* Deinitializes the SPIx peripheral registers to their default reset values .  */
void SPI_DeInit(SPI_TypeDef *SPIx)
/* Deinitializes the SPIx peripheral registers to their default reset values .  */
void SPI_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;
        default:
            break;
    }
}