From 90b7ead01749fe2e806ff29a91f4c2b04e4135e3 Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 2 Mar 2014 21:39:18 +0700 Subject: [PATCH] refine keyboard host demo (added new line for enter key) --- demos/host/src/cdc_serial_app.c | 2 +- demos/host/src/keyboard_app.c | 4 +++- demos/host/src/tusb_config.h | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/demos/host/src/cdc_serial_app.c b/demos/host/src/cdc_serial_app.c index 2fe9b871d..6afcd0eed 100644 --- a/demos/host/src/cdc_serial_app.c +++ b/demos/host/src/cdc_serial_app.c @@ -150,7 +150,7 @@ OSAL_TASK_FUNCTION( cdc_serial_app_task ) (void* p_task_para) if ( TUSB_ERROR_NONE == error) { - for(uint8_t i=0; imodifier, p_new_report->keycode[i]) ); + uint8_t ch = keycode_to_ascii(p_new_report->modifier, p_new_report->keycode[i]); + putchar(ch); + if ( ch == '\r' ) putchar('\n'); // added new line for enter key } } // TODO example skips key released diff --git a/demos/host/src/tusb_config.h b/demos/host/src/tusb_config.h index ddd56189b..09e481bbd 100644 --- a/demos/host/src/tusb_config.h +++ b/demos/host/src/tusb_config.h @@ -64,12 +64,12 @@ #define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 255 //------------- CLASS -------------// -#define TUSB_CFG_HOST_HUB 0 -#define TUSB_CFG_HOST_HID_KEYBOARD 0 +#define TUSB_CFG_HOST_HUB 1 +#define TUSB_CFG_HOST_HID_KEYBOARD 1 #define TUSB_CFG_HOST_HID_MOUSE 1 #define TUSB_CFG_HOST_HID_GENERIC 0 #define TUSB_CFG_HOST_MSC 1 -#define TUSB_CFG_HOST_CDC 0 +#define TUSB_CFG_HOST_CDC 1 #define TUSB_CFG_HOST_CDC_RNDIS 0 //--------------------------------------------------------------------+