summaryrefslogtreecommitdiff
path: root/software
diff options
context:
space:
mode:
Diffstat (limited to 'software')
-rw-r--r--software/hhd70dongle/c1101lib.c16
-rw-r--r--software/hhd70dongle/c1101lib.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/software/hhd70dongle/c1101lib.c b/software/hhd70dongle/c1101lib.c
index 7958309..d2d0265 100644
--- a/software/hhd70dongle/c1101lib.c
+++ b/software/hhd70dongle/c1101lib.c
@@ -62,7 +62,20 @@ int16_t spi_c1101_write_byte_ok_get_status(char data)
return sb;
}
-#define spi_c1101_strobe_command spi_c1101_write_byte_ok_get_status
+int16_t spi_c1101_strobe_command(char address)
+{
+ char rbyte;
+ if (address < 0x30)
+ return -1;
+ spi_cs_enable();
+ spi_c1101_wait_chip_rdy();
+ //POST DEBUG: don't return anything
+ rbyte = spi_c1101_write_byte_ok_get_status(address);
+ if (rbyte < 0)
+ return -1;
+ spi_cs_disable();
+ return rbyte;
+}
// note addresses range from 0x00 to 0x2F for normal registers and 0xF0 to 0xFD for special status registers
int16_t spi_c1101_read_register(char address)
@@ -76,7 +89,6 @@ int16_t spi_c1101_read_register(char address)
spi_c1101_wait_chip_rdy();
if (spi_c1101_write_byte_ok_get_status(address) < 0)
return -1;
- _delay_ms(10); //FIXME: propably don't need this
rbyte = spi_read_byte();
spi_cs_disable();
return rbyte;
diff --git a/software/hhd70dongle/c1101lib.h b/software/hhd70dongle/c1101lib.h
index db97b70..a8045a0 100644
--- a/software/hhd70dongle/c1101lib.h
+++ b/software/hhd70dongle/c1101lib.h
@@ -132,6 +132,7 @@
int16_t spi_c1101_read_register(char address);
int16_t spi_c1101_write_register(char address, char byte);
+int16_t spi_c1101_strobe_command(char address);
void c1101_init(void);
char c1101_getVersion(void);