Testing multicore

This commit is contained in:
Martin Brodbeck 2024-02-14 10:13:50 +01:00
parent 398016e81f
commit 6ea69df2fa
2 changed files with 24 additions and 3 deletions

View file

@ -52,6 +52,7 @@ target_link_libraries(raspi_keyer
hardware_exception
hardware_pwm
pico_flash
pico_multicore
)
pico_add_extra_outputs(raspi_keyer)

View file

@ -1,6 +1,8 @@
#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/multicore.h"
#include "pico/util/queue.h"
#include "settings.h"
#include "keyer.h"
@ -15,6 +17,8 @@ extern const uint LEFT_PADDLE_PIN = 14;
extern const uint RIGHT_PADDLE_PIN = 15;
extern const uint BUZZER_PIN = 13;
queue_t keyerQueue;
void setup()
{
stdio_init_all();
@ -33,6 +37,20 @@ void setup()
sleep_ms(1000);
}
void core1_main()
{
Settings settings;
queue_remove_blocking(&keyerQueue, &settings);
Keyer keyer(settings.wpm, settings.mode);
while (true)
{
keyer.run();
}
}
int main()
{
timer_hw->dbgpause = 0; // workaround for problem with debug and sleep_ms
@ -42,12 +60,14 @@ int main()
Settings settings{read_settings()};
Keyer keyer(settings.wpm, settings.mode);
/*Keyer keyer(settings.wpm, settings.mode);*/
queue_add_blocking(&keyerQueue, &settings);
while (true)
{
keyer.run();
}
sleep_ms(100);
}
return 0;
}