diff options
author | Bernhard Tittelbach <xro@realraum.at> | 2012-05-17 06:14:34 +0000 |
---|---|---|
committer | Bernhard Tittelbach <xro@realraum.at> | 2012-05-17 06:14:34 +0000 |
commit | 195ea8d1af2745228c8d4a5c893ae0c8e27ba96c (patch) | |
tree | 2d1db8aba809dd155462413d4edde4fb565dbbf4 /software/hhd70dongle/spi.c | |
parent | make SPI work by correcting register typo ;-) (diff) |
fix CHP_RDY check, waiting and so on
git-svn-id: https://svn.spreadspace.org/mur.sat@421 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/hhd70dongle/spi.c')
-rw-r--r-- | software/hhd70dongle/spi.c | 13 |
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 |