/* main.c - Main entry point and event loop for sbc-harness * * Copyright (C) 2024 Luke T. Shumaker * SPDX-Licence-Identifier: AGPL-3.0-or-later */ #include /* for strlen() */ #include /* for printf() */ #include "pico/stdlib.h" #include #include #include "hw/rp2040_hwspi.h" #include "usb_keyboard.h" COROUTINE hello_world_cr(void *_chan) { const char *msg = "Hello world!\n"; usb_keyboard_rpc_t *chan = _chan; cr_begin(); for (size_t i = 0;; i = (i+1) % strlen(msg)) { int result = usb_keyboard_rpc_send_req(chan, (uint32_t)msg[i]); if (result < 1) { printf("error!\n"); break; } } cr_end(); } int main() { /* initialization */ stdio_uart_init(); usb_common_earlyinit(); usb_keyboard_init(); usb_common_lateinit(); /* set up coroutines */ coroutine_add(usb_common_cr, NULL); usb_keyboard_rpc_t keyboard_chan = {0}; coroutine_add(usb_keyboard_cr, &keyboard_chan); //coroutine_add(hello_world_cr, &keyboard_chan); /* Event loop. */ coroutine_main(); }