/* Receive a sequence of bytes from a USART in SPI mode device. 
All bytes sent out on usart bus are sent as value 0. */
uint32_t usart_spi_read_packet(Usart *p_usart, uint8_t *data, size_t len)
/* Receive a sequence of bytes from a USART in SPI mode device. 
All bytes sent out on usart bus are sent as value 0. */
uint32_t usart_spi_read_packet(Usart *p_usart, uint8_t *data, size_t len)
{
	uint32_t val;
	uint32_t i = 0;
	while(len) {
		usart_putchar(p_usart, CONFIG_USART_SPI_DUMMY);
		usart_getchar(p_usart, &val);
		data[i] = (uint8_t)(val & 0xFF);
		i++;
		len--;
	}
	return 0;
}