diff --git a/src/raspi_keyer.cpp b/src/raspi_keyer.cpp index 335d5ab..89a5b85 100644 --- a/src/raspi_keyer.cpp +++ b/src/raspi_keyer.cpp @@ -1,14 +1,14 @@ #include +#include "bsp/board.h" #include "pico/multicore.h" #include "pico/stdlib.h" #include "pico/util/queue.h" #include "tusb.h" -#include "bsp/board.h" -#include "tusb_config.h" #include "keyer.h" #include "settings.h" +#include "tusb_config.h" namespace { @@ -89,6 +89,43 @@ void core1_main() } } +[[maybe_unused]] +static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count) +{ + for(uint32_t i=0; i 1) { + printf("Command received …\n"); + switch (buf[0]) { + case 0: // ADMIN COMMAND + switch (buf[1]) { + case 2: // Host Open + // TODO: send back revision code + default: + printf("Unknown admin command.\n"); + } + break; + default: + printf("Unknown command.\n"); + } + } + } +} + int main() { // timer_hw->dbgpause = 2; // workaround for problem with debug and sleep_ms @@ -97,23 +134,22 @@ int main() setup(); board_init(); tud_init(BOARD_TUD_RHPORT); - + printf("Hello from core0!\n"); - Settings settings{read_settings()}; + Settings settings {read_settings()}; settings.wpm = 25; // TODO: remove! queue_init(&keyerQueue, sizeof(KeyerQueueData), 2); multicore_reset_core1(); multicore_launch_core1(core1_main); - KeyerQueueData keyerQueueData{KeyerQueueCommand::Run, settings.wpm, settings.mode}; + KeyerQueueData keyerQueueData {KeyerQueueCommand::Run, settings.wpm, settings.mode}; queue_add_blocking(&keyerQueue, &keyerQueueData); while (true) { - // Currently there's nothing to do on core0 - sleep_ms(1000); tud_task(); + cdc_task(); } return 0;