update app

This commit is contained in:
hathach 2021-05-22 16:48:07 +07:00
parent 99add05aa7
commit 89dad1ad41
2 changed files with 11 additions and 3 deletions

View File

@ -29,6 +29,10 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION // 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 #define MAX_REPORT 4
static uint8_t const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; 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) void cursor_movement(int8_t x, int8_t y, int8_t wheel)
{ {
#if USE_ANSI_ESCAPE
// Move X using ansi escape // Move X using ansi escape
if ( x < 0) 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(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) static void process_mouse_report(hid_mouse_report_t const * report)

View File

@ -63,9 +63,7 @@ typedef struct
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Application API (Multiple devices) // Application API (Multiple devices)
// Note: // - tud_n : is multiple devices API
// - tud_n : is multiple devices API
// - class_n : is multiple instances API
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Get the number of HID instances // Get the number of HID instances