Begin porting GMSK modulator

This commit is contained in:
Ed Gonzalez 2015-06-02 14:28:42 -05:00
parent 4095503a38
commit fc8de37bd6
2 changed files with 51 additions and 2 deletions

View file

@ -27,8 +27,9 @@
/* Demod Section */
#include "DStarDefines.h"
#include "gmsk_modem.h"
#include "common.h"
const float FILTER_COEFFS_TABLE[] = {
const float DEMOD_COEFFS_TABLE[] = {
/* 2400 Hz */
-0.000153959924563F, 0.000000000000000F, 0.000167227768379F, 0.000341615513437F,
0.000513334449696F, 0.000667493753523F, 0.000783901543032F, 0.000838293462576F,
@ -57,7 +58,7 @@ const float FILTER_COEFFS_TABLE[] = {
0.000783901543032F, 0.000667493753523F, 0.000513334449696F, 0.000341615513437F,
0.000167227768379F, 0.000000000000000F, -0.000153959924563F};
#define FILTER_COEFFS_LENGTH 103U
#define DEMOD_COEFFS_LENGTH 103U
#define PLLMAX 0x10000U
#define PLLINC ( PLLMAX / DSTAR_RADIO_BIT_LENGTH)
@ -107,4 +108,47 @@ void gmskDemod_reset(GMSK_DEMOD demod )
/* Mod Section */
// Generated by
// gaussfir(0.5, 2, 10)
const float MOD_COEFFS_TABLE[] = {
6.455906007234699e-014F, 1.037067381285011e-012F, 1.444835156335346e-011F,
1.745786683011439e-010F, 1.829471305298363e-009F, 1.662729407135958e-008F,
1.310626978701910e-007F, 8.959797186410516e-007F, 5.312253663302771e-006F,
2.731624380156465e-005F, 1.218217140199093e-004F, 4.711833994209542e-004F,
1.580581180127418e-003F, 4.598383433830095e-003F, 1.160259430889949e-002F,
2.539022692626253e-002F, 4.818807833062393e-002F, 7.931844341164322e-002F,
1.132322945270602e-001F, 1.401935338024111e-001F, 1.505383695578516e-001F,
1.401935338024111e-001F, 1.132322945270601e-001F, 7.931844341164328e-002F,
4.818807833062393e-002F, 2.539022692626253e-002F, 1.160259430889949e-002F,
4.598383433830090e-003F, 1.580581180127420e-003F, 4.711833994209542e-004F,
1.218217140199093e-004F, 2.731624380156465e-005F, 5.312253663302753e-006F,
8.959797186410563e-007F, 1.310626978701910e-007F, 1.662729407135958e-008F,
1.829471305298363e-009F, 1.745786683011426e-010F, 1.444835156335356e-011F,
1.037067381285011e-012F, 6.455906007234699e-014F};
#define MOD_COEFFS_LENGTH 41U
uint32 gmsk_encode(GMSK_MOD mod, BOOL bit, float * buffer, unsigned int length)
{
if ( length == DSTAR_RADIO_BIT_LENGTH ) {
output(ANSI_RED "Length!= DSTAR_RADIO_BIT_LENGTH" ANSI_WHITE);
}
if (mod->m_invert)
bit = !bit;
uint32 i = 0;
for (i = 0; i < DSTAR_RADIO_BIT_LENGTH; i++) {
if (bit) {
buffer[i] = 0;//m_filter.process(-0.5F);
} else {
buffer[i] = 0;//m_filter.process(0.5F);
}
}
return DSTAR_RADIO_BIT_LENGTH;
}
/* Init */

View file

@ -46,4 +46,9 @@ typedef struct _gmsk_mod
BOOL m_invert;
} gmsk_mod, * GMSK_MOD;
uint32 gmsk_encode(GMSK_MOD mod, BOOL bit, float * buffer, unsigned int length);
enum DEMOD_STATE gmsk_decode(GMSK_DEMOD demod, float val);
void gmskDemod_reset(GMSK_DEMOD demod );
#endif /* THUMBDV_GMSK_MODEM_H_ */