Add USB HID keyboard input via touch gestures

The SC01 Plus now acts as a composite USB device (CDC serial + HID keyboard).
Touch gestures on the screen send keystrokes to the computer:

- Swipe up/down: arrow keys
- Swipe right: Enter
- Swipe left: Shift+Tab (change mode in Claude Code)
- Double-tap logo: Ctrl+Space (voice mode)
- Tap and hold: Space (held while touching)

Gesture-to-key mapping is defined as a simple config table in hid.cpp.
Touch detection uses a state machine with configurable thresholds in touch.cpp.

Switches to TinyUSB composite mode (ARDUINO_USB_MODE=0). Flashing now
requires flash.sh which handles the DTR/RTS bootloader reset.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hermann Björgvin Haraldsson
2026-04-01 17:29:06 +00:00
co-authored by Claude Opus 4.6
parent 2611c70881
commit 94d55a88d2
7 changed files with 252 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <Arduino.h>
// Gesture types
enum gesture_t {
GESTURE_NONE,
GESTURE_SWIPE_UP,
GESTURE_SWIPE_DOWN,
GESTURE_SWIPE_LEFT,
GESTURE_SWIPE_RIGHT,
GESTURE_DOUBLE_TAP_LOGO,
GESTURE_HOLD_START,
GESTURE_HOLD_END,
};
void hid_init(void);
void hid_on_gesture(gesture_t gesture);