diff options
author | Christian Pointner <equinox@mur.at> | 2013-03-20 04:23:41 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2013-03-20 04:23:41 +0000 |
commit | 705eeda6201d182585317bd0edb84b541e449d6e (patch) | |
tree | 455e933488f51fa88e979d3831e9bbd76df4754d /software/rda1846dongle/rda1846dongle.c | |
parent | fixed usb footprint (easier drills) (diff) |
parts of rda1846dongle working
git-svn-id: https://svn.spreadspace.org/mur.sat@702 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/rda1846dongle/rda1846dongle.c')
-rw-r--r-- | software/rda1846dongle/rda1846dongle.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/software/rda1846dongle/rda1846dongle.c b/software/rda1846dongle/rda1846dongle.c index 4c78168..ebb97de 100644 --- a/software/rda1846dongle/rda1846dongle.c +++ b/software/rda1846dongle/rda1846dongle.c @@ -43,8 +43,20 @@ #include "rda1846_defines.h" #define DEFAULT_FREQ 145900 +//#define DEFAULT_FREQ 409750 int32_t current_freq_kHz = DEFAULT_FREQ; +static void set_default_freq(void) +{ + printf("setting frequency to %d.%03d MHz .. ", (uint16_t)(current_freq_kHz / 1000), + (uint16_t)(current_freq_kHz % 1000)); + current_freq_kHz = DEFAULT_FREQ; + if(rda1846_set_freq_kHz(current_freq_kHz)) + printf("error\r\n"); + else + printf("ok\r\n"); +} + static int32_t print_actual_freq(void) { int32_t f = rda1846_get_freq_kHz(); @@ -59,14 +71,18 @@ static void update_current_freq(void) { printf("setting frequency to %d.%03d MHz .. ", (uint16_t)(current_freq_kHz / 1000), (uint16_t)(current_freq_kHz % 1000)); + rda1846_powerdown(); + if(rda1846_set_freq_kHz(current_freq_kHz)) printf("error\r\n"); else printf("ok\r\n"); - current_freq_kHz = print_actual_freq(); - if(current_freq_kHz < 0) - current_freq_kHz = DEFAULT_FREQ; + rda1846_wakeup(); + + /* current_freq_kHz = print_actual_freq(); */ + /* if(current_freq_kHz < 0) */ + /* current_freq_kHz = DEFAULT_FREQ; */ } static void print_status(void) @@ -110,9 +126,18 @@ static void handle_cmd(uint8_t cmd) case 't': led_toggle(); printf("led TOGGLE\r\n"); break; case '!': reset2bootloader(); break; case 'r': rda1846_soft_reset(); printf("soft resetting RDA1846.\r\n"); break; + case 'i': rda1846_init(); printf("initializing RDA1846.\r\n"); break; + case 'F': set_default_freq(); break; case 'f': print_actual_freq(); break; case 's': print_status(); break; case 'd': print_dtmf(); break; + case 'D': rda1846_dump_register(); break; + case 'p': rda1846_powerdown(); break; + case 'P': rda1846_wakeup(); break; + + case 'R': rda1846_receive(); break; + case 'T': rda1846_transmit(); break; + case '+': current_freq_kHz+=25; update_current_freq(); break; case '-': current_freq_kHz-=25; update_current_freq(); break; default: printf("\r\n"); return; @@ -129,9 +154,6 @@ int main(void) usbio_init(); sei(); - rda1846_init(); - rda1846_set_freq_kHz(current_freq_kHz); - for(;;) { int16_t BytesReceived = usbio_bytes_received(); while(BytesReceived > 0) { |