EU1KY AA
dsp.c File Reference
#include <string.h>
#include <math.h>
#include <limits.h>
#include <complex.h>
#include "stm32f7xx_hal.h"
#include "stm32746g_discovery.h"
#include "stm32746g_discovery_audio.h"
#include "arm_math.h"
#include "dsp.h"
#include "gen.h"
#include "oslfile.h"
#include "config.h"
#include "crash.h"

Macros

#define Rtotal   (RmeasAdd + Rmeas + Rload)
 
#define DSP_Z0   50.0f
 
#define MAXNMEAS   20
 
#define MCF   0.013077f
 

Functions

void Sleep (uint32_t)
 
static float DSP_CalcR (void)
 
float DSP_CalcX (void)
 
static float _nonz (float f)
 
static float complex DSP_FFT (int channel)
 
void DSP_Init (void)
 
static float DSP_FilterArray (float *arr, int nm, int doRetries)
 
void DSP_Sample (void)
 
void DSP_Sample16 (void)
 
void DSP_Measure2 (void)
 
void DSP_Measure (uint32_t freqHz, int applyErrCorr, int applyOSL, int nMeasurements)
 
DSP_RX DSP_MeasuredZ (void)
 
float DSP_MeasuredPhase (void)
 
float DSP_MeasuredPhaseDeg (void)
 
float DSP_MeasuredDiffdB (void)
 
float DSP_MeasuredDiff (void)
 
float complex DSP_MeasuredMagPhaseV (void)
 
float complex DSP_MeasuredMagPhaseI (void)
 
float DSP_MeasuredMagVmv (void)
 
float DSP_MeasuredMagImv (void)
 
float DSP_CalcVSWR (DSP_RX Z)
 
uint32_t DSP_GetIF (void)
 

Variables

static float Rmeas = 5.1f
 
static float RmeasAdd = 200.0f
 
static float Rload = 51.0f
 
static float mag_v_buf [MAXNMEAS]
 
static float mag_i_buf [MAXNMEAS]
 
static float phdif_buf [MAXNMEAS]
 
float windowfunc [NSAMPLES]
 
float rfft_input [NSAMPLES]
 
float rfft_output [NSAMPLES]
 
const float complex * prfft = (float complex*)rfft_output
 
int16_t audioBuf [(NSAMPLES+NDUMMY)*2]
 
static float complex magphase_v = 0.1f+0.fi
 
static float complex magphase_i = 0.1f+0.fi
 
static float magmv_v = 1.
 
static float magmv_i = 1.
 
static float magdif = 1.f
 
static float magdifdb = 0.f
 
static float phdif = 0.f
 
static float phdifdeg = 0.f
 
static DSP_RX mZ = DSP_Z0 + 0.0fi
 

Macro Definition Documentation

#define DSP_Z0   50.0f
#define MAXNMEAS   20
#define MCF   0.013077f
#define Rtotal   (RmeasAdd + Rmeas + Rload)

Function Documentation

static float _nonz ( float  f)
static
static float DSP_CalcR ( void  )
static
float DSP_CalcVSWR ( DSP_RX  Z)
float DSP_CalcX ( void  )
static float complex DSP_FFT ( int  channel)
static
static float DSP_FilterArray ( float *  arr,
int  nm,
int  doRetries 
)
static
uint32_t DSP_GetIF ( void  )
void DSP_Init ( void  )
void DSP_Measure ( uint32_t  freqHz,
int  applyErrCorr,
int  applyOSL,
int  nMeasurements 
)
void DSP_Measure2 ( void  )
float DSP_MeasuredDiff ( void  )
float DSP_MeasuredDiffdB ( void  )
float DSP_MeasuredMagImv ( void  )
float complex DSP_MeasuredMagPhaseI ( void  )
float complex DSP_MeasuredMagPhaseV ( void  )
float DSP_MeasuredMagVmv ( void  )
float DSP_MeasuredPhase ( void  )
float DSP_MeasuredPhaseDeg ( void  )
DSP_RX DSP_MeasuredZ ( void  )
void DSP_Sample ( void  )
void DSP_Sample16 ( void  )
void Sleep ( uint32_t  )

Variable Documentation

int16_t audioBuf[(NSAMPLES+NDUMMY)*2]
float mag_i_buf[MAXNMEAS]
static
float mag_v_buf[MAXNMEAS]
static
float magdif = 1.f
static
float magdifdb = 0.f
static
float magmv_i = 1.
static
float magmv_v = 1.
static
float complex magphase_i = 0.1f+0.fi
static
float complex magphase_v = 0.1f+0.fi
static
DSP_RX mZ = DSP_Z0 + 0.0fi
static
float phdif = 0.f
static
float phdif_buf[MAXNMEAS]
static
float phdifdeg = 0.f
static
const float complex* prfft = (float complex*)rfft_output
float rfft_input[NSAMPLES]
float rfft_output[NSAMPLES]
float Rload = 51.0f
static
float Rmeas = 5.1f
static
float RmeasAdd = 200.0f
static
float windowfunc[NSAMPLES]