diff --git a/Config.h b/Config.h index 148fea1..16ed653 100644 --- a/Config.h +++ b/Config.h @@ -38,7 +38,7 @@ // #define ARDUINO_DUE_PAPA // For the new Arduino Due pin layout -#define ARDUINO_DUE_ZUM +#define ARDUINO_DUE_ZUM_V10 // For the SP8NTH board // #define ARDUINO_DUE_NTH diff --git a/DMRTX.cpp b/DMRTX.cpp index e73d6d6..43a14ad 100644 --- a/DMRTX.cpp +++ b/DMRTX.cpp @@ -23,11 +23,20 @@ #include "Globals.h" #include "DMRSlotType.h" +#if defined(ARDUINO_DUE_ZUM_V10) || defined(ARDUINO_DUE_NTH) +// Generated using rcosdesign(0.2, 6, 5, 'sqrt') plus a custom filter in MATLAB +static q15_t DMR_C4FSK_FILTER[] = {1, 2, 1, -5, -17, -28, -17, 37, 121, 175, 105, -137, -475, -690, -518, 166, 1197, 2114, 2346, 1516, -309, + -2550, -4280, -4565, -2827, 885, 5849, 10850, 14549, 15911, 14549, 10850, 5849, 885, -2827, -4565, -4280. + -2550, -309, 1516, 2346, 2114, 1197, 166, -518, -690, -475, -137, 105, 175, 121, 37, -17, -28, -17, -5, 1, + 2, 1, 0}; +const uint16_t DMR_C4FSK_FILTER_LEN = 60U; +#else // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB static q15_t DMR_C4FSK_FILTER[] = {401, 104, -340, -731, -847, -553, 112, 909, 1472, 1450, 683, -675, -2144, -3040, -2706, -770, 2667, 6995, 11237, 14331, 15464, 14331, 11237, 6995, 2667, -770, -2706, -3040, -2144, -675, 683, 1450, 1472, 909, 112, -553, -847, -731, -340, 104, 401, 0}; const uint16_t DMR_C4FSK_FILTER_LEN = 42U; +#endif const q15_t DMR_LEVEL3 = 640; const q15_t DMR_LEVEL1 = 213; diff --git a/IO.cpp b/IO.cpp index 9803040..3540f10 100644 --- a/IO.cpp +++ b/IO.cpp @@ -47,7 +47,7 @@ const uint16_t DC_OFFSET = 2048U; #define ADC_CDR_Chan 7 #define DACC_MR_USER_SEL_Chan DACC_MR_USER_SEL_CHANNEL0 // DAC on Due DAC0 #define DACC_CHER_Chan DACC_CHER_CH0 -#elif defined(ARDUINO_DUE_ZUM) +#elif defined(ARDUINO_DUE_ZUM_V10) #define PIN_COS 52 #define PIN_PTT 23 #define PIN_COSLED 22 @@ -72,7 +72,7 @@ const uint16_t DC_OFFSET = 2048U; #define DACC_MR_USER_SEL_Chan DACC_MR_USER_SEL_CHANNEL0 // DAC on Due DAC0 #define DACC_CHER_Chan DACC_CHER_CH0 #else -#error "Either ARDUINO_DUE_PAPA, ARDUINO_DUE_ZUM, or ARDUINO_DUE_NTH need to be defined" +#error "Either ARDUINO_DUE_PAPA, ARDUINO_DUE_ZUM_V10, or ARDUINO_DUE_NTH need to be defined" #endif #elif defined(__MBED__) // A generic MBED platform diff --git a/YSFTX.cpp b/YSFTX.cpp index f2652dc..7e0465d 100644 --- a/YSFTX.cpp +++ b/YSFTX.cpp @@ -24,18 +24,27 @@ #include "YSFDefines.h" +#if defined(ARDUINO_DUE_ZUM_V10) || defined(ARDUINO_DUE_NTH) +// Generated using rcosdesign(0.2, 6, 5, 'sqrt') plus a custom filter in MATLAB +static q15_t YSF_C4FSK_FILTER[] = {1, 2, 1, -5, -17, -28, -17, 37, 121, 175, 105, -137, -475, -690, -518, 166, 1197, 2114, 2346, 1516, -309, + -2550, -4280, -4565, -2827, 885, 5849, 10850, 14549, 15911, 14549, 10850, 5849, 885, -2827, -4565, -4280. + -2550, -309, 1516, 2346, 2114, 1197, 166, -518, -690, -475, -137, 105, 175, 121, 37, -17, -28, -17, -5, 1, + 2, 1, 0}; +const uint16_t YSF_C4FSK_FILTER_LEN = 60U; +#else // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB static q15_t YSF_C4FSK_FILTER[] = {401, 104, -340, -731, -847, -553, 112, 909, 1472, 1450, 683, -675, -2144, -3040, -2706, -770, 2667, 6995, 11237, 14331, 15464, 14331, 11237, 6995, 2667, -770, -2706, -3040, -2144, -675, 683, 1450, 1472, 909, 112, -553, -847, -731, -340, 104, 401, 0}; const uint16_t YSF_C4FSK_FILTER_LEN = 42U; - -const uint8_t YSF_START_SYNC = 0x77U; -const uint8_t YSF_END_SYNC = 0xFFU; +#endif const q15_t YSF_LEVEL3 = 809; const q15_t YSF_LEVEL1 = 269; +const uint8_t YSF_START_SYNC = 0x77U; +const uint8_t YSF_END_SYNC = 0xFFU; + CYSFTX::CYSFTX() : m_buffer(1500U), m_levelA(), diff --git a/mmdvmmenu.sh b/mmdvmmenu.sh index 9434669..aa56151 100755 --- a/mmdvmmenu.sh +++ b/mmdvmmenu.sh @@ -66,8 +66,8 @@ do (3) Enable 19.2 MHz Clock (4) Use the COS to lockout the modem (5) Use pins to output the current mode - (6) Use original Arduino Due layout - (7) Use new Arduino Due layout + (6) Use layout for the PAPA board + (7) Use layout for ZUM board V1.0 (8) Use layout for SP8NTH board (9) Return to Default @@ -81,8 +81,8 @@ EOF "3") sed -e 's/\/\/ #define EXTERNAL_OSC 19200000/#define EXTERNAL_OSC 19200000/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "19.2 MHz clock enabled";; "4") sed -e 's/\/\/ #define USE_COS_AS_LOCKOUT /#define USE_COS_AS_LOCKOUT/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "COS as Lockout enabled";; "5") sed -e 's/\/\/ #define ARDUINO_MODE_PINS/#define ARDUINO_MODE_PINS/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Mode pins Enabled";; - "6") sed -e 's/\/\/ #define ARDUINO_DUE_PAPA/#define ARDUINO_DUE_PAPA/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Original Arduino Due layout enabled";; - "7") sed -e 's/\/\/ #define ARDUINO_DUE_ZUM/#define ARDUINO_DUE_ZUM/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "New Arduino Due layout enabled";; + "6") sed -e 's/\/\/ #define ARDUINO_DUE_PAPA/#define ARDUINO_DUE_PAPA/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for the PAPA board enabled";; + "7") sed -e 's/\/\/ #define ARDUINO_DUE_ZUM_V10/#define ARDUINO_DUE_ZUM_V10/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for ZUM board V1.0 enabled";; "8") sed -e 's/\/\/ #define ARDUINO_DUE_NTH/#define ARDUINO_DUE_NTH/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for SP8NTH board enabled";; "9") mv -f $confbak $conf ;; "Q") echo "If any changes are made you need to (re-)upload the firmware to MMDVM" && exit;;