/* Resets the SPI module. 
This function will reset the SPI module to its power on default values and disable it. */
void spi_reset(struct spi_module *const module)
/* Resets the SPI module. 
This function will reset the SPI module to its power on default values and disable it. */
void spi_reset(struct spi_module *const module)
{
	Spi *const spi_module = (module->hw);
	spi_disable(module);
	if(spi_module == (void *)SPI0) {
		system_peripheral_reset(PERIPHERAL_SPI0_CORE);
		system_peripheral_reset(PERIPHERAL_SPI0_IF);
	} else if (spi_module == (void *)SPI1) {
		system_peripheral_reset(PERIPHERAL_SPI1_CORE);
		system_peripheral_reset(PERIPHERAL_SPI1_IF);
	}
}