summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2015-02-17 14:21:58 +0100
committerChristian Pointner <equinox@mur.at>2015-02-17 14:21:58 +0100
commita40b7dcbd420f8c02ec3e6be341001c57a9610d7 (patch)
treeb4af9a5d5f3f4fd0d8efa04ae518c9439fc08a21
parenthhd70: getting/setting frequency (diff)
hhd70: added idle command
-rw-r--r--software/avr.lib/cc1101.c7
-rw-r--r--software/avr.lib/cc1101.h2
-rw-r--r--software/hhd70dongle/hhd70dongle.c1
3 files changed, 10 insertions, 0 deletions
diff --git a/software/avr.lib/cc1101.c b/software/avr.lib/cc1101.c
index 9053417..833adff 100644
--- a/software/avr.lib/cc1101.c
+++ b/software/avr.lib/cc1101.c
@@ -99,6 +99,7 @@ static void cc1101_spi_write_register(uint8_t addr, uint8_t data)
void cc1101_init(cc1101_driver_conf_t conf)
{
drv = conf;
+ cc1101_soft_reset();
}
void cc1101_reg_init(void)
@@ -111,11 +112,17 @@ void cc1101_soft_reset(void)
cc1101_spi_strobe_command(CC1101_CMD_SRES);
}
+
void cc1101_powerdown(void)
{
cc1101_spi_strobe_command(CC1101_CMD_SPWD);
}
+void cc1101_idle(void)
+{
+ cc1101_spi_strobe_command(CC1101_CMD_SIDLE);
+}
+
void cc1101_set_freq_hz(uint32_t hz)
{
uint32_t freq = (uint32_t)((float)hz / drv.freq_corr);
diff --git a/software/avr.lib/cc1101.h b/software/avr.lib/cc1101.h
index 2ac92bb..6e9e657 100644
--- a/software/avr.lib/cc1101.h
+++ b/software/avr.lib/cc1101.h
@@ -38,7 +38,9 @@ typedef struct {
void cc1101_init(cc1101_driver_conf_t conf);
void cc1101_reg_init(void);
void cc1101_soft_reset(void);
+
void cc1101_powerdown(void);
+void cc1101_idle(void);
void cc1101_set_freq_hz(uint32_t hz);
uint32_t cc1101_get_freq_hz(void);
diff --git a/software/hhd70dongle/hhd70dongle.c b/software/hhd70dongle/hhd70dongle.c
index 2c239b4..482be70 100644
--- a/software/hhd70dongle/hhd70dongle.c
+++ b/software/hhd70dongle/hhd70dongle.c
@@ -111,6 +111,7 @@ static void handle_cmd(uint8_t cmd)
case '_': current_freq_hz-=100000; update_current_freq(); break;
case 'P': cc1101_powerdown(); print_status(); break;
+ case 'I': cc1101_idle(); print_status(); break;
case 'f': print_actual_freq(); break;
case 's': print_status(); break;