aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/fm_modulation.h
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-02-09 19:24:09 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-02-18 21:02:51 +0100
commit290b365d679384fdc864f442b1a03245faea1b39 (patch)
tree921697bb5dd951c01b86d1fee20721665594bd8c /src/common/fm_modulation.h
parent4c0f8e7e953232f1242b23d0cb9516948d9c187b (diff)
SDR: Move FM modulation algorithms to a seperate file
Diffstat (limited to 'src/common/fm_modulation.h')
-rw-r--r--src/common/fm_modulation.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/common/fm_modulation.h b/src/common/fm_modulation.h
new file mode 100644
index 0000000..194ae3f
--- /dev/null
+++ b/src/common/fm_modulation.h
@@ -0,0 +1,24 @@
+
+typedef struct fm_mod {
+ double samplerate; /* sample rate of in and out */
+ double offset; /* offset to calculated center frequency */
+ double amplitude; /* how much amplitude to add to the buff */
+ double phase; /* current phase of FM (used to shift and modulate ) */
+ double *sin_tab; /* sine/cosine table for modulation */
+} fm_mod_t;
+
+void fm_mod_init(fm_mod_t *mod, double samplerate, double offset, double amplitude);
+void fm_modulate(fm_mod_t *mod, sample_t *samples, int num, float *buff);
+
+typedef struct fm_demod {
+ double samplerate; /* sample rate of in and out */
+ double phase; /* current rotation phase (used to shift) */
+ double rot; /* rotation step per sample to shift rx frequency (used to shift) */
+ double last_phase; /* last phase of FM (used to demodulate) */
+ filter_t lp[2]; /* filters received IQ signal */
+ double *sin_tab; /* sine/cosine table rotation */
+} fm_demod_t;
+
+void fm_demod_init(fm_demod_t *demod, double samplerate, double offset, double bandwidth);
+void fm_demodulate(fm_demod_t *demod, sample_t *samples, int num, float *buff);
+