From 20a2cdc73c9ec09728c0fcbb74b6201c7597be88 Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Mon, 9 May 2016 14:02:24 +0200 Subject: [PATCH] Got the VCO output inverted (and the signal as well), so now the output and the input are actually in phase. --- libcsdr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcsdr.c b/libcsdr.c index 4406e67..ca43c40 100644 --- a/libcsdr.c +++ b/libcsdr.c @@ -1366,8 +1366,8 @@ void pll_cc(pll_t* p, complexf* input, float* output_dphase, complexf* output_vc while(p->output_phase<-PI) p->output_phase+=2*PI; if(output_vco) //we don't output anything if it is a NULL pointer { - iof(output_vco,i) = cos(p->output_phase); - qof(output_vco,i) = sin(p->output_phase); + iof(output_vco,i) = sin(p->output_phase); + qof(output_vco,i) = cos(p->output_phase); } float input_phase = atan2(iof(input,i),qof(input,i)); @@ -1395,7 +1395,7 @@ void pll_cc(pll_t* p, complexf* input, float* output_dphase, complexf* output_vc p->dphase = p->dphase * (1-p->alpha) + new_dphase * p->alpha; } else return; - if(output_dphase) output_dphase[i] = p->dphase; + if(output_dphase) output_dphase[i] = -p->dphase; //if(output_dphase) output_dphase[i] = new_dphase/3.15; } }