From 41ec379ad62f19210399e9d4a2d76e54a362bfb7 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 25 Jun 2024 02:55:45 -0700 Subject: [PATCH] Update with 27.025MHz receiver too --- ch32v/ch32v203-goertzel/adcgoertzel.c | 18 +++++++++++++----- ch32v/lib/calculator.html | 4 +++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ch32v/ch32v203-goertzel/adcgoertzel.c b/ch32v/ch32v203-goertzel/adcgoertzel.c index 811604e..09ecfa3 100644 --- a/ch32v/ch32v203-goertzel/adcgoertzel.c +++ b/ch32v/ch32v203-goertzel/adcgoertzel.c @@ -112,13 +112,21 @@ const int32_t g_goertzel_coefficient_s = 1984016189; #endif +#if 0 +#define PWM_PERIOD (30-1) +#define GOERTZEL_BUFFER (320) +const int32_t g_goertzel_omega_per_sample = 990894956; // 0.146875 of whole per step / 101.505000MHz +const int32_t g_goertzel_coefficient = 1296126516; +const int32_t g_goertzel_coefficient_s = 1712233066; + +#endif + #if 1 #define PWM_PERIOD (30-1) -#define GOERTZEL_BUFFER (396) -const int32_t g_goertzel_omega_per_sample = 5485805733; // 0.813131 of whole per step / 90.303030MHz -const int32_t g_goertzel_coefficient = 829669840; -const int32_t g_goertzel_coefficient_s = -1980740764; - +#define GOERTZEL_BUFFER (384) +const int32_t g_goertzel_omega_per_sample = 4251712402; // 0.630208 of whole per step / 27.025000MHz +const int32_t g_goertzel_coefficient = -1468003291; +const int32_t g_goertzel_coefficient_s = -1567371161; #endif int intensity_max = 1; diff --git a/ch32v/lib/calculator.html b/ch32v/lib/calculator.html index 9087ef7..327270a 100644 --- a/ch32v/lib/calculator.html +++ b/ch32v/lib/calculator.html @@ -80,7 +80,9 @@ function computeTable() "Goertzel" + "Goertzel (Inverse)" + "" + - "

Click on a ordinal offset to create the C code needed for that tuning parameter. Clicking will copy-to-clipboard.

"; + "

Click on a ordinal offset to create the C code needed for that tuning parameter. Clicking will copy-to-clipboard.

" + + "

N Divisor #30 (row 3) is usually pretty good. And, try to select things near 0.25 / 0.75, and avoid 0.0, 0.5, and 1.0.

" + + "

Goertzel's mode is for the ch32v203

"; } contents += "";