2010-03-01 12:56:30 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
2007-06-22 22:04:50 +00:00
|
|
|
// feld.h -- FELDHELL modem
|
|
|
|
//
|
2010-03-01 12:56:30 +00:00
|
|
|
// Copyright (C) 2006-2010
|
2007-06-22 22:04:50 +00:00
|
|
|
// Dave Freese, W1HKJ
|
|
|
|
//
|
2010-03-01 12:56:30 +00:00
|
|
|
// This file is part of fldigi. Adapted from code contained in gmfsk source code
|
2007-06-22 22:04:50 +00:00
|
|
|
// distribution.
|
|
|
|
// gmfsk Copyright (C) 2001, 2002, 2003
|
|
|
|
// Tomi Manninen (oh2bns@sral.fi)
|
|
|
|
// Copyright (C) 2004
|
|
|
|
// Lawrence Glaister (ve7it@shaw.ca)
|
|
|
|
//
|
2010-03-01 12:56:30 +00:00
|
|
|
// Fldigi is free software: you can redistribute it and/or modify
|
2007-06-22 22:04:50 +00:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
2010-03-01 12:56:30 +00:00
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
2007-06-22 22:04:50 +00:00
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
2010-03-01 12:56:30 +00:00
|
|
|
// Fldigi is distributed in the hope that it will be useful,
|
2007-06-22 22:04:50 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2010-03-01 12:56:30 +00:00
|
|
|
// along with fldigi. If not, see <http://www.gnu.org/licenses/>.
|
2007-06-22 22:04:50 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _FELD_H
|
|
|
|
#define _FELD_H
|
|
|
|
|
|
|
|
#include "modem.h"
|
|
|
|
#include "filters.h"
|
|
|
|
#include "fftfilt.h"
|
2007-10-06 15:04:10 +00:00
|
|
|
#include "mbuffer.h"
|
2007-06-22 22:04:50 +00:00
|
|
|
|
|
|
|
#define FeldSampleRate 8000
|
|
|
|
#define FeldMaxSymLen 1024
|
|
|
|
|
2008-02-25 16:39:29 +00:00
|
|
|
#define MAXLEN 512
|
2007-06-22 22:04:50 +00:00
|
|
|
|
2015-11-19 11:31:01 +00:00
|
|
|
#define FELD_RX_COLUMN_LEN 20
|
|
|
|
|
2007-06-22 22:04:50 +00:00
|
|
|
class feld : public modem {
|
|
|
|
enum FELD_STATE {PREAMBLE, POSTAMBLE, DATA};
|
2015-11-19 11:31:01 +00:00
|
|
|
public:
|
|
|
|
static int RxColumnLen;
|
|
|
|
static int TxColumnLen;
|
2007-06-22 22:04:50 +00:00
|
|
|
protected:
|
|
|
|
//rx
|
|
|
|
double rxphacc;
|
2009-02-14 19:46:51 +00:00
|
|
|
double rxdelta;
|
2007-06-22 22:04:50 +00:00
|
|
|
double rxcounter;
|
|
|
|
double agc;
|
2010-01-18 15:30:22 +00:00
|
|
|
double peakval;
|
2007-06-22 22:04:50 +00:00
|
|
|
double peakhold;
|
|
|
|
double minhold;
|
2015-11-19 11:31:01 +00:00
|
|
|
|
2008-02-22 18:30:58 +00:00
|
|
|
double rxpixrate;
|
|
|
|
double txpixrate;
|
|
|
|
double downsampleinc;
|
|
|
|
double upsampleinc;
|
2008-02-27 02:58:09 +00:00
|
|
|
double phi2freq;
|
2007-06-22 22:04:50 +00:00
|
|
|
|
|
|
|
C_FIR_filter *hilbert;
|
|
|
|
fftfilt *bpfilt;
|
|
|
|
Cmovavg *bbfilt;
|
|
|
|
Cmovavg *minmaxfilt;
|
2010-01-18 15:30:22 +00:00
|
|
|
Cmovavg *average;
|
2007-06-22 22:04:50 +00:00
|
|
|
//tx
|
|
|
|
FELD_STATE tx_state;
|
|
|
|
double txphacc;
|
|
|
|
double txcounter;
|
|
|
|
double hell_bandwidth;
|
2008-05-15 23:53:57 +00:00
|
|
|
double filter_bandwidth;
|
2007-06-22 22:04:50 +00:00
|
|
|
|
|
|
|
int depth;
|
|
|
|
int dxmode;
|
|
|
|
int halfwidth;
|
|
|
|
bool blackboard;
|
|
|
|
bool hardkeying;
|
2008-02-22 18:30:58 +00:00
|
|
|
double feldcolumnrate;
|
2007-06-22 22:04:50 +00:00
|
|
|
|
|
|
|
int preamble;
|
|
|
|
int postamble;
|
|
|
|
int prevsymb;
|
2013-10-19 12:43:21 +00:00
|
|
|
cmplx prev;
|
2007-06-22 22:04:50 +00:00
|
|
|
|
2008-02-25 16:39:29 +00:00
|
|
|
double OnShape[MAXLEN];
|
|
|
|
double OffShape[MAXLEN];
|
2007-06-22 22:04:50 +00:00
|
|
|
|
2015-11-19 11:31:01 +00:00
|
|
|
mbuffer<int, 2*FELD_RX_COLUMN_LEN> col_data;
|
2007-06-22 22:04:50 +00:00
|
|
|
int col_pointer;
|
|
|
|
int fntnbr;
|
|
|
|
|
2013-10-19 12:43:21 +00:00
|
|
|
cmplx mixer(cmplx);
|
2007-06-22 22:04:50 +00:00
|
|
|
double nco(double);
|
2013-10-19 12:43:21 +00:00
|
|
|
void rx(cmplx);
|
|
|
|
void FSKHELL_rx(cmplx);
|
2007-06-22 22:04:50 +00:00
|
|
|
void send_symbol(int currsymbol, int nextsymbol);
|
|
|
|
void send_null_column();
|
|
|
|
void tx_char(char);
|
|
|
|
void initKeyWaveform();
|
|
|
|
public:
|
|
|
|
feld(trx_mode);
|
|
|
|
~feld();
|
|
|
|
void init();
|
|
|
|
void rx_init();
|
2008-02-15 19:36:53 +00:00
|
|
|
void tx_init(SoundBase *sc);
|
2008-05-11 00:01:16 +00:00
|
|
|
void restart();
|
2007-09-19 00:45:42 +00:00
|
|
|
int rx_process(const double *buf, int len);
|
2007-06-22 22:04:50 +00:00
|
|
|
int tx_process();
|
|
|
|
int get_font_data(unsigned char c, int col);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|