/* Receive a sequence of bytes from a SPI device. 
All bytes sent out on SPI bus are sent as value 0. */
status_code_t spi_read_packet(SPI_t *spi, uint8_t *data, size_t len)
/* Receive a sequence of bytes from a SPI device. 
All bytes sent out on SPI bus are sent as value 0. */
status_code_t spi_read_packet(SPI_t *spi, uint8_t *data, size_t len)
{
	while (len--) {
		spi_write_single(spi,CONFIG_SPI_MASTER_DUMMY);
		while (!spi_is_rx_full(spi)) {
		}
		spi_read_single(spi, data);
		data++;
	}
	return STATUS_OK;
}