diff options
author | Mike Beattie <mike@ethernal.org> | 2013-03-10 19:07:01 +1300 |
---|---|---|
committer | Mike Beattie <mike@ethernal.org> | 2013-03-10 19:07:01 +1300 |
commit | d029acad6a992be9b7b4498e70605f8a1e1a4ef6 (patch) | |
tree | 851283be0bcb5915bd54e2c19073531336080bd5 /src/avr | |
parent | eba7b2ef8ef23bdb61b0390e47be6f27ffde31dc (diff) | |
parent | 72c5b1429bdfd6e9d2185bad7d0adb281fdf659a (diff) |
Merge branch 'master' into altosdroid
Diffstat (limited to 'src/avr')
-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; |