diff options
author | Keith Packard <keithp@keithp.com> | 2013-02-24 00:20:54 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-02-24 00:20:54 -0800 |
commit | 2120d362cefceba69e75996b6391d9558978c01d (patch) | |
tree | 6382a7e3ac47779e13ffea66601290fad2182536 /src/avr/ao_spi_slave.c | |
parent | 5246acb70b79980de36bd5d0ba0d017529ae9a78 (diff) | |
parent | a04c4f7b07e97d568f8f6f56dd363329817fb52c (diff) |
Merge branch 'telescience-v0.2'
Diffstat (limited to 'src/avr/ao_spi_slave.c')
-rw-r--r-- | src/avr/ao_spi_slave.c | 10 |
1 files changed, 6 insertions, 4 deletions
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; |