summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-05-13 13:42:52 +0700
committerhathach <[email protected]>2021-05-18 12:58:24 +0700
commit9324fd8f2e549434fd2a399500ae1dc766530046 (patch)
tree9d9762a54150b2e2ddb2d1dd698f522cd71bb2b5 /examples
parent7305fec4db13e846aa945b26d18418ec1e5e4ce7 (diff)
more hid host API rework
Diffstat (limited to 'examples')
-rw-r--r--examples/host/cdc_msc_hid/src/main.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c
index 6b2d0affb..c37cad15d 100644
--- a/examples/host/cdc_msc_hid/src/main.c
+++ b/examples/host/cdc_msc_hid/src/main.c
@@ -160,7 +160,7 @@ void tuh_hid_mounted_cb(uint8_t dev_addr, uint8_t instance)
// printf("A Keyboard device (address %d) is mounted\r\n", dev_addr);
if (instance == 0) {
- tuh_hid_keyboard_get_report(dev_addr, &usb_keyboard_report);
+ tuh_n_hid_n_get_report(dev_addr, instance, &usb_keyboard_report, sizeof(usb_keyboard_report));
}
}
@@ -243,28 +243,30 @@ void tuh_hid_mouse_unmounted_cb(uint8_t dev_addr)
void hid_task(void)
{
- uint8_t const addr = 1;
+ uint8_t const daddr = 1;
+ uint8_t const instance = 0;
#if CFG_TUH_HID_KEYBOARD
- if ( tuh_n_hid_n_keyboard_mounted(addr, 0) )
+ if ( tuh_n_hid_n_keyboard_mounted(daddr, instance) )
{
- if ( !tuh_hid_keyboard_is_busy(addr) )
+ if ( tuh_n_hid_n_ready(daddr, instance) )
{
process_kbd_report(&usb_keyboard_report);
- tuh_hid_keyboard_get_report(addr, &usb_keyboard_report);
+ tuh_n_hid_n_get_report(daddr, instance, &usb_keyboard_report, sizeof(usb_keyboard_report));
}
}
#endif
#if CFG_TUH_HID_MOUSE
- if ( tuh_n_hid_n_mouse_mounted(addr, 0) )
- {
- if ( !tuh_hid_mouse_is_busy(addr) )
- {
- process_mouse_report(&usb_mouse_report);
- tuh_hid_mouse_get_report(addr, &usb_mouse_report);
- }
- }
+ (void) usb_mouse_report;
+// if ( tuh_n_hid_n_mouse_mounted(daddr, instance) )
+// {
+// if ( tuh_n_hid_n_ready(daddr, instance) )
+// {
+// process_mouse_report(&usb_mouse_report);
+// tuh_n_hid_n_get_report(daddr, instance, &usb_mouse_report, sizeof(usb_mouse_report));
+// }
+// }
#endif
}