diff --git a/ch32v/ch32v003-adcrx/calculator.html b/ch32v/ch32v003-adcrx/calculator.html deleted file mode 100644 index 6ac531b..0000000 --- a/ch32v/ch32v003-adcrx/calculator.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - -

Tool for computing tuning to specific frequencies by use of direct ADC reading at specific timer-controlled rate to "tune" to specific frequencies either by quadrature or differential.

- - - - -
Crystal MHz
Target MHz
- - - - - - - - -
Quadrature:
I = + + - -
Q = + - - +
Differntial:
V = + - + -
You choose the mode you operate in, either Quadrature or differential
- -

Table shows:

- - - - - -
Sample Frequency Harmonic
Lower Quadrature Frequency
Upper Quadrature Frequency
Differential Frequency
- -
- - - diff --git a/ch32v/ch32v203-fft/Makefile b/ch32v/ch32v203-fft/Makefile index e4111b3..356722c 100644 --- a/ch32v/ch32v203-fft/Makefile +++ b/ch32v/ch32v203-fft/Makefile @@ -5,7 +5,7 @@ TARGET_MCU:=CH32V203G6U6 TARGET_MCU_PACKAGE:=CH32V203G6U6 CH32V003FUN:=../ch32v003fun/ch32v003fun -EXTRA_CFLAGS:=-Wno-unused-function -I../../lib -Ilib +EXTRA_CFLAGS:=-Wno-unused-function -I../../lib -I../lib include ../ch32v003fun/ch32v003fun/ch32v003fun.mk diff --git a/ch32v/ch32v203-goertzel/Makefile b/ch32v/ch32v203-goertzel/Makefile index 6cb6078..0ba7d27 100644 --- a/ch32v/ch32v203-goertzel/Makefile +++ b/ch32v/ch32v203-goertzel/Makefile @@ -5,7 +5,7 @@ TARGET_MCU:=CH32V203G6U6 TARGET_MCU_PACKAGE:=CH32V203G6U6 CH32V003FUN:=../ch32v003fun/ch32v003fun -EXTRA_CFLAGS:=-Wno-unused-function -I../../lib -I../ch32v203-fft/lib +EXTRA_CFLAGS:=-Wno-unused-function -I../../lib -I../lib include ../ch32v003fun/ch32v003fun/ch32v003fun.mk diff --git a/ch32v/ch32v203-goertzel/adcgoertzel.c b/ch32v/ch32v203-goertzel/adcgoertzel.c index 7cb9459..08e05bc 100644 --- a/ch32v/ch32v203-goertzel/adcgoertzel.c +++ b/ch32v/ch32v203-goertzel/adcgoertzel.c @@ -68,7 +68,7 @@ SOFTWARE. #include "ssd1306.h" -#define PWM_PERIOD (31-1) //For 27.0MHz, use 36MHz if quadrature -- It appears to be good for *244 in the table? WHY 26MHz???!?!!? +#define PWM_PERIOD (31-1) #define ADC_BUFFSIZE 512 @@ -83,7 +83,6 @@ const int32_t g_goertzel_omega_per_sample = 1238618695; // 47/256 -> 27.01920 MH const int32_t g_goertzel_coefficient = 870249096; const int32_t g_goertzel_coefficient_s = 1963250500; - #define LOG_GOERTZEL_LIST 256 int32_t gertzellogs[LOG_GOERTZEL_LIST*2]; int gertzellogs_head; diff --git a/ch32v/ch32v203-goertzel/ttest/ttest.c b/ch32v/ch32v203-goertzel/ttest/ttest.c index f82124c..2bb6086 100644 --- a/ch32v/ch32v203-goertzel/ttest/ttest.c +++ b/ch32v/ch32v203-goertzel/ttest/ttest.c @@ -13,6 +13,7 @@ int32_t g_goertzelp_store, g_goertzelp2_store; int main() { //XXX XXX NOTE If you are computing the coefficients, you can plug the value in here. + // You can get this number from calculator.html. I've had better luck with "inverse goertzel" numbers. g_goertzel_omega_per_sample = (47.0/256) * 3.1415926535*2.0*(1<<29); g_goertzel_coefficient = 2 * cos( g_goertzel_omega_per_sample / (double)(1<<29) ) * (1<<30); g_goertzel_coefficient_s = 2 * sin( g_goertzel_omega_per_sample / (double)(1<<29) ) * (1<<30); diff --git a/ch32v/lib/calculator.html b/ch32v/lib/calculator.html new file mode 100644 index 0000000..e583b0b --- /dev/null +++ b/ch32v/lib/calculator.html @@ -0,0 +1,167 @@ + + + + + + + + +

Tool for computing tuning to specific frequencies by use of direct ADC reading at specific timer-controlled rate to "tune" to specific frequencies either by quadrature or differential.

+ + + + + +
Crystal MHz
Target MHz
Table TypeQuadratureGoertzels
+ + +
+ + + diff --git a/ch32v/ch32v203-fft/lib/font_8x8.h b/ch32v/lib/font_8x8.h similarity index 100% rename from ch32v/ch32v203-fft/lib/font_8x8.h rename to ch32v/lib/font_8x8.h diff --git a/ch32v/ch32v203-fft/lib/ssd1306.h b/ch32v/lib/ssd1306.h similarity index 100% rename from ch32v/ch32v203-fft/lib/ssd1306.h rename to ch32v/lib/ssd1306.h diff --git a/ch32v/ch32v203-fft/lib/ssd1306_i2c.h b/ch32v/lib/ssd1306_i2c.h similarity index 100% rename from ch32v/ch32v203-fft/lib/ssd1306_i2c.h rename to ch32v/lib/ssd1306_i2c.h