diff --git a/DMRTX.cpp b/DMRTX.cpp index e6238dd..69fa3eb 100644 --- a/DMRTX.cpp +++ b/DMRTX.cpp @@ -27,6 +27,7 @@ #define USE8 // #define USE6 // #define USE4 +// #define USE2 #if defined(USE8) // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB @@ -45,8 +46,12 @@ const uint16_t DMR_C4FSK_FILTER_LEN = 32U; static q15_t DMR_C4FSK_FILTER[] = {688, -680, -2158, -3060, -2724, -775, 2684, 7041, 11310, 14425, 15565, 14425, 11310, 7041, 2684, -775, -2724, -3060, -2158, -680, 688, 0}; const uint16_t DMR_C4FSK_FILTER_LEN = 22U; +#elif defined(USE2) +// Generated using rcosdesign(0.2, 2, 5, 'sqrt') in MATLAB +static q15_t DMR_C4FSK_FILTER[] = {-792, 2742, 7192, 11553, 14735, 15900, 14735, 11553, 7192, 2742, -792, 0}; +const uint16_t DMR_C4FSK_FILTER_LEN = 12U; #else -#error "Must define one of USE8, USE6, or USE4." +#error "Must define one of USE8, USE6, USE4, or USE2." #endif const q15_t DMR_LEVELA[] = { 640, 640 , 640, 640, 640}; diff --git a/IO.cpp b/IO.cpp index 3540f10..836c04c 100644 --- a/IO.cpp +++ b/IO.cpp @@ -24,11 +24,36 @@ #include "Globals.h" #include "IO.h" +// Uncomment one of the following to change the filter +#define USE8 +// #define USE6 +// #define USE4 +// #define USE2 + +#if defined(USE8) // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB -static q15_t C4FSK_FILTER[] = {401, 104, -340, -731, -847, -553, 112, 909, 1472, 1450, 683, -675, -2144, -3040, -2706, -770, 2667, 6995, +static q15_t 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 C4FSK_FILTER_LEN = 42U; +#elif defined(USE6) +// Generated using rcosdesign(0.2, 6, 5, 'sqrt') in MATLAB +static q15_t C4FSK_FILTER[] = {-554, 112, 911, 1474, 1452, 684, -676, -2147, -3045, -2710, -772, 2671, 7005, + 11253, 14352, 15486, 14352, 11253, 7005, 2671, -772, -2710, -3045, -2147, -676, + 684, 1452, 1474, 911, 112, -554, 0}; +const uint16_t C4FSK_FILTER_LEN = 32U; +#elif defined(USE4) +// Generated using rcosdesign(0.2, 4, 5, 'sqrt') in MATLAB +static q15_t C4FSK_FILTER[] = {688, -680, -2158, -3060, -2724, -775, 2684, 7041, 11310, 14425, 15565, 14425, + 11310, 7041, 2684, -775, -2724, -3060, -2158, -680, 688, 0}; +const uint16_t C4FSK_FILTER_LEN = 22U; +#elif defined(USE2) +// Generated using rcosdesign(0.2, 2, 5, 'sqrt') in MATLAB +static q15_t C4FSK_FILTER[] = {-792, 2742, 7192, 11553, 14735, 15900, 14735, 11553, 7192, 2742, -792, 0}; +const uint16_t C4FSK_FILTER_LEN = 12U; +#else +#error "Must define one of USE8, USE6, USE4, or USE2." +#endif // Generated using gaussfir(0.5, 4, 5) in MATLAB static q15_t GMSK_FILTER[] = {8, 104, 760, 3158, 7421, 9866, 7421, 3158, 760, 104, 8, 0}; diff --git a/YSFTX.cpp b/YSFTX.cpp index 0457b65..df230e6 100644 --- a/YSFTX.cpp +++ b/YSFTX.cpp @@ -24,11 +24,36 @@ #include "YSFDefines.h" +// Uncomment one of the following to change the filter +#define USE8 +// #define USE6 +// #define USE4 +// #define USE2 + +#if defined(USE8) // 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; +#elif defined(USE6) +// Generated using rcosdesign(0.2, 6, 5, 'sqrt') in MATLAB +static q15_t YSF_C4FSK_FILTER[] = {-554, 112, 911, 1474, 1452, 684, -676, -2147, -3045, -2710, -772, 2671, 7005, + 11253, 14352, 15486, 14352, 11253, 7005, 2671, -772, -2710, -3045, -2147, -676, + 684, 1452, 1474, 911, 112, -554, 0}; +const uint16_t YSF_C4FSK_FILTER_LEN = 32U; +#elif defined(USE4) +// Generated using rcosdesign(0.2, 4, 5, 'sqrt') in MATLAB +static q15_t YSF_C4FSK_FILTER[] = {688, -680, -2158, -3060, -2724, -775, 2684, 7041, 11310, 14425, 15565, 14425, + 11310, 7041, 2684, -775, -2724, -3060, -2158, -680, 688, 0}; +const uint16_t YSF_C4FSK_FILTER_LEN = 22U; +#elif defined(USE2) +// Generated using rcosdesign(0.2, 2, 5, 'sqrt') in MATLAB +static q15_t YSF_C4FSK_FILTER[] = {-792, 2742, 7192, 11553, 14735, 15900, 14735, 11553, 7192, 2742, -792, 0}; +const uint16_t YSF_C4FSK_FILTER_LEN = 12U; +#else +#error "Must define one of USE8, USE6, USE4, or USE2." +#endif const q15_t YSF_LEVELA[] = { 809, 809, 809, 809, 809}; const q15_t YSF_LEVELB[] = { 269, 269, 269, 269, 269};