diff options
| author | hathach <[email protected]> | 2019-05-01 17:05:25 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-05-01 17:06:18 +0700 |
| commit | 84f81f6b213305207fa6d4d01ce6911f5ad3cf66 (patch) | |
| tree | f7e1e83f199ce9cd9809fa31a49c1c7424d7e4e7 /examples/device | |
| parent | 0b6999a28e5dde91e1a911523e1f633f8983b504 (diff) | |
simplify hid keyboard & mouse report to one API each
Diffstat (limited to 'examples/device')
| -rw-r--r-- | examples/device/cdc_msc_hid/src/main.c | 6 | ||||
| -rw-r--r-- | examples/device/cdc_msc_hid_freertos/src/main.c | 6 |
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; } } |
