fixed bug in spi_write_ready & changed from uint8 to uint16 in write and read functions