improve touch functionality

This commit is contained in:
2025-07-17 12:13:42 -04:00
parent 5597899ad8
commit 8ed9e02175
4 changed files with 808 additions and 755 deletions
Binary file not shown.
+9 -1
View File
@@ -97,7 +97,7 @@ const indicator_list = [
{id: "scroll", label: "ScrollLock"}
];
const macro_list = [
{id: "power", label: "Power", keys: ["WakeUp"]},
{id: "power", label: "Power/Wake", keys: ["WakeUp"]},
{id: "reset", label: "CTRL+ALT+DEL", keys: ["ControlLeft","AltLeft","Delete"]},
{id: "close", label: "ALT+F4", keys: ["AltLeft", "F4"]},
{id: "cycle", label: "ALT+Tab", keys: ["AltLeft", "Tab"]}
@@ -325,6 +325,10 @@ function createKeys(keyboard_id) {
newDiv.id = key.id;
newDiv.innerHTML = key.label;
newDiv.className = "key";
newDiv.addEventListener("touchstart", function (event) {
event.preventDefault(); pressKey(key.id); });
newDiv.addEventListener("touchend", function (event) {
event.preventDefault(); releaseKey(key.id); });
newDiv.addEventListener("mousedown", function () {
pressKey(key.id); });
newDiv.addEventListener("mouseup", function () {
@@ -349,6 +353,10 @@ function createMacros(macro_id) {
let newDiv = document.createElement("div");
newDiv.id = macro.id;
newDiv.textContent = macro.label;
newDiv.addEventListener("touchstart", function (event) {
event.preventDefault(); sendKeys(macro.keys); });
newDiv.addEventListener("touchend", function (event) {
event.preventDefault(); sendKeys([]);; });
newDiv.addEventListener("mousedown", function () {
sendKeys(macro.keys); });
newDiv.addEventListener("mouseup", function () {
+797 -752
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -97,8 +97,8 @@ uint8_t const desc_hid_report[] =
// full speed configuration
uint8_t const desc_fs_configuration[] =
{
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),
// Config number, interface count, string index, total length, attribute, power in mA - atttribute 0xa0 enables wakeup
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0xa0, 100),
// Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval
TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF, 8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64),