Fixed the problem of reads from the SPI where the first byte was sometimes lost.The SPI read function now only generates an idle symbol if there is not a byte

already in the reception buffer.
This commit is contained in:
nvt-se 2009-11-06 14:02:59 +00:00
parent 91a4322d2b
commit f59e89cfb9

View file

@ -84,7 +84,9 @@ sd_arch_spi_write_block(uint8_t *bytes, int amount)
unsigned
sd_arch_spi_read(void)
{
UART_TX = SPI_IDLE;
UART_WAIT_RX();
if((U1IFG & URXIFG1) == 0) {
UART_TX = SPI_IDLE;
UART_WAIT_RX();
}
return UART_RX;
}