1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

atusb/fw/: add SPI block reception

This decreases the retrieval time for a frame of 102 bytes from
660 us to 384 us, corresponding to a speed change from about
1.26 Mbps to 2.17 Mbps (102 bytes plus 2 bytes overhead).
This commit is contained in:
Werner Almesberger
2013-07-30 19:46:55 -03:00
parent d1b65cb058
commit 7fd9044d94
3 changed files with 21 additions and 5 deletions

View File

@@ -47,6 +47,21 @@ void spi_end(void)
}
void spi_recv_block(uint8_t *buf, uint8_t n)
{
if (!n)
return;
UDR1 = 0;
while (--n) {
while (!(UCSR1A & 1 << RXC1));
*buf++ = UDR1;
UDR1 = 0;
}
while (!(UCSR1A & 1 << RXC1));
*buf++ = UDR1;
}
void spi_off(void)
{
spi_initialized = 0;