summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2015-02-13 13:40:24 (GMT)
committerChristian Pointner <equinox@mur.at>2015-02-13 13:40:24 (GMT)
commit93311f744f54b165e56b7f0fbae8c8389ae8b5c8 (patch)
tree0c979bc6d33d843de60e7f39896994901afb13bb
parent619f27643e902bf7bfe079fe498c8cf237a57fc1 (diff)
rda1846: make rda quartz frequency setable by project makefile
-rw-r--r--software/rda1846dongle/Makefile3
-rw-r--r--software/rda1846dongle/rda1846.c2
-rw-r--r--software/rda1846dongle/rda1846_defines.h24
3 files changed, 15 insertions, 14 deletions
diff --git a/software/rda1846dongle/Makefile b/software/rda1846dongle/Makefile
index b3e2b32..6929699 100644
--- a/software/rda1846dongle/Makefile
+++ b/software/rda1846dongle/Makefile
@@ -53,3 +53,6 @@ LUFA_OPTS += -D USB_PRODUCT="L\"RDA1846 usb dongle\"" -D USB_PRODUCT_LEN=18
LUFA_COMPONENTS := USB USBCLASS TWI
include ../avr.include.mk
+
+CFLAGS += -D RDA_QUARTZ_12M288
+#CFLAGS += -D RDA_QUARTZ_13M
diff --git a/software/rda1846dongle/rda1846.c b/software/rda1846dongle/rda1846.c
index e845642..eac7091 100644
--- a/software/rda1846dongle/rda1846.c
+++ b/software/rda1846dongle/rda1846.c
@@ -34,8 +34,6 @@
#include <stdio.h>
#include "rda1846.h"
-#define QUARTZ_12M288
-//#define QUARTZ_13M
#include "rda1846_defines.h"
static uint8_t rda1846_write_register_raw(const uint8_t addr, const uint16_t data)
diff --git a/software/rda1846dongle/rda1846_defines.h b/software/rda1846dongle/rda1846_defines.h
index a318ede..968475e 100644
--- a/software/rda1846dongle/rda1846_defines.h
+++ b/software/rda1846dongle/rda1846_defines.h
@@ -76,12 +76,12 @@
#define RDA1846_REG_DTMF_OUT 0x6C
//freq
-#ifdef QUARTZ_12M288
+#ifdef RDA_QUARTZ_12M288
#define RDA1846_FREQ_CORR_2M 73.1428567759
-#endif // QUARTZ_12M288
-#ifdef QUARTZ_13M
+#endif // RDA_QUARTZ_12M288
+#ifdef RDA_QUARTZ_13M
#define RDA1846_FREQ_CORR_2M 69.136878448
-#endif // QUARTZ_13M
+#endif // RDA_QUARTZ_13M
#define RDA1846_FREQ_CORR_1M5 RDA1846_FREQ_CORR_2M/1.5
#define RDA1846_FREQ_CORR_70CM RDA1846_FREQ_CORR_2M/3.0
@@ -100,17 +100,17 @@
#define RDA1846_BAND_70CM_LOW 400000 // kHz
#define RDA1846_BAND_70CM_HIGH 520000 // kHZ
-#ifdef QUARTZ_12M288
+#ifdef RDA_QUARTZ_12M288
#define RDA1846_XTAL_FREQ 12288 // 12.288 MHz
#define RDA1846_ADCLK_FREQ 6144 // 12.288/2 MHz
#define RDA1846_CLK_MODE 0x0F11 // 12-14 MHz
-#endif // QUARTZ_12M288
+#endif // RDA_QUARTZ_12M288
-#ifdef QUARTZ_13M
+#ifdef RDA_QUARTZ_13M
#define RDA1846_XTAL_FREQ 13000 // 13.000 MHz
#define RDA1846_ADCLK_FREQ 6500 // 13.000/2 MHz
#define RDA1846_CLK_MODE 0x0F11 // 12-14 MHz
-#endif // QUARTZ_13M
+#endif // RDA_QUARTZ_13M
@@ -221,7 +221,7 @@
#define dtmf_tone_freq_hz(value) (uint16_t)round(value/4.096)
#define dtmf_tone_freq_value(hz) (uint16_t)round(hz*4.096)
-#ifdef QUARTZ_12M288
+#ifdef RDA_QUARTZ_12M288
// DTMF frequencies @ 12.288 MHz - these are the defaults... are they?
#define RDA1846_DTMF_C0 0x61 // 697 Hz
#define RDA1846_DTMF_C1 0x5B // 770 Hz
@@ -231,9 +231,9 @@
#define RDA1846_DTMF_C5 0x1E // 1336 Hz
#define RDA1846_DTMF_C6 0x0A // 1477 Hz
#define RDA1846_DTMF_C7 0xF6 // 1633 Hz
-#endif // QUARTZ_12M8
+#endif // RDA_QUARTZ_12M8
-#ifdef QUARTZ_13M
+#ifdef RDA_QUARTZ_13M
// DTMF frequencies @ 13 MHz - these are the defaults...
#define RDA1846_DTMF_C0 0x61 // 697 Hz
#define RDA1846_DTMF_C1 0x5E // 770 Hz
@@ -243,6 +243,6 @@
#define RDA1846_DTMF_C5 0x1E // 1336 Hz
#define RDA1846_DTMF_C6 0x0F // 1477 Hz
#define RDA1846_DTMF_C7 0xFB // 1633 Hz
-#endif // QUARTZ_13M
+#endif // RDA_QUARTZ_13M
#endif