diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-16 02:49:13 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-16 02:49:13 -0600 |
commit | 93f054683dd5fc5b79541f4922cb34a38cb5c341 (patch) | |
tree | 5fed989181dbf1c7714c6c4fe7b910344e8ba30d /main.c | |
parent | 7c30fe0be98a3028964d437f5c31cc968fbf9755 (diff) |
keyboard hello world?
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -6,12 +6,17 @@ #include "bsp/board_api.h" #include "tusb.h" +/* local */ +#include "usb_keyboard.h" + int main() { /* pico-sdk initialization */ stdio_uart_init(); gpio_init(PICO_DEFAULT_LED_PIN); gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT); + usb_keyboard_init(); + /* TinyUSB initialization */ board_init(); tud_init(BOARD_TUD_RHPORT); @@ -20,7 +25,12 @@ int main() { /* Event loop. */ for (;;) { - tud_task(); /* run TinyUSB */ - usbkeyboard_task(); + tud_task(); + usb_keyboard_task(); + if (usb_keyboard_is_flushed()) { + char *msg = "Hello world!\n"; + for (size_t i = 0; i < strlen(msg); i++) + usb_keyboard_send_char(msg[i]); + } } } |