/* Set the SPI peripheral registers to their default reset values.  */
void SPI_Reset(SPI_T *spi)
/* Set the SPI peripheral registers to their default reset values.  */
void SPI_Reset(SPI_T *spi)
{
    if (spi == SPI1)
    {
        RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_SPI1);
        RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_SPI1);
    }
    else
    {
        RCM_EnableAPB1PeriphReset(RCM_APB1_PERIPH_SPI2);
        RCM_DisableAPB1PeriphReset(RCM_APB1_PERIPH_SPI2);
    }
}