summaryrefslogtreecommitdiff
path: root/software/hhd70dongle/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'software/hhd70dongle/spi.c')
-rw-r--r--software/hhd70dongle/spi.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/software/hhd70dongle/spi.c b/software/hhd70dongle/spi.c
index a2d9c55..39d3cd8 100644
--- a/software/hhd70dongle/spi.c
+++ b/software/hhd70dongle/spi.c
@@ -68,10 +68,19 @@ void spi_cs_disable(void)
SPI_PORT |= (1<<CS);
}
+#include "usb_rawhid.h"
+#include "util.h"
+
void spi_c1101_wait_chip_rdy(void)
{
//c1101 will set MISO to low if ready
- for (unsigned int c=0; c < 0xFFFFFF && (SPI_PINB_REG & (1<<MISO)); c++);
+ while (SPI_PINB_REG & (1<<MISO));
+ //~ unsigned int c;
+ //~ for (c=0; c < 0xFFFFFFFF && (SPI_PINB_REG & (1<<MISO)); c++);
+ //~ uint8_t debug_buff[6];
+ //~ usb_rawhid_send((uint8_t*)"spi waited for:",255);
+ //~ debug_sprint_int16hex(debug_buff, c);
+ //~ usb_rawhid_send(debug_buff,255);
}
void spi_write_byte(char byte)
@@ -89,5 +98,5 @@ char spi_exchange_byte(char byte)
char spi_read_byte(void)
{
//transmit something so SCLK runs for 8 bits, so that slave can transfer 1 byte
- return spi_exchange_byte(0xFF);
+ return spi_exchange_byte(0);
} \ No newline at end of file