X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Favr%2Fao_spi_slave.c;h=15e9924da5d6f20c4b1b454a3393d3fea9d23c31;hb=bc3610d8cecbfed40c62d4dcb93fc9a4d2a7c9e3;hp=a400b8a0a929f0485b8d8da894f43c17ec098f79;hpb=5a55501660ebab3b858a48483c5df1cfb4e858e4;p=fw%2Faltos diff --git a/src/avr/ao_spi_slave.c b/src/avr/ao_spi_slave.c index a400b8a0..15e9924d 100644 --- a/src/avr/ao_spi_slave.c +++ b/src/avr/ao_spi_slave.c @@ -18,22 +18,24 @@ #include "ao.h" uint8_t -ao_spi_slave_recv(uint8_t *buf, uint8_t len) +ao_spi_slave_recv(void *buf, uint16_t len) { + uint8_t *b = buf; while (len--) { while (!(SPSR & (1 << SPIF))) if ((PINB & (1 << PINB0))) return 0; - *buf++ = SPDR; + *b++ = SPDR; } return 1; } void -ao_spi_slave_send(uint8_t *buf, uint8_t len) +ao_spi_slave_send(void *buf, uint16_t len) { + uint8_t *b = buf; while (len--) { - SPDR = *buf++; + SPDR = *b++; while (!(SPSR & (1 << SPIF))) if ((PINB & (1 << PINB0))) return;