summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-05-13 15:44:00 +0700
committerhathach <[email protected]>2021-05-18 12:58:24 +0700
commit641f55f1f18234dbcf3f2b5d46d2231a5e9abae3 (patch)
tree12b25f506cac8130aa7d77c9db03050932205b0e
parentcc1b83412a0263f0f3d5db492f5680f4a9bb179b (diff)
remove CFG_TUH_HID_KEYBOARD and CFG_TUH_HID_MOUSE
-rw-r--r--examples/host/cdc_msc_hid/src/main.c30
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h6
-rw-r--r--src/class/hid/hid_host.c4
-rw-r--r--src/host/hcd.h5
4 files changed, 7 insertions, 38 deletions
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c
index c37cad15d..17f649aa4 100644
--- a/examples/host/cdc_msc_hid/src/main.c
+++ b/examples/host/cdc_msc_hid/src/main.c
@@ -51,14 +51,13 @@ int main(void)
{
// tinyusb host task
tuh_task();
-
led_blinking_task();
#if CFG_TUH_CDC
cdc_task();
#endif
-#if CFG_TUH_HID_KEYBOARD || CFG_TUH_HID_MOUSE
+#if CFG_TUH_HID
hid_task();
#endif
}
@@ -109,8 +108,6 @@ void cdc_task(void)
//--------------------------------------------------------------------+
// USB HID
//--------------------------------------------------------------------+
-#if CFG_TUH_HID_KEYBOARD
-
CFG_TUSB_MEM_SECTION static hid_keyboard_report_t usb_keyboard_report;
uint8_t const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII };
@@ -158,6 +155,7 @@ void tuh_hid_mounted_cb(uint8_t dev_addr, uint8_t instance)
{
printf("HID device address = %d, instance = %d is mounted\r\n", dev_addr, instance);
// printf("A Keyboard device (address %d) is mounted\r\n", dev_addr);
+// printf("A Mouse device (address %d) is mounted\r\n", dev_addr);
if (instance == 0) {
tuh_n_hid_n_get_report(dev_addr, instance, &usb_keyboard_report, sizeof(usb_keyboard_report));
@@ -168,11 +166,9 @@ void tuh_hid_unmounted_cb(uint8_t dev_addr, uint8_t instance)
{
printf("HID device address = %d, instance = %d is unmounted\r\n", dev_addr, instance);
// printf("A Keyboard device (address %d) is unmounted\r\n", dev_addr);
+// printf("A Mouse device (address %d) is unmounted\r\n", dev_addr);
}
-#endif
-
-#if CFG_TUH_HID_MOUSE
CFG_TUSB_MEM_SECTION static hid_mouse_report_t usb_mouse_report;
@@ -225,28 +221,12 @@ static inline void process_mouse_report(hid_mouse_report_t const * p_report)
}
-void tuh_hid_mouse_mounted_cb(uint8_t dev_addr)
-{
- // application set-up
- printf("A Mouse device (address %d) is mounted\r\n", dev_addr);
-}
-
-void tuh_hid_mouse_unmounted_cb(uint8_t dev_addr)
-{
- // application tear-down
- printf("A Mouse device (address %d) is unmounted\r\n", dev_addr);
-}
-
-#endif
-
-
void hid_task(void)
{
uint8_t const daddr = 1;
uint8_t const instance = 0;
-#if CFG_TUH_HID_KEYBOARD
if ( tuh_n_hid_n_keyboard_mounted(daddr, instance) )
{
if ( tuh_n_hid_n_ready(daddr, instance) )
@@ -255,9 +235,8 @@ void hid_task(void)
tuh_n_hid_n_get_report(daddr, instance, &usb_keyboard_report, sizeof(usb_keyboard_report));
}
}
-#endif
-#if CFG_TUH_HID_MOUSE
+// #if CFG_TUH_HID_MOUSE
(void) usb_mouse_report;
// if ( tuh_n_hid_n_mouse_mounted(daddr, instance) )
// {
@@ -267,7 +246,6 @@ void hid_task(void)
// tuh_n_hid_n_get_report(daddr, instance, &usb_mouse_report, sizeof(usb_mouse_report));
// }
// }
-#endif
}
//--------------------------------------------------------------------+
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index e1e02e31e..01296cd26 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -76,13 +76,7 @@
#define CFG_TUH_HUB 1
#define CFG_TUH_CDC 1
-
#define CFG_TUH_HID 2
-
-#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_VENDOR 0
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index dc29f7322..60ee667d0 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -140,8 +140,8 @@ bool tuh_n_hid_n_keyboard_mounted(uint8_t dev_addr, uint8_t instance)
//--------------------------------------------------------------------+
// MOUSE
//--------------------------------------------------------------------+
-#if CFG_TUH_HID_MOUSE
+// TODO remove
static hidh_interface_t mouseh_data[CFG_TUSB_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1
//------------- Public API -------------//
@@ -151,8 +151,6 @@ bool tuh_n_hid_n_mouse_mounted(uint8_t dev_addr, uint8_t instance)
return tuh_device_ready(dev_addr) && (mouseh_data[dev_addr-1].ep_in != 0);
}
-#endif
-
//--------------------------------------------------------------------+
// USBH API
//--------------------------------------------------------------------+
diff --git a/src/host/hcd.h b/src/host/hcd.h
index 4810ef8da..a470a45e8 100644
--- a/src/host/hcd.h
+++ b/src/host/hcd.h
@@ -85,9 +85,8 @@ typedef struct
#if TUSB_OPT_HOST_ENABLED
// Max number of endpoints per device
enum {
- HCD_MAX_ENDPOINT = CFG_TUSB_HOST_DEVICE_MAX*(CFG_TUH_HUB + CFG_TUH_HID_KEYBOARD + CFG_TUH_HID_MOUSE + CFG_TUSB_HOST_HID_GENERIC +
- CFG_TUH_MSC*2 + CFG_TUH_CDC*3),
-
+ // TODO better computation
+ HCD_MAX_ENDPOINT = CFG_TUSB_HOST_DEVICE_MAX*(CFG_TUH_HUB + CFG_TUH_HID*2 + CFG_TUH_MSC*2 + CFG_TUH_CDC*3),
HCD_MAX_XFER = HCD_MAX_ENDPOINT*2,
};