aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/fsk.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/fsk.h')
-rw-r--r--src/common/fsk.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/common/fsk.h b/src/common/fsk.h
new file mode 100644
index 0000000..1a1009a
--- /dev/null
+++ b/src/common/fsk.h
@@ -0,0 +1,31 @@
+#include "../common/fm_modulation.h"
+
+typedef struct ffsk {
+ void *inst;
+ int (*send_bit)(void *inst);
+ void (*receive_bit)(void *inst, int bit, double quality, double level);
+ fm_demod_t demod;
+ iir_filter_t tx_filter;
+ 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 tx_phase65536; /* current transmit phase */
+ double level; /* level (amplitude) of signal */
+ int coherent; /* set, if coherent TX mode */
+ 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 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 */
+ 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;
+
+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);
+