summaryrefslogtreecommitdiff
path: root/examples/host/cdc_msc_hid/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-12-07 14:57:58 +0700
committerhathach <[email protected]>2018-12-07 14:57:58 +0700
commit366ab797769b77dbf353b101ba862b20084dbc02 (patch)
tree9b742c44b00412b0d97068d1c0daa573c2c6c338 /examples/host/cdc_msc_hid/src
parentd524da0c941783887eaea968e5e7f8cb63313451 (diff)
able to build host hid
Diffstat (limited to 'examples/host/cdc_msc_hid/src')
-rw-r--r--examples/host/cdc_msc_hid/src/main.c39
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h7
2 files changed, 40 insertions, 6 deletions
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c
index 81e8a172c..88d7cd4de 100644
--- a/examples/host/cdc_msc_hid/src/main.c
+++ b/examples/host/cdc_msc_hid/src/main.c
@@ -111,12 +111,49 @@ void virtual_com_task(void)
//--------------------------------------------------------------------+
// USB HID
//--------------------------------------------------------------------+
-#if CFG_TUD_HID
+#if CFG_TUH_HID_KEYBOARD
void usb_hid_task(void)
{
}
+void tuh_hid_keyboard_mounted_cb(uint8_t dev_addr)
+{
+ // application set-up
+ printf("\na Keyboard device (address %d) is mounted\n", dev_addr);
+}
+
+void tuh_hid_keyboard_unmounted_cb(uint8_t dev_addr)
+{
+ // application tear-down
+ printf("\na Keyboard device (address %d) is unmounted\n", dev_addr);
+}
+
+// invoked ISR context
+void tuh_hid_keyboard_isr(uint8_t dev_addr, xfer_result_t event)
+{
+
+}
+
+#endif
+
+#if CFG_TUH_HID_MOUSE
+void tuh_hid_mouse_mounted_cb(uint8_t dev_addr)
+{
+ // application set-up
+ printf("\na Mouse device (address %d) is mounted\n", dev_addr);
+}
+
+void tuh_hid_mouse_unmounted_cb(uint8_t dev_addr)
+{
+ // application tear-down
+ printf("\na Mouse device (address %d) is unmounted\n", dev_addr);
+}
+
+// invoked ISR context
+void tuh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event)
+{
+}
#endif
//--------------------------------------------------------------------+
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index 6c6540b66..b7a766796 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -39,9 +39,6 @@
#ifndef _TUSB_CONFIG_H_
#define _TUSB_CONFIG_H_
-#include "tusb_option.h"
-#include "bsp/board.h"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -85,8 +82,8 @@
#define CFG_TUH_HUB 1 // not tested
#define CFG_TUH_CDC 1
-#define CFG_TUSB_HOST_HID_KEYBOARD 0
-#define CFG_TUSB_HOST_HID_MOUSE 0
+#define CFG_TUH_HID_KEYBOARD 1
+#define CFG_TUH_HID_MOUSE 1
#define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported)
#define CFG_TUH_MSC 1