From 49e3a19f1fc669f3bd5dde9cea1dfbb82dcdfd1e Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Sat, 10 Feb 2024 23:26:53 +0100 Subject: [PATCH] fix problem with debug and sleep_ms --- src/pico_keyer.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/pico_keyer.cpp b/src/pico_keyer.cpp index e51a493..095acac 100644 --- a/src/pico_keyer.cpp +++ b/src/pico_keyer.cpp @@ -1,19 +1,19 @@ #include -#include + +#include "pico/stdlib.h" #include "settings.h" +#include "keyer.h" namespace { const uint LED_PIN = PICO_DEFAULT_LED_PIN; - const uint LEFT_PADDLE_PIN = 2; - const uint RIGHT_PADDLE_PIN = 5; + const uint LEFT_PADDLE_PIN = 14; + const uint RIGHT_PADDLE_PIN = 15; } void setup() { - stdio_init_all(); - sleep_ms(1000); gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); @@ -30,6 +30,10 @@ void setup() int main() { + stdio_init_all(); + timer_hw->dbgpause = 0; // fix problem with debug and sleep_ms https://github.com/raspberrypi/pico-sdk/issues/1152#issuecomment-1418248639 + sleep_ms(1000); + setup(); Settings settings{read_settings()}; @@ -37,9 +41,12 @@ int main() printf("Iambic mode (loaded): %d\n", static_cast(settings.mode)); printf("WPM (loaded): %d\n", settings.wpm); + Keyer keyer; + while (true) { - sleep_ms(1000); + sleep_ms(10); + keyer.run(); } return 0;