From 0530cba018d0eac7ef24e74d42eadd2fc3964cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hamal=20Dvo=C5=99=C3=A1k?= Date: Sun, 25 Feb 2024 17:24:33 +0100 Subject: [PATCH] Allow changing frequency during TX --- src/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 053f170..aea2057 100644 --- a/src/main.c +++ b/src/main.c @@ -858,15 +858,22 @@ static void command(const char *cmd) puts("Transmitting, press ENTER to stop."); bool phase = false; + const double step_hz = (double)CLK_SYS_HZ / (LO_WORDS * 32); while (true) { - int c = getchar_timeout_us(1000); + int c = getchar_timeout_us(10000); if ('\r' == c) { break; } else if (' ' == c) { phase = !phase; gpio_set_outover(n, phase); + } else if ('+' == c) { + actual = lo_freq_init(actual + step_hz); + printf("Frequency: %.0f\n", actual); + } else if ('-' == c) { + actual = lo_freq_init(actual - step_hz); + printf("Frequency: %.0f\n", actual); } }