aboutsummaryrefslogtreecommitdiff
path: root/src/ofdm.c
diff options
context:
space:
mode:
authordrowe67 <[email protected]>2024-05-03 10:10:49 +0930
committerDavid Rowe <[email protected]>2024-05-03 10:10:49 +0930
commitcfa9cd02e44652cdf625cbed729bd15905045523 (patch)
tree275e55006c3e005915885cdb56324830e46aaf47 /src/ofdm.c
parentd026cfede7053c7f38bfed6f5089b403e961a45a (diff)
first pass a config driven Tx BPF set up
Diffstat (limited to 'src/ofdm.c')
-rw-r--r--src/ofdm.c51
1 files changed, 21 insertions, 30 deletions
diff --git a/src/ofdm.c b/src/ofdm.c
index ba22f3f..8d7a6df 100644
--- a/src/ofdm.c
+++ b/src/ofdm.c
@@ -192,6 +192,8 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) {
ofdm->codename = "HRA_112_112";
ofdm->amp_est_mode = 0;
ofdm->tx_bpf_en = true;
+ ofdm->tx_bpf_proto = filtP650S900;
+ ofdm->tx_bpf_proto_n = sizeof(filtP650S900) / sizeof(float);
ofdm->rx_bpf_en = false;
ofdm->amp_scale = 245E3;
ofdm->clip_gain1 = 2.0;
@@ -226,6 +228,8 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) {
ofdm->codename = config->codename;
ofdm->amp_est_mode = config->amp_est_mode;
ofdm->tx_bpf_en = config->tx_bpf_en;
+ ofdm->tx_bpf_proto = config->tx_bpf_proto;
+ ofdm->tx_bpf_proto_n = config->tx_bpf_proto_n;
ofdm->rx_bpf_en = config->rx_bpf_en;
ofdm->foff_limiter = config->foff_limiter;
ofdm->amp_scale = config->amp_scale;
@@ -275,6 +279,8 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) {
ofdm->config.codename = ofdm->codename;
ofdm->config.amp_est_mode = ofdm->amp_est_mode;
ofdm->config.tx_bpf_en = ofdm->tx_bpf_en;
+ ofdm->config.tx_bpf_proto = ofdm->tx_bpf_proto;
+ ofdm->config.tx_bpf_proto_n = ofdm->tx_bpf_proto_n;
ofdm->config.rx_bpf_en = ofdm->rx_bpf_en;
ofdm->config.foff_limiter = ofdm->foff_limiter;
ofdm->config.amp_scale = ofdm->amp_scale;
@@ -539,36 +545,19 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) {
static void allocate_tx_bpf(struct OFDM *ofdm) {
ofdm->tx_bpf = MALLOC(sizeof(struct quisk_cfFilter));
assert(ofdm->tx_bpf != NULL);
+ assert(ofdm->tx_bpf_proto != NULL);
+ assert(ofdm->tx_bpf_proto_n != 0);
- /* Transmit bandpass filter; complex coefficients, center frequency */
-
- if (!strcmp(ofdm->mode, "700D")) {
- quisk_filt_cfInit(ofdm->tx_bpf, filtP650S900,
- sizeof(filtP650S900) / sizeof(float));
- quisk_cfTune(ofdm->tx_bpf, ofdm->tx_centre / ofdm->fs);
- } else if (!strcmp(ofdm->mode, "700E") || !strcmp(ofdm->mode, "2020") ||
- !strcmp(ofdm->mode, "datac1")) {
- quisk_filt_cfInit(ofdm->tx_bpf, filtP900S1100,
- sizeof(filtP900S1100) / sizeof(float));
- quisk_cfTune(ofdm->tx_bpf, ofdm->tx_centre / ofdm->fs);
- } else if (!strcmp(ofdm->mode, "2020B")) {
- quisk_filt_cfInit(ofdm->tx_bpf, filtP1100S1300,
- sizeof(filtP1100S1300) / sizeof(float));
- quisk_cfTune(ofdm->tx_bpf, ofdm->tx_centre / ofdm->fs);
- } else if (!strcmp(ofdm->mode, "datac0") || !strcmp(ofdm->mode, "datac3")) {
- quisk_filt_cfInit(ofdm->tx_bpf, filtP400S600,
- sizeof(filtP400S600) / sizeof(float));
- quisk_cfTune(ofdm->tx_bpf, ofdm->tx_centre / ofdm->fs);
- } else if (!strcmp(ofdm->mode, "datac4") || !strcmp(ofdm->mode, "datac13") ||
- !strcmp(ofdm->mode, "datac14")) {
- quisk_filt_cfInit(ofdm->tx_bpf, filtP200S400,
- sizeof(filtP200S400) / sizeof(float));
- // centre the filter on the mean carrier freq, allows a narrower filter to
- // be used
- float tx_centre = find_carrier_centre(ofdm);
- quisk_cfTune(ofdm->tx_bpf, tx_centre / ofdm->fs);
- } else
- assert(0);
+ quisk_filt_cfInit(ofdm->tx_bpf, ofdm->tx_bpf_proto, ofdm->tx_bpf_proto_n);
+ float tx_centre = ofdm->tx_centre;
+ if (!strcmp(ofdm->mode, "datac4") || !strcmp(ofdm->mode, "datac13") ||
+ !strcmp(ofdm->mode, "datac14")) {
+ // Centre the filter on the mean carrier freq, allows a narrower
+ // filter to be used. Only really useful for very narrow, Nc odd
+ // waveforms. TODO: make this feature config controlled
+ tx_centre = find_carrier_centre(ofdm);
+ }
+ quisk_cfTune(ofdm->tx_bpf, tx_centre / ofdm->fs);
}
static void deallocate_tx_bpf(struct OFDM *ofdm) {
@@ -589,7 +578,9 @@ static void allocate_rx_bpf(struct OFDM *ofdm) {
ofdm->rx_bpf = MALLOC(sizeof(struct quisk_cfFilter));
assert(ofdm->rx_bpf != NULL);
- /* Receive bandpass filter; complex coefficients, center frequency */
+ /* Receive bandpass filter; complex coefficients, center frequency, only
+ really needed for very low SNR waveforms. TODO: make this config
+ controlled. */
if (!strcmp(ofdm->mode, "datac4") || !strcmp(ofdm->mode, "datac13") ||
!strcmp(ofdm->mode, "datac14")) {