summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2013-03-25 22:08:14 +0000
committerChristian Pointner <equinox@mur.at>2013-03-25 22:08:14 +0000
commit235165ff0088838705b3f2dada387cca701c6a29 (patch)
treeb9db1464a64354d0d494360aa258b5e616743b74
parentsmall cleanup (diff)
added support for 1.5m Band
alter freqency in 1,10 and 100 kHz steps git-svn-id: https://svn.spreadspace.org/mur.sat@710 7de4ea59-55d0-425e-a1af-a3118ea81d4c
-rw-r--r--software/rda1846dongle/rda1846.c16
-rw-r--r--software/rda1846dongle/rda1846.h2
-rw-r--r--software/rda1846dongle/rda1846_defines.h9
-rw-r--r--software/rda1846dongle/rda1846dongle.c28
4 files changed, 42 insertions, 13 deletions
diff --git a/software/rda1846dongle/rda1846.c b/software/rda1846dongle/rda1846.c
index c7f612c..6607ec8 100644
--- a/software/rda1846dongle/rda1846.c
+++ b/software/rda1846dongle/rda1846.c
@@ -130,6 +130,7 @@ char* rda1846_rf_band_to_string(rf_band_t b)
switch(b)
{
case b_2m: return "2m (134-174 MHz)";
+ case b_1m5: return "1.5m (200-260 MHz)";
case b_70cm: return "70cm (400-520 MHz)";
}
return "";
@@ -198,7 +199,10 @@ void rda1846_soft_reset(void)
void rda1846_set_band(rf_band_t b)
{
- if(!rda1846_write_register(RDA1846_REG_RF_BAND, b == b_2m ? RDA1846_RF_BAND_2M : RDA1846_RF_BAND_70CM))
+ uint16_t data = RDA1846_RF_BAND_2M;
+ if(b == b_1m5) data = RDA1846_RF_BAND_1M5;
+ if(b == b_70cm) data = RDA1846_RF_BAND_70CM;
+ if(!rda1846_write_register(RDA1846_REG_RF_BAND, data))
rf_band_ = b;
}
@@ -226,8 +230,9 @@ channel_bw_t rda1846_get_bw(void)
uint8_t rda1846_set_freq_kHz(int32_t freq)
{
- if(freq < (rf_band_ == b_2m ? RDA1846_BAND_2M_LOW : RDA1846_BAND_70CM_LOW) ||
- freq > (rf_band_ == b_2m ? RDA1846_BAND_2M_HIGH : RDA1846_BAND_70CM_HIGH))
+ if((rf_band_ == b_2m && (freq < RDA1846_BAND_2M_LOW || freq > RDA1846_BAND_2M_HIGH)) ||
+ (rf_band_ == b_1m5 && (freq < RDA1846_BAND_1M5_LOW || freq > RDA1846_BAND_1M5_HIGH)) ||
+ (rf_band_ == b_70cm && (freq < RDA1846_BAND_70CM_LOW || freq > RDA1846_BAND_70CM_HIGH)) )
return 1;
freq = freq<<3;
@@ -240,7 +245,10 @@ uint8_t rda1846_set_freq_kHz(int32_t freq)
static int32_t corr_freq(int32_t f)
{
- return (int32_t)(((float)f)/(rf_band_ == b_2m ? RDA1846_FREQ_CORR_2M : RDA1846_FREQ_CORR_70CM));
+ float corr = RDA1846_FREQ_CORR_2M;
+ if(rf_band_ == b_1m5) corr = RDA1846_FREQ_CORR_1M5;
+ if(rf_band_ == b_70cm) corr = RDA1846_FREQ_CORR_70CM;
+ return (int32_t)(((float)f)/corr);
}
int32_t rda1846_get_freq_kHz(void)
diff --git a/software/rda1846dongle/rda1846.h b/software/rda1846dongle/rda1846.h
index e25a655..fd6ac17 100644
--- a/software/rda1846dongle/rda1846.h
+++ b/software/rda1846dongle/rda1846.h
@@ -33,7 +33,7 @@
#ifndef MURSAT_rda1846_h_INCLUDED
#define MURSAT_rda1846_h_INCLUDED
-typedef enum { b_2m, b_70cm } rf_band_t;
+typedef enum { b_2m, b_1m5, b_70cm } rf_band_t;
char* rda1846_rf_band_to_string(rf_band_t);
typedef enum { bw_12k5, bw_25k } channel_bw_t;
char* rda1846_channel_bw_to_string(channel_bw_t);
diff --git a/software/rda1846dongle/rda1846_defines.h b/software/rda1846dongle/rda1846_defines.h
index 403d326..6b9c29a 100644
--- a/software/rda1846dongle/rda1846_defines.h
+++ b/software/rda1846dongle/rda1846_defines.h
@@ -77,6 +77,7 @@
//freq
#define RDA1846_FREQ_CORR_2M 73.1428567759
+#define RDA1846_FREQ_CORR_1M5 RDA1846_FREQ_CORR_2M/1.5
#define RDA1846_FREQ_CORR_70CM RDA1846_FREQ_CORR_2M/3.0
@@ -85,9 +86,13 @@
#define RDA1846_BAND_2M_LOW 134000 // kHz
#define RDA1846_BAND_2M_HIGH 174000 // kHZ
+#define RDA1846_RF_BAND_1M5 0x00A4 // select 1.5m Band
+#define RDA1846_BAND_1M5_LOW 200000 // kHz
+#define RDA1846_BAND_1M5_HIGH 260000 // kHZ
+
#define RDA1846_RF_BAND_70CM 0x0024 // select 70cm Band
-#define RDA1846_BAND_70CM_LOW 400000 // kHz
-#define RDA1846_BAND_70CM_HIGH 520000 // kHZ
+#define RDA1846_BAND_70CM_LOW 400000 // kHz
+#define RDA1846_BAND_70CM_HIGH 520000 // kHZ
#define RDA1846_XTAL_FREQ 12288 // 12.288 MHz
#define RDA1846_ADCLK_FREQ 6144 // 12.288/2 MHz
diff --git a/software/rda1846dongle/rda1846dongle.c b/software/rda1846dongle/rda1846dongle.c
index 8316d62..e058c9d 100644
--- a/software/rda1846dongle/rda1846dongle.c
+++ b/software/rda1846dongle/rda1846dongle.c
@@ -43,7 +43,8 @@
#include "rda1846.h"
#include "rda1846_defines.h"
-#define DEFAULT_FREQ_2M 145900
+#define DEFAULT_FREQ_2M 145000
+#define DEFAULT_FREQ_1M5 230000
#define DEFAULT_FREQ_70CM 435000
int32_t default_freq = DEFAULT_FREQ_2M;
int32_t current_freq_kHz = DEFAULT_FREQ_2M;
@@ -92,21 +93,30 @@ static void update_current_freq(void)
rda1846_idle();
if(rda1846_set_freq_kHz(current_freq_kHz))
- printf("error\r\n");
+ printf("error .. ");
else
- printf("ok\r\n");
+ printf("ok .. ");
if(old_state == receive)
rda1846_receive();
else if(old_state == transmit)
rda1846_transmit();
+
+ if(current_freq_kHz != rda1846_get_freq_kHz()) {
+ printf("NACK!\r\n");
+ print_actual_freq();
+ } else {
+ printf("ACK\r\n");
+ }
}
static void set_band(rf_band_t b)
{
printf("setting band to %s\r\n", rda1846_rf_band_to_string(b));
rda1846_set_band(b);
- default_freq = b == b_2m ? DEFAULT_FREQ_2M : DEFAULT_FREQ_70CM;
+ if(b == b_2m) default_freq = DEFAULT_FREQ_2M;
+ else if(b == b_1m5) default_freq = DEFAULT_FREQ_1M5;
+ else if(b == b_70cm) default_freq = DEFAULT_FREQ_70CM;
set_default_freq();
}
@@ -167,12 +177,18 @@ static void handle_cmd(uint8_t cmd)
case 'i': reinit_rda(); break;
case '2': set_band(b_2m); break;
+ case '3': set_band(b_1m5); break;
case '7': set_band(b_70cm); break;
case 'b': set_bw(bw_12k5); break;
case 'B': set_bw(bw_25k); break;
case 'F': set_default_freq(); break;
- case '+': current_freq_kHz+=25; update_current_freq(); break;
- case '-': current_freq_kHz-=25; update_current_freq(); break;
+
+ case '#': current_freq_kHz+=100; update_current_freq(); break;
+ case '+': current_freq_kHz+=10; update_current_freq(); break;
+ case ':': current_freq_kHz+=1; update_current_freq(); break;
+ case '.': current_freq_kHz-=1; update_current_freq(); break;
+ case '-': current_freq_kHz-=10; update_current_freq(); break;
+ case '_': current_freq_kHz-=100; update_current_freq(); break;
case 'P': rda1846_powerdown(); print_status(); break;
case 'I': rda1846_idle(); print_status(); break;