diff options
Diffstat (limited to 'software/hhd70dongle/c1101lib.c')
-rw-r--r-- | software/hhd70dongle/c1101lib.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/software/hhd70dongle/c1101lib.c b/software/hhd70dongle/c1101lib.c index 57ee7eb..2376e91 100644 --- a/software/hhd70dongle/c1101lib.c +++ b/software/hhd70dongle/c1101lib.c @@ -43,18 +43,22 @@ int16_t spi_c1101_write_byte_ok_get_status(char data) { - uint8_t debug_sb[6]; + //~ uint8_t debug_sb[6]; char sb; unsigned int attempts = 0; do { sb = spi_exchange_byte(data); - usb_rawhid_send((uint8_t*)"spi byte exchanged ",255); - debug_sprint_int16hex(debug_sb, sb); - usb_rawhid_send(debug_sb,255); + //Note: content of returned StatusByte is actually context depenedant on sent command + // i.e. we won't get Fifo Byte count or overflow status on normal command and so on + // e.g. we only get TX Fifo Free Byte count while writing to TX Fifo + // thus it makes sense to only check for CHIP_RDY here + //~ usb_rawhid_send((uint8_t*)"spi byte exchanged ",255); + //~ debug_sprint_int16hex(debug_sb, sb); + //~ usb_rawhid_send(debug_sb,255); if (attempts++ > SPIC1101_MAX_WAIT) return -1; - } while ( SPIC1101_SB_CHIPRDY(sb) == 0 ); + } while ( SPIC1101_SB_CHIP_NOT_RDY(sb) ); return sb; } @@ -72,15 +76,6 @@ int16_t spi_c1101_read_register(char address) return -1; _delay_ms(10); //FIXME: propably don't need this rbyte = spi_read_byte(); - uint8_t debug_sb[6]; - debug_sprint_int16hex(debug_sb, rbyte); - usb_rawhid_send(debug_sb,255); - rbyte = spi_read_byte(); - debug_sprint_int16hex(debug_sb, rbyte); - usb_rawhid_send(debug_sb,255); - rbyte = spi_read_byte(); - debug_sprint_int16hex(debug_sb, rbyte); - usb_rawhid_send(debug_sb,255); spi_cs_disable(); return rbyte; } |