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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user