Compare commits
2 commits
5a9a0f7acc
...
0909fe95ce
Author | SHA1 | Date | |
---|---|---|---|
0909fe95ce | |||
884d84bbf9 |
44
src/main.c
44
src/main.c
|
@ -25,7 +25,7 @@
|
|||
#define CLK_SYS_HZ (300 * MHZ)
|
||||
|
||||
#define LO_PIN 9
|
||||
#define RX_PIN 8
|
||||
#define RX_PIN 13
|
||||
#define FB_PIN 5
|
||||
#define PSU_PIN 23
|
||||
|
||||
|
@ -384,34 +384,52 @@ static void rf_rx_stop(void)
|
|||
|
||||
inline static int next_sample(const uint32_t *buf, int *h)
|
||||
{
|
||||
int x1 = buf[0] - buf[1];
|
||||
int x3 = 2 * (buf[0] - buf[1]);
|
||||
int x2 = 0;
|
||||
int x3 = buf[5] - buf[4];
|
||||
int x4 = 0;
|
||||
int x1 = 2 * (buf[5] - buf[4]);
|
||||
int x0 = 0;
|
||||
|
||||
int sample = 18 * h[9] + 14 * h[8] - 32 * h[7] - 33 * h[6] + 106 * h[5] + 362 * h[4] +
|
||||
565 * h[3] + 565 * h[2] + 362 * h[1] + 106 * h[0] - 33 * x1 - 32 * x2 +
|
||||
14 * x3 + 18 * x4;
|
||||
const int c[] = { 4, 2, -8, -9, 19, 55 };
|
||||
|
||||
int sample = 0;
|
||||
sample += (c[0]) * h[10];
|
||||
sample += (c[0] + c[1]) * h[9];
|
||||
sample += (c[0] + c[1] + c[2]) * h[8];
|
||||
sample += (c[0] + c[1] + c[2] + c[3]) * h[7];
|
||||
sample += (c[1] + c[2] + c[3] + c[4]) * h[6];
|
||||
sample += (c[2] + c[3] + c[4] + c[5]) * h[5];
|
||||
sample += (c[3] + c[4] + c[5] + c[5]) * h[4];
|
||||
sample += (c[4] + c[5] + c[5] + c[4]) * h[3];
|
||||
sample += (c[5] + c[5] + c[4] + c[3]) * h[2];
|
||||
sample += (c[5] + c[4] + c[3] + c[2]) * h[1];
|
||||
sample += (c[4] + c[3] + c[2] + c[1]) * h[0];
|
||||
sample += (c[3] + c[2] + c[1] + c[0]) * x3;
|
||||
sample += (c[2] + c[1] + c[0]) * x2;
|
||||
sample += (c[1] + c[0]) * x1;
|
||||
sample += (c[0]) * x0;
|
||||
sample *= gain;
|
||||
sample /= 256;
|
||||
|
||||
h[10] = h[6];
|
||||
h[9] = h[5];
|
||||
h[8] = h[4];
|
||||
h[7] = h[3];
|
||||
h[6] = h[2];
|
||||
h[5] = h[1];
|
||||
h[4] = h[0];
|
||||
h[3] = x1;
|
||||
h[3] = x3;
|
||||
h[2] = x2;
|
||||
h[1] = x3;
|
||||
h[0] = x4;
|
||||
h[1] = x1;
|
||||
h[0] = x0;
|
||||
|
||||
return gain * sample / 2260;
|
||||
return sample;
|
||||
}
|
||||
|
||||
static void rf_rx(void)
|
||||
{
|
||||
const uint32_t base = (uint32_t)rx_cos;
|
||||
int prevI[10] = { 0 };
|
||||
int prevQ[10] = { 0 };
|
||||
int prevI[11] = { 0 };
|
||||
int prevQ[11] = { 0 };
|
||||
int pos = 0;
|
||||
|
||||
while (true) {
|
||||
|
|
Loading…
Reference in a new issue