summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2015-02-18 01:19:57 (GMT)
committerChristian Pointner <equinox@mur.at>2015-02-18 01:19:57 (GMT)
commit941cfda830119552926cbe7665ed1df2e269c2e3 (patch)
tree8fcc62c9916f0515d1a9a53a4005946ab84aa036
parente8191d71ade086dc3f5d119a3c03098f620373a7 (diff)
added status reads
-rw-r--r--software/avr.lib/cc1101.c43
-rw-r--r--software/avr.lib/cc1101.h8
2 files changed, 51 insertions, 0 deletions
diff --git a/software/avr.lib/cc1101.c b/software/avr.lib/cc1101.c
index 1c00e83..5c9f2f8 100644
--- a/software/avr.lib/cc1101.c
+++ b/software/avr.lib/cc1101.c
@@ -227,11 +227,54 @@ uint32_t cc1101_get_freq_hz(void)
return (uint32_t)((float)freq * drv.freq_corr);
}
+uint8_t cc1101_get_partnum(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RO_PARTNUM);
+}
+
+uint8_t cc1101_get_chip_version(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RO_VERSION);
+}
+
+uint8_t cc1101_get_freq_offset_est(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RO_FREQUEST);
+}
+
+uint8_t cc1101_get_lqi(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RO_LQI);
+}
+
int8_t cc1101_get_rssi(void)
{
return (int8_t)cc1101_spi_read_register(CC1101_REG_RO_RSSI);
}
+uint16_t cc1101_get_wortime(void)
+{
+ uint16_t w = cc1101_spi_read_register(CC1101_REG_RO_WORTIME1);
+ w = w << 8;
+ w |= cc1101_spi_read_register(CC1101_REG_RO_WORTIME0);
+ return w;
+}
+
+uint8_t cc1101_get_pkt_status(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RO_PKTSTATUS);
+}
+
+uint8_t cc1101_get_tx_bytes(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RO_TXBYTES);
+}
+
+uint8_t cc1101_get_rx_bytes(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RO_RXBYTES);
+}
+
static char* cc1101_config_reg_to_string(uint8_t addr)
{
switch(addr) {
diff --git a/software/avr.lib/cc1101.h b/software/avr.lib/cc1101.h
index 83c99bf..ffb886e 100644
--- a/software/avr.lib/cc1101.h
+++ b/software/avr.lib/cc1101.h
@@ -55,7 +55,15 @@ cc1101_state_t cc1101_get_state(void);
void cc1101_set_freq_hz(uint32_t hz);
uint32_t cc1101_get_freq_hz(void);
+uint8_t cc1101_get_partnum(void);
+uint8_t cc1101_get_chip_version(void);
+uint8_t cc1101_get_freq_offset_est(void);
+uint8_t cc1101_get_lqi(void);
int8_t cc1101_get_rssi(void);
+uint16_t cc1101_get_wortime(void);
+uint8_t cc1101_get_pkt_status(void);
+uint8_t cc1101_get_tx_bytes(void);
+uint8_t cc1101_get_rx_bytes(void);
void cc1101_dump_register(void);