summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-05-01 17:05:25 +0700
committerhathach <[email protected]>2019-05-01 17:06:18 +0700
commit84f81f6b213305207fa6d4d01ce6911f5ad3cf66 (patch)
treef7e1e83f199ce9cd9809fa31a49c1c7424d7e4e7 /examples
parent0b6999a28e5dde91e1a911523e1f633f8983b504 (diff)
simplify hid keyboard & mouse report to one API each
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_hid/src/main.c6
-rw-r--r--examples/device/cdc_msc_hid_freertos/src/main.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/examples/device/cdc_msc_hid/src/main.c b/examples/device/cdc_msc_hid/src/main.c
index 8087adbb9..1a954f21a 100644
--- a/examples/device/cdc_msc_hid/src/main.c
+++ b/examples/device/cdc_msc_hid/src/main.c
@@ -196,7 +196,9 @@ void hid_task(void)
if ( btn )
{
int8_t const delta = 5;
- tud_hid_mouse_move(REPORT_ID_MOUSE, delta, delta); // right + down
+
+ // no button, right + down, no scroll pan
+ tud_hid_mouse_report(REPORT_ID_MOUSE, 0x00, delta, delta, 0, 0);
// delay a bit before attempt to send keyboard report
board_delay(2);
@@ -220,7 +222,7 @@ void hid_task(void)
}else
{
// send empty key report if previously has key pressed
- if (has_key) tud_hid_keyboard_key_release(REPORT_ID_KEYBOARD);
+ if (has_key) tud_hid_keyboard_report(REPORT_ID_KEYBOARD, 0, NULL);
has_key = false;
}
}
diff --git a/examples/device/cdc_msc_hid_freertos/src/main.c b/examples/device/cdc_msc_hid_freertos/src/main.c
index 2cd34dddc..e4471242f 100644
--- a/examples/device/cdc_msc_hid_freertos/src/main.c
+++ b/examples/device/cdc_msc_hid_freertos/src/main.c
@@ -226,7 +226,9 @@ void hid_task(void* params)
if ( btn )
{
int8_t const delta = 5;
- tud_hid_mouse_move(REPORT_ID_MOUSE, delta, delta); // right + down
+
+ // no button, right + down, no scroll pan
+ tud_hid_mouse_report(REPORT_ID_MOUSE, 0x00, delta, delta, 0, 0);
// delay a bit before attempt to send keyboard report
vTaskDelay(pdMS_TO_TICKS(2));
@@ -250,7 +252,7 @@ void hid_task(void* params)
}else
{
// send empty key report if previously has key pressed
- if (has_key) tud_hid_keyboard_key_release(REPORT_ID_KEYBOARD);
+ if (has_key) tud_hid_keyboard_report(REPORT_ID_KEYBOARD, 0, NULL);
has_key = false;
}
}