fix problem with debug and sleep_ms

This commit is contained in:
Martin Brodbeck 2024-02-10 23:26:53 +01:00
parent 7d1b8eaed7
commit 49e3a19f1f

View file

@ -1,19 +1,19 @@
#include <stdio.h> #include <stdio.h>
#include <pico/stdlib.h>
#include "pico/stdlib.h"
#include "settings.h" #include "settings.h"
#include "keyer.h"
namespace namespace
{ {
const uint LED_PIN = PICO_DEFAULT_LED_PIN; const uint LED_PIN = PICO_DEFAULT_LED_PIN;
const uint LEFT_PADDLE_PIN = 2; const uint LEFT_PADDLE_PIN = 14;
const uint RIGHT_PADDLE_PIN = 5; const uint RIGHT_PADDLE_PIN = 15;
} }
void setup() void setup()
{ {
stdio_init_all();
sleep_ms(1000);
gpio_init(LED_PIN); gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT); gpio_set_dir(LED_PIN, GPIO_OUT);
@ -30,6 +30,10 @@ void setup()
int main() 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(); setup();
Settings settings{read_settings()}; Settings settings{read_settings()};
@ -37,9 +41,12 @@ int main()
printf("Iambic mode (loaded): %d\n", static_cast<int>(settings.mode)); printf("Iambic mode (loaded): %d\n", static_cast<int>(settings.mode));
printf("WPM (loaded): %d\n", settings.wpm); printf("WPM (loaded): %d\n", settings.wpm);
Keyer keyer;
while (true) while (true)
{ {
sleep_ms(1000); sleep_ms(10);
keyer.run();
} }
return 0; return 0;