summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2015-02-17 16:19:46 +0100
committerChristian Pointner <equinox@mur.at>2015-02-17 16:19:46 +0100
commitf4dfdae2650d9774de7267595732087330e6e3c5 (patch)
treebd826a4be63f6fb415a58233dba2b702e98f0b1d
parenthhd70: reading state works now (diff)
hhd70: added commands SXOFF and SCAL
-rw-r--r--software/avr.lib/cc1101.c15
-rw-r--r--software/avr.lib/cc1101.h3
-rw-r--r--software/hhd70dongle/hhd70dongle.c8
3 files changed, 26 insertions, 0 deletions
diff --git a/software/avr.lib/cc1101.c b/software/avr.lib/cc1101.c
index e846551..fc8b16a 100644
--- a/software/avr.lib/cc1101.c
+++ b/software/avr.lib/cc1101.c
@@ -123,6 +123,21 @@ void cc1101_idle(void)
cc1101_spi_strobe_command(CC1101_CMD_SIDLE);
}
+void cc1101_osc_off(void)
+{
+ cc1101_spi_strobe_command(CC1101_CMD_SXOFF);
+}
+
+void cc1101_calibrate(void)
+{
+ cc1101_spi_strobe_command(CC1101_CMD_SCAL);
+}
+
+void cc1101_rx(void)
+{
+ cc1101_spi_strobe_command(CC1101_CMD_SRX);
+}
+
char* cc1101_state_to_string(cc1101_state_t state)
{
switch(state) {
diff --git a/software/avr.lib/cc1101.h b/software/avr.lib/cc1101.h
index 6f2ec4c..8884b6a 100644
--- a/software/avr.lib/cc1101.h
+++ b/software/avr.lib/cc1101.h
@@ -45,6 +45,9 @@ void cc1101_soft_reset(void);
void cc1101_powerdown(void);
void cc1101_idle(void);
+void cc1101_osc_off(void);
+void cc1101_calibrate(void);
+void cc1101_rx(void);
cc1101_state_t cc1101_get_state(void);
void cc1101_set_freq_hz(uint32_t hz);
diff --git a/software/hhd70dongle/hhd70dongle.c b/software/hhd70dongle/hhd70dongle.c
index 35d2d38..0827a4a 100644
--- a/software/hhd70dongle/hhd70dongle.c
+++ b/software/hhd70dongle/hhd70dongle.c
@@ -65,6 +65,12 @@ static void powerdown_hhd70(void)
cc1101_powerdown();
}
+static void osc_off_hhd70(void)
+{
+ printf("disabling CC1101 oscillator.\r\n");
+ cc1101_osc_off();
+}
+
static uint32_t print_actual_freq(void)
{
uint32_t f = cc1101_get_freq_hz();
@@ -117,6 +123,8 @@ static void handle_cmd(uint8_t cmd)
case 'P': powerdown_hhd70(); break;
case 'I': cc1101_idle(); print_status(); break;
+ case 'O': osc_off_hhd70(); break;
+ case 'C': cc1101_calibrate(); print_status(); break;
case 'f': print_actual_freq(); break;
case 's': print_status(); break;