Update avr ao_spi_slave code to match API changes
authorKeith Packard <keithp@keithp.com>
Sun, 13 Jan 2013 18:31:59 +0000 (10:31 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 13 Jan 2013 18:32:52 +0000 (10:32 -0800)
Made the interface use void * for pointers and uint16_t for lengths

Signed-off-by: Keith Packard <keithp@keithp.com>
src/avr/ao_spi_slave.c
src/core/ao.h

index a400b8a0a929f0485b8d8da894f43c17ec098f79..15e9924da5d6f20c4b1b454a3393d3fea9d23c31 100644 (file)
 #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;
index df5bbf487e2469702421b27a25d7ac9378351d03..ce0bf5d14289007dff1b602e750cdc7b23dec7f4 100644 (file)
@@ -299,10 +299,10 @@ ao_altitude_to_pa(alt_t alt);
  */
 
 uint8_t
-ao_spi_slave_recv(uint8_t *buf, uint8_t len);
+ao_spi_slave_recv(void *buf, uint16_t len);
 
 void
-ao_spi_slave_send(uint8_t *buf, uint8_t len);
+ao_spi_slave_send(void *buf, uint16_t len);
 
 void
 ao_spi_slave_init(void);