fixed SPI_FLUSH. current implementation waits for rx buffer to fill first. Thus, if we call SPI_FLUSH to make sure the rx fifo is empty when the rx fifo is already empty, we enter an infinite loop