summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PLAN.md20
-rw-r--r--usb_keyboard.c4
2 files changed, 13 insertions, 11 deletions
diff --git a/PLAN.md b/PLAN.md
index 4b83eee..da65817 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -1,14 +1,14 @@
- with hardware I have:
- 1. type "hello world" as a USB keyboard
- 2. get networking up (ping)
- 3. forward port 21 as a USB keyboard
- 4. forward a 9p file as a USB keyboard
- 5. connect UART as a 9p socket
+ 1. [X] type "hello world" as a USB keyboard
+ 2. [ ] get networking up (ping)
+ 3. [ ] forward port 21 as a USB keyboard
+ 4. [ ] forward a 9p file as a USB keyboard
+ 5. [ ] connect UART as a 9p socket
- waiting on hardware:
- sdcard slot:
- 1. whatever the "hello world" of SD is
- 2. as a device on 9p
+ 1. [ ] whatever the "hello world" of SD is
+ 2. [ ] as a device on 9p
- HDMI socket
- 1. PicoDVI hello-world
- 2. "PiciDVI" to network
- 3. reverse the flow of PicoDVI
+ 1. [ ] PicoDVI hello-world
+ 2. [ ] "PiciDVI" to network
+ 3. [ ] reverse the flow of PicoDVI
diff --git a/usb_keyboard.c b/usb_keyboard.c
index 5647403..6b5edec 100644
--- a/usb_keyboard.c
+++ b/usb_keyboard.c
@@ -42,12 +42,13 @@ static size_t kbd_buf_len = 0;
static uint8_t ascii2keycode[128][2] = { HID_ASCII_TO_KEYCODE };
void usb_keyboard_task(void) {
+ static bool sent_key = false;
if (tud_hid_n_ready(kbd_ifc)) {
uint8_t const report_id = 0;
uint8_t modifier = 0;
uint8_t keycodes[6] = {0};
- if (kbd_buf_len) {
+ if (kbd_buf_len && !sent_key) {
if (ascii2keycode[kbd_buf[kbd_buf_beg]][0])
modifier = KEYBOARD_MODIFIER_LEFTSHIFT;
keycodes[0] = ascii2keycode[kbd_buf[kbd_buf_beg]][1];
@@ -59,6 +60,7 @@ void usb_keyboard_task(void) {
}
tud_hid_n_keyboard_report(kbd_ifc, report_id, modifier, keycodes);
+ sent_key = !sent_key;
}
}