diff options
Diffstat (limited to 'src/libfsk/fsk.h')
-rw-r--r-- | src/libfsk/fsk.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/libfsk/fsk.h b/src/libfsk/fsk.h index a7cc428..395e915 100644 --- a/src/libfsk/fsk.h +++ b/src/libfsk/fsk.h @@ -1,14 +1,12 @@ #include "../libfm/fm.h" -typedef struct ffsk { +typedef struct fsk_mod { void *inst; int (*send_bit)(void *inst); - void (*receive_bit)(void *inst, int bit, double quality, double level); - fm_demod_t demod; double bits_per_sample; /* fraction of a bit per sample */ double *sin_tab; /* sine table with correct peak level */ double phaseshift65536[2]; /* how much the phase of fsk synbol changes per sample */ - double cycles_per_bit65536[2]; /* cacles of one bit */ + double cycles_per_bit65536[2]; /* cycles of one bit */ double tx_phase65536; /* current transmit phase */ double level; /* level (amplitude) of signal */ int coherent; /* set, if coherent TX mode */ @@ -16,15 +14,27 @@ typedef struct ffsk { double f1_deviation; int low_bit, high_bit; /* a low or high deviation means which bit? */ int tx_bit; /* current transmitting bit (-1 if not set) */ - int rx_bit; /* current receiving bit (-1 if not yet measured) */ double tx_bitpos; /* current transmit position in bit */ +} fsk_mod_t; + +typedef struct fsk_demod { + void *inst; + void (*receive_bit)(void *inst, int bit, double quality, double level); + fm_demod_t demod; + double bits_per_sample; /* fraction of a bit per sample */ + double f0_deviation; /* deviation of frequencies, relative to center */ + double f1_deviation; + int low_bit, high_bit; /* a low or high deviation means which bit? */ + int rx_bit; /* current receiving bit (-1 if not yet measured) */ double rx_bitpos; /* current receive position in bit (sampleclock) */ double rx_bitadjust; /* how much does a bit change cause the sample clock to be adjusted in phase */ -} fsk_t; +} fsk_demod_t; -int fsk_init(fsk_t *fsk, void *inst, int (*send_bit)(void *inst), void (*receive_bit)(void *inst, int bit, double quality, double level), int samplerate, double bitrate, double f0, double f1, double level, int coherent, double bitadjust); -void fsk_cleanup(fsk_t *fsk); -void fsk_receive(fsk_t *fsk, sample_t *sample, int length); -int fsk_send(fsk_t *fsk, sample_t *sample, int length, int add); -void fsk_tx_reset(fsk_t *fsk); +int fsk_mod_init(fsk_mod_t *fsk, void *inst, int (*send_bit)(void *inst), int samplerate, double bitrate, double f0, double f1, double level, int coherent); +void fsk_mod_cleanup(fsk_mod_t *fsk); +int fsk_mod_send(fsk_mod_t *fsk, sample_t *sample, int length, int add); +void fsk_mod_tx_reset(fsk_mod_t *fsk); +int fsk_demod_init(fsk_demod_t *fsk, void *inst, void (*receive_bit)(void *inst, int bit, double quality, double level), int samplerate, double bitrate, double f0, double f1, double bitadjust); +void fsk_demod_cleanup(fsk_demod_t *fsk); +void fsk_demod_receive(fsk_demod_t *fsk, sample_t *sample, int length); |