Refactored SPI-IRQ write.
Refactore SPI read and write functions to use IRQ.