summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-05-22 16:48:07 +0700
committerhathach <[email protected]>2021-05-22 16:48:07 +0700
commit89dad1ad414e36aa3f0d69b35d06ec82c3e0f168 (patch)
tree560b720ea45e7cc7dbf18fed0cc65854151a4f0d
parent99add05aa78a0fd5d462ab822d0c4656c41c59d7 (diff)
update app
-rw-r--r--examples/host/cdc_msc_hid/src/hid_app.c10
-rw-r--r--src/class/hid/hid_host.h4
2 files changed, 11 insertions, 3 deletions
diff --git a/examples/host/cdc_msc_hid/src/hid_app.c b/examples/host/cdc_msc_hid/src/hid_app.c
index 72e7c30db..628ab3e7d 100644
--- a/examples/host/cdc_msc_hid/src/hid_app.c
+++ b/examples/host/cdc_msc_hid/src/hid_app.c
@@ -29,6 +29,10 @@
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
+
+// If your host terminal support ansi escape code, it can be use to simulate mouse cursor
+#define USE_ANSI_ESCAPE 0
+
#define MAX_REPORT 4
static uint8_t const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII };
@@ -165,6 +169,7 @@ static void process_kbd_report(hid_keyboard_report_t const *report)
void cursor_movement(int8_t x, int8_t y, int8_t wheel)
{
+#if USE_ANSI_ESCAPE
// Move X using ansi escape
if ( x < 0)
{
@@ -191,6 +196,11 @@ void cursor_movement(int8_t x, int8_t y, int8_t wheel)
{
printf(ANSI_SCROLL_DOWN(%d), wheel); // scroll down
}
+
+ printf("\r\n");
+#else
+ printf("(%d %d %d)\r\n", x, y, wheel);
+#endif
}
static void process_mouse_report(hid_mouse_report_t const * report)
diff --git a/src/class/hid/hid_host.h b/src/class/hid/hid_host.h
index dc0d8c935..1537216bb 100644
--- a/src/class/hid/hid_host.h
+++ b/src/class/hid/hid_host.h
@@ -63,9 +63,7 @@ typedef struct
//--------------------------------------------------------------------+
// Application API (Multiple devices)
-// Note:
-// - tud_n : is multiple devices API
-// - class_n : is multiple instances API
+// - tud_n : is multiple devices API
//--------------------------------------------------------------------+
// Get the number of HID instances