CODE SPI Interrupt handler

Table 1. CODE SPI Code example
Interrupt handler
void Spi_IRQHandler() {
	uint16_t data;
	uint32_t intstat = LPC_SPI->INTSTAT;
	if(intstat & SPI_STAT_TXRDY) {
		if(tx_state == 0) {
			LPC_SPI->TXDATCTL = SPI_TXDATCTL_FLEN(15) | SPI_TXDATCTL_SSEL_N(0xe)| 0xdddd;
			tx_state++;
		}
		if(tx_state == 1) {
			LPC_SPI->TXDATCTL = SPI_TXDATCTL_FLEN(7) | SPI_TXDATCTL_SSEL_N(0xe) |0xdd;
			LPC_SPI->INTENCLR = SPI_STAT_TXRDY;
		}
	}
	if(intstat & SPI_STAT_RXRDY) {
		if(rx_state == 0) {
			data = LPC_SPI->RXDAT;
			if(data != 0xdddd) abort();
			rx_state++;
		}
		if(rx_state == 1) {
			data = LPC_SPI->RXDAT;
			if(data != 0xdd) abort();
			LPC_SPI->INTENCLR = SPI_STAT_RXRDY;
		}
	}
}

-->