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:
co-authored by
Claude Opus 4.6
parent
2611c70881
commit
94d55a88d2
+10
-1
@@ -4,8 +4,10 @@
|
||||
#include "display_cfg.h"
|
||||
#include "data.h"
|
||||
#include "ui.h"
|
||||
#include "hid.h"
|
||||
#include "touch.h"
|
||||
|
||||
static LGFX lcd;
|
||||
LGFX lcd; // global - used by touch.cpp
|
||||
static UsageData usage = {};
|
||||
|
||||
// LVGL draw buffers
|
||||
@@ -105,6 +107,12 @@ void setup() {
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
|
||||
lv_indev_set_read_cb(indev, my_touch_cb);
|
||||
|
||||
// Init USB HID keyboard
|
||||
hid_init();
|
||||
|
||||
// Init touch gesture detection
|
||||
touch_init();
|
||||
|
||||
// Build dashboard
|
||||
ui_init();
|
||||
|
||||
@@ -114,6 +122,7 @@ void setup() {
|
||||
void loop() {
|
||||
lv_timer_handler();
|
||||
ui_tick_anim();
|
||||
touch_tick();
|
||||
|
||||
if (read_serial_line()) {
|
||||
if (parse_json(serial_buf, &usage)) {
|
||||
|
||||
Reference in New Issue
Block a user