diff options
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 e676fbf..85831d1 100644 --- a/software/hhd70dongle/spi.c +++ b/software/hhd70dongle/spi.c @@ -69,26 +69,24 @@ void spi_cs_disable(void) PORTB |= (1<<CS); } -//synchronous void spi_write_byte(char byte) { SPDR = byte; //Load byte to Data register while(!(SPSR & (1<<SPIF))); // Wait for transmission complete } -//~ void spi_write(char* data, unsigned int len) -//~ { - //~ for (unsigned int c=0; c<len; c++) - //~ spi_write_byte(data[c]); -//~ } - -//MSB first char spi_read_byte(void) { while(SPI_PINB_REG & (1<<MISO)); /* wait for CC1101 to get ready... */ return SPSR; } +char spi_exchange_byte(char byte) +{ + spi_write_byte(byte); + return spi_read_byte(); +} + //~ void spi_read(unsigned int maxlen, char *data, unsigned int *len) //~ { //~ PORTB |= (1<<CS); |