summaryrefslogtreecommitdiff
path: root/software/rda1846dongle/rda1846dongle.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2013-03-06 04:08:12 +0000
committerChristian Pointner <equinox@mur.at>2013-03-06 04:08:12 +0000
commita1a6c7034362d5c4935b729a12aa2a90f22827e7 (patch)
treeffff207bad80af72fb7cd75fad78ff453d0d32b8 /software/rda1846dongle/rda1846dongle.c
parentrda1846dongle: api contains now most needed functions (diff)
rda1846dongle: fixed dtmf freq2val converters
some more debug commands git-svn-id: https://svn.spreadspace.org/mur.sat@696 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/rda1846dongle/rda1846dongle.c')
-rw-r--r--software/rda1846dongle/rda1846dongle.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/software/rda1846dongle/rda1846dongle.c b/software/rda1846dongle/rda1846dongle.c
index 8a011b7..9e0c1b6 100644
--- a/software/rda1846dongle/rda1846dongle.c
+++ b/software/rda1846dongle/rda1846dongle.c
@@ -40,6 +40,7 @@
#include "usbio.h"
#include "rda1846.h"
+#include "rda1846_defines.h"
#define DEFAULT_FREQ 145900
int32_t current_freq_kHz = DEFAULT_FREQ;
@@ -48,9 +49,9 @@ static int32_t print_actual_freq(void)
{
int32_t f = rda1846_get_freq_kHz();
if(f < 0)
- printf("actual frequency: NaN MHz");
+ printf("actual frequency: NaN MHz\r\n");
else
- printf("actual frequency: %d.%03d MHz", (uint16_t)(f / 1000), (uint16_t)(f % 1000));
+ printf("actual frequency: %d.%03d MHz\r\n", (uint16_t)(f / 1000), (uint16_t)(f % 1000));
return f;
}
@@ -68,17 +69,52 @@ static void update_current_freq(void)
current_freq_kHz = DEFAULT_FREQ;
}
+static void print_status(void)
+{
+ int16_t rssi = rda1846_get_rssi();
+ if(rssi < 0)
+ printf("rssi: NaN dB\r\n");
+ else
+ printf("rssi: %d.%03d dB\r\n", (uint16_t)(rssi / 8), (uint16_t)((rssi % 8)*125));
+
+ int16_t vssi = rda1846_get_vssi();
+ if(vssi < 0)
+ printf("vssi: NaN mV\r\n");
+ else
+ printf("vssi: %d mV\r\n", vssi);
+
+ uint16_t flags = rda1846_get_flags();
+ if(vssi < 0)
+ printf("flags: ERROR\r\n");
+ else
+ printf("flags: %04X\r\n", flags);
+
+ print_actual_freq();
+}
+
+static void print_dtmf(void)
+{
+ uint8_t idx1, idx2, code;
+ if(rda1846_get_dtmf(&idx1, &idx2, &code))
+ printf("DTMF: ERROR\r\n");
+ else
+ printf("DTMF: tone1=%d, tone2=%d, code=0x%02X\r\n", idx1, idx2, code);
+}
+
+
static void handle_cmd(uint8_t cmd)
{
switch(cmd) {
- case '0': led_off(); printf("ok\r\n"); break;
- case '1': led_on(); printf("ok\r\n"); break;
- case 't': led_toggle(); printf("ok\r\n"); break;
+ case '0': led_off(); printf("led OFF\r\n"); break;
+ case '1': led_on(); printf("led ON\r\n"); break;
+ case 't': led_toggle(); printf("led TOGGLE\r\n"); break;
case '!': reset2bootloader(); break;
case 'f': print_actual_freq(); break;
+ case 's': print_status(); break;
+ case 'd': print_dtmf(); break;
case '+': current_freq_kHz+=500; update_current_freq(); break;
case '-': current_freq_kHz-=500; update_current_freq(); break;
- default: printf("ERROR: unknown command\r\n"); return;
+ default: printf("\r\n"); return;
}
}