diff options
| author | drowe67 <[email protected]> | 2024-04-03 18:00:35 +1030 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2024-04-03 18:00:35 +1030 |
| commit | cf069d2e62bd1e69efaddcfa60ca37374ed025b5 (patch) | |
| tree | 5c2c72ea85aa3f402842717147fec0e0cc72fb1b /src/freedv_data_raw_tx.c | |
| parent | 735d7882764134f6982586683a42ed79f5e95951 (diff) | |
demo custom mode
Diffstat (limited to 'src/freedv_data_raw_tx.c')
| -rw-r--r-- | src/freedv_data_raw_tx.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/freedv_data_raw_tx.c b/src/freedv_data_raw_tx.c index cb74107..ce5da56 100644 --- a/src/freedv_data_raw_tx.c +++ b/src/freedv_data_raw_tx.c @@ -238,6 +238,8 @@ int main(int argc, char *argv[]) { mode = FREEDV_MODE_DATAC13; if (!strcmp(argv[dx], "DATAC14") || !strcmp(argv[dx], "datac14")) mode = FREEDV_MODE_DATAC14; + if (!strcmp(argv[dx], "CUSTOM") || !strcmp(argv[dx], "custom")) + mode = FREEDV_MODE_DATA_CUSTOM; if (mode == -1) { fprintf(stderr, "Error: in mode: %s", argv[dx]); exit(1); @@ -259,10 +261,28 @@ int main(int argc, char *argv[]) { exit(1); } - if (mode != FREEDV_MODE_FSK_LDPC) - freedv = freedv_open(mode); - else + if (mode == FREEDV_MODE_FSK_LDPC) + freedv = freedv_open_advanced(mode, &adv); + else if (mode == FREEDV_MODE_DATA_CUSTOM) { + // demonstrate custom OFDM raw data modes + struct OFDM_CONFIG ofdm_config; + ofdm_init_mode("datac14", &ofdm_config); + // modify datac14 to have 3 carriers instead of 4, which means + // we have to tweak Np, and the number of unique word bits + ofdm_config.nc = 3; + ofdm_config.np = 6; + ofdm_config.nuwbits = 48; + ofdm_config.bad_uw_errors = 18; + uint8_t uw[] = {1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}; + memcpy(ofdm_config.tx_uw, uw, sizeof(uw)); + memcpy(&ofdm_config.tx_uw[ofdm_config.nuwbits - sizeof(uw)], uw, + sizeof(uw)); + adv.config = (void *)&ofdm_config; freedv = freedv_open_advanced(mode, &adv); + } else { + freedv = freedv_open(mode); + } assert(freedv != NULL); |
