summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-16 02:49:13 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-16 02:49:13 -0600
commit93f054683dd5fc5b79541f4922cb34a38cb5c341 (patch)
tree5fed989181dbf1c7714c6c4fe7b910344e8ba30d /main.c
parent7c30fe0be98a3028964d437f5c31cc968fbf9755 (diff)
keyboard hello world?
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/main.c b/main.c
index 9b508c0..65db34d 100644
--- a/main.c
+++ b/main.c
@@ -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]);
+ }
}
}