diff options
author | Bernhard Tittelbach <xro@realraum.at> | 2012-05-17 06:14:24 +0000 |
---|---|---|
committer | Bernhard Tittelbach <xro@realraum.at> | 2012-05-17 06:14:24 +0000 |
commit | 9bdf2f92bf95c69d668772e1c289ab89868aa738 (patch) | |
tree | e55a84d87ea7af7de84e5500221be66f83aa3d94 /software/hhd70dongle/spi.c | |
parent | hhd70 spi (diff) |
usb lib
git-svn-id: https://svn.spreadspace.org/mur.sat@415 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/hhd70dongle/spi.c')
-rw-r--r-- | software/hhd70dongle/spi.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/software/hhd70dongle/spi.c b/software/hhd70dongle/spi.c index 618c581..ab5d5b2 100644 --- a/software/hhd70dongle/spi.c +++ b/software/hhd70dongle/spi.c @@ -69,25 +69,23 @@ void spi_write(char* data, unsigned int len) //enable SS of CC1101 PORTB |= (1<<CS); - for (unsigned int c=0; c++; c<len) - spi_write_byte(data[c]) + for (unsigned int c=0; c<len; c++) + spi_write_byte(data[c]); //disable SS of CC1101 PORTB &= ~(1<<CS); } -void spi_read(unsigned int maxlen, char* data) +void spi_read(unsigned int maxlen, char *data, unsigned int *len) { PORTB |= (1<<CS); while(SPI_PINB_REG & (1<<MISO)); /* wait for CC1101 to get ready... */ SPDR = 0x80; - unsigned int len = 0; - while(len < maxlen && !(SPSR & (1<<SPIF))) - { - data[len++]=SPSR - } + len = 0; + while(*len < maxlen && !(SPSR & (1<<SPIF))) + data[*len++]=SPSR; PORTB &= ~(1<<CS); } |