From a40b7dcbd420f8c02ec3e6be341001c57a9610d7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 17 Feb 2015 14:21:58 +0100 Subject: hhd70: added idle command --- software/avr.lib/cc1101.c | 7 +++++++ software/avr.lib/cc1101.h | 2 ++ software/hhd70dongle/hhd70dongle.c | 1 + 3 files changed, 10 insertions(+) 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; -- cgit v1.2.3