diff options
author | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2020-03-05 19:15:28 +0100 |
---|---|---|
committer | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2020-03-05 19:15:28 +0100 |
commit | 4b419bd1ad9f22266e068341176f5ab665a26222 (patch) | |
tree | ec5ee9e379d4de3e15b33f0b640b700bef0750bc /controller/fw/src/dsss_demod.h | |
parent | d9b26d16c063aec32b70287ff861a1f23642a9f2 (diff) | |
download | master-thesis-4b419bd1ad9f22266e068341176f5ab665a26222.tar.gz master-thesis-4b419bd1ad9f22266e068341176f5ab665a26222.tar.bz2 master-thesis-4b419bd1ad9f22266e068341176f5ab665a26222.zip |
Working on DSSS demodulator sim
Diffstat (limited to 'controller/fw/src/dsss_demod.h')
-rw-r--r-- | controller/fw/src/dsss_demod.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/controller/fw/src/dsss_demod.h b/controller/fw/src/dsss_demod.h new file mode 100644 index 0000000..8ab5cac --- /dev/null +++ b/controller/fw/src/dsss_demod.h @@ -0,0 +1,44 @@ +#ifndef __DSSS_DEMOD_H__ +#define __DSSS_DEMOD_H__ + +#define DSSS_GOLD_CODE_LENGTH ((1<<DSSS_GOLD_CODE_NBITS) - 1) +#define DSSS_GOLD_CODE_COUNT ((1<<DSSS_GOLD_CODE_NBITS) + 1) +#define DSSS_CORRELATION_LENGTH (DSSS_GOLD_CODE_LENGTH * DSSS_DECIMATION) + +struct iir_biquad { + float a[2]; + float b[3]; +}; + +struct iir_biquad_state { + float reg[2]; +}; + +struct cwt_iir_filter_state { + struct iir_biquad_state st[3]; +}; + +struct dsss_demod_state { + float signal[DSSS_CORRELATION_LENGTH]; + size_t signal_wpos; + + float correlation[DSSS_GOLD_CODE_COUNT][DSSS_WAVELET_LUT_SIZE]; + size_t correlation_wpos; + + struct cwt_iir_filter_state cwt_filter[DSSS_GOLD_CODE_COUNT]; + + struct { + int len; /* length of group in samples */ + float max; /* signed value of largest peak in group on any channel */ + int max_idx; /* position of above peak counted from start of group */ + int max_ch; /* channel (gold sequence index) of above peak */ + } group; +}; + +#ifdef SIMULATION +void dsss_demod_step(struct dsss_demod_state *st, float new_value, size_t sim_pos); +#else /* SIMULATION */ +void dsss_demod_step(struct dsss_demod_state *st, float new_value); +#endif /* SIMULATION */ + +#endif /* __DSSS_DEMOD_H__ */ |