/* Aborts an ongoing job. 
This function will abort the specified job type. */
void spi_abort_job(struct spi_module *const module)
/* Aborts an ongoing job. 
This function will abort the specified job type. */
void spi_abort_job(struct spi_module *const module)
{
	SercomSpi *const spi_hw
		= &(module->hw->SPI);
	spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_RX_COMPLETE |
			SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY |
			SPI_INTERRUPT_FLAG_TX_COMPLETE;
	module->status = STATUS_ABORTED;
	module->remaining_rx_buffer_length = 0;
	module->remaining_dummy_buffer_length = 0;
	module->remaining_tx_buffer_length = 0;
	module->dir = SPI_DIRECTION_IDLE;
}