summaryrefslogtreecommitdiff
path: root/examples
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
parentd524da0c941783887eaea968e5e7f8cb63313451 (diff)
able to build host hid
Diffstat (limited to 'examples')
-rw-r--r--examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject3
-rw-r--r--examples/host/cdc_msc_hid/src/main.c39
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h7
-rw-r--r--examples/obsolete/host/src/keyboard_host_app.c2
-rw-r--r--examples/obsolete/host/src/keyboard_host_app.h2
-rw-r--r--examples/obsolete/host/src/main.c4
-rw-r--r--examples/obsolete/host/src/mouse_host_app.c2
-rw-r--r--examples/obsolete/host/src/mouse_host_app.h2
-rw-r--r--examples/obsolete/host/src/tusb_config.h4
9 files changed, 50 insertions, 15 deletions
diff --git a/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject b/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject
index 3b8924309..425f42a58 100644
--- a/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject
+++ b/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject
@@ -18,11 +18,12 @@
arm_target_debug_interface_type="ADIv5"
arm_target_device_name="LPC4357_M4"
arm_target_interface_type="SWD"
- build_treat_warnings_as_errors="Yes"
+ build_treat_warnings_as_errors="No"
c_preprocessor_definitions="CORE_M4;__LPC4300_FAMILY;__LPC435x_SUBFAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;BOARD_EA4357;CFG_TUSB_MCU=OPT_MCU_LPC43XX;CFG_TUSB_MEM_SECTION= __attribute__((section(&quot;.bss2&quot;)))"
c_user_include_directories="../../src;$(rootDir)/hw;$(rootDir)/src;$(lpcDir)//inc;$(lpcDir)//inc/config_43xx"
debug_register_definition_file="LPC43xx_Registers.xml"
debug_target_connection="J-Link"
+ gcc_enable_all_warnings="Yes"
gcc_entry_point="Reset_Handler"
link_use_linker_script_file="No"
linker_memory_map_file="LPC4357 Cortex-M4_MemoryMap.xml"
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
diff --git a/examples/obsolete/host/src/keyboard_host_app.c b/examples/obsolete/host/src/keyboard_host_app.c
index fd51548c3..77fa8e5d3 100644
--- a/examples/obsolete/host/src/keyboard_host_app.c
+++ b/examples/obsolete/host/src/keyboard_host_app.c
@@ -42,7 +42,7 @@
#include "keyboard_host_app.h"
#include "app_os_prio.h"
-#if CFG_TUSB_HOST_HID_KEYBOARD
+#if CFG_TUH_HID_KEYBOARD
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
diff --git a/examples/obsolete/host/src/keyboard_host_app.h b/examples/obsolete/host/src/keyboard_host_app.h
index ff20d75df..965cd45cc 100644
--- a/examples/obsolete/host/src/keyboard_host_app.h
+++ b/examples/obsolete/host/src/keyboard_host_app.h
@@ -59,7 +59,7 @@
extern "C" {
#endif
-#if CFG_TUSB_HOST_HID_KEYBOARD
+#if CFG_TUH_HID_KEYBOARD
void keyboard_host_app_init(void);
void keyboard_host_app_task(void* param);
diff --git a/examples/obsolete/host/src/main.c b/examples/obsolete/host/src/main.c
index 320e1c8f5..5da98fb68 100644
--- a/examples/obsolete/host/src/main.c
+++ b/examples/obsolete/host/src/main.c
@@ -136,8 +136,8 @@ void print_greeting(void)
puts("This HOST demo is configured to support:");
printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
if (CFG_TUH_HUB ) puts(" - Hub (1 level only)");
- if (CFG_TUSB_HOST_HID_MOUSE ) puts(" - HID Mouse");
- if (CFG_TUSB_HOST_HID_KEYBOARD ) puts(" - HID Keyboard");
+ if (CFG_TUH_HID_MOUSE ) puts(" - HID Mouse");
+ if (CFG_TUH_HID_KEYBOARD ) puts(" - HID Keyboard");
if (CFG_TUH_MSC ) puts(" - Mass Storage");
if (CFG_TUH_CDC ) puts(" - Communication Device Class");
}
diff --git a/examples/obsolete/host/src/mouse_host_app.c b/examples/obsolete/host/src/mouse_host_app.c
index 819c2b290..79af898c7 100644
--- a/examples/obsolete/host/src/mouse_host_app.c
+++ b/examples/obsolete/host/src/mouse_host_app.c
@@ -42,7 +42,7 @@
#include "mouse_host_app.h"
#include "app_os_prio.h"
-#if CFG_TUSB_HOST_HID_MOUSE
+#if CFG_TUH_HID_MOUSE
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
diff --git a/examples/obsolete/host/src/mouse_host_app.h b/examples/obsolete/host/src/mouse_host_app.h
index c5e9977ae..823107a5e 100644
--- a/examples/obsolete/host/src/mouse_host_app.h
+++ b/examples/obsolete/host/src/mouse_host_app.h
@@ -62,7 +62,7 @@
extern "C" {
#endif
-#if CFG_TUSB_HOST_HID_MOUSE
+#if CFG_TUH_HID_MOUSE
void mouse_host_app_init(void);
void mouse_host_app_task(void* param);
diff --git a/examples/obsolete/host/src/tusb_config.h b/examples/obsolete/host/src/tusb_config.h
index e555c8f35..7a7951f89 100644
--- a/examples/obsolete/host/src/tusb_config.h
+++ b/examples/obsolete/host/src/tusb_config.h
@@ -55,8 +55,8 @@
//------------- CLASS -------------//
#define CFG_TUH_HUB 1
-#define CFG_TUSB_HOST_HID_KEYBOARD 1
-#define CFG_TUSB_HOST_HID_MOUSE 1
+#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
#define CFG_TUH_CDC 1