Improve band-pass filter

This commit is contained in:
Jan Hamal Dvořák 2024-08-07 00:19:29 +02:00
parent a61748c6b5
commit f10f8d5ceb

View file

@ -23,7 +23,7 @@
#include <stdlib.h>
#define VREG_VOLTAGE VREG_VOLTAGE_1_20
#define CLK_SYS_HZ (300 * MHZ)
#define CLK_SYS_HZ (288 * MHZ)
#define INIT_SAMPLE_RATE 200000
#define INIT_FREQ 94600000
@ -267,18 +267,17 @@ struct IQ {
inline static int nextQ(void)
{
static int x1;
static int y1;
static int x4, x3, x2, x1;
int x0 = gain * adc_fifo_get_blocking();
int y0 = x0 + x1;
int x = x2 + x2 - x4 - x0;
x4 = x3;
x3 = x2;
x2 = x1;
x1 = x0;
int y = y0 - y1;
y1 = y0;
return y;
return x;
}
inline static struct IQ next_sample()