summaryrefslogtreecommitdiff
path: root/software/rda1846dongle/rda1846dongle.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2013-03-26 01:43:44 +0000
committerChristian Pointner <equinox@mur.at>2013-03-26 01:43:44 +0000
commitce708a0d35cbdba5f5af94cc1af89a21724043b7 (patch)
tree0c160e3e2bc3be7649f45b700a8507a903e02e4f /software/rda1846dongle/rda1846dongle.c
parentadded support for 1.5m Band (diff)
improved volume settings
git-svn-id: https://svn.spreadspace.org/mur.sat@711 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/rda1846dongle/rda1846dongle.c')
-rw-r--r--software/rda1846dongle/rda1846dongle.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/software/rda1846dongle/rda1846dongle.c b/software/rda1846dongle/rda1846dongle.c
index e058c9d..e0297a7 100644
--- a/software/rda1846dongle/rda1846dongle.c
+++ b/software/rda1846dongle/rda1846dongle.c
@@ -48,6 +48,7 @@
#define DEFAULT_FREQ_70CM 435000
int32_t default_freq = DEFAULT_FREQ_2M;
int32_t current_freq_kHz = DEFAULT_FREQ_2M;
+int8_t current_volume = 0;
static void reset_rda(void)
{
@@ -150,7 +151,15 @@ static void print_status(void)
else
printf("flags: %04X\r\n", flags);
+ int8_t vol = rda1846_get_volume();
+ if(vol > 0)
+ printf("volume: NaN dB\r\n");
+ else
+ printf("volume: %d dB\r\n", vol);
+
+ printf("rf band: %s\r\n", rda1846_rf_band_to_string(rda1846_get_band()));
print_actual_freq();
+ printf("bandwidth: %s\r\n", rda1846_channel_bw_to_string(rda1846_get_bw()));
}
static void print_dtmf(void)
@@ -164,6 +173,23 @@ static void print_dtmf(void)
rda1846_clear_int();
}
+static void update_vol(void)
+{
+ printf("setting volume to %d dB\r\n", current_volume);
+ rda1846_set_volume(current_volume);
+}
+
+static void inc_vol(void)
+{
+ current_volume = (current_volume >= 0) ? 0 : current_volume + 1;
+ update_vol();
+}
+
+static void dec_vol(void)
+{
+ current_volume = (current_volume <= -30) ? -30 : current_volume - 1;
+ update_vol();
+}
static void handle_cmd(uint8_t cmd)
{
@@ -195,6 +221,9 @@ static void handle_cmd(uint8_t cmd)
case 'R': rda1846_receive(); print_status(); break;
case 'T': rda1846_transmit(); print_status(); break;
+ case 'v': dec_vol(); break;
+ case 'V': inc_vol(); break;
+
case 'g': rda1846_gpio_off(); printf("GPIO off\r\n"); break;
case 'G': rda1846_gpio_default(); printf("GPIO to defaults\r\n"); break;
case '5': rda1846_gpio_55(); break;